2018-08-18 09:43:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-08 20:05:44 +00:00
|
|
|
#include <glibmm/markup.h>
|
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/label.h>
|
2019-04-18 15:52:00 +00:00
|
|
|
#include <json/json.h>
|
|
|
|
#include "IModule.hpp"
|
2018-08-18 09:43:48 +00:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
|
|
|
class ALabel : public IModule {
|
2019-04-18 15:52:00 +00:00
|
|
|
public:
|
2019-05-22 10:06:24 +00:00
|
|
|
ALabel(const Json::Value &, const std::string &, const std::string &, const std::string &format,
|
|
|
|
uint16_t interval = 0);
|
2019-04-23 13:56:38 +00:00
|
|
|
virtual ~ALabel();
|
2019-04-18 15:52:00 +00:00
|
|
|
virtual auto update() -> void;
|
2019-05-13 09:31:05 +00:00
|
|
|
virtual std::string getIcon(uint16_t, const std::string &alt = "", uint16_t max = 0);
|
2019-04-18 15:52:00 +00:00
|
|
|
virtual operator Gtk::Widget &();
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
protected:
|
2019-02-22 10:35:26 +00:00
|
|
|
bool tooltipEnabled();
|
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
Gtk::EventBox event_box_;
|
|
|
|
Gtk::Label label_;
|
|
|
|
const Json::Value & config_;
|
|
|
|
std::string format_;
|
2019-05-02 14:56:45 +00:00
|
|
|
std::string click_param;
|
2019-04-18 15:52:00 +00:00
|
|
|
std::mutex mutex_;
|
2018-11-23 10:57:37 +00:00
|
|
|
const std::chrono::seconds interval_;
|
2019-04-18 15:52:00 +00:00
|
|
|
bool alt_ = false;
|
|
|
|
std::string default_format_;
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2019-05-22 10:06:24 +00:00
|
|
|
virtual bool handleToggle(GdkEventButton *const &ev);
|
|
|
|
virtual bool handleScroll(GdkEventScroll *);
|
2019-05-16 07:39:06 +00:00
|
|
|
virtual std::string getState(uint8_t value, bool lesser = false);
|
2019-04-23 13:56:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<int> pid_;
|
2019-06-11 15:56:10 +00:00
|
|
|
gdouble distance_scrolled_;
|
2018-08-18 09:43:48 +00:00
|
|
|
};
|
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
} // namespace waybar
|