2018-08-18 09:43:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <json/json.h>
|
|
|
|
#include "IModule.hpp"
|
2019-01-08 20:05:44 +00:00
|
|
|
#include <glibmm/markup.h>
|
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/label.h>
|
2018-08-18 09:43:48 +00:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
|
|
|
class ALabel : public IModule {
|
2018-12-18 16:30:54 +00:00
|
|
|
public:
|
|
|
|
ALabel(const Json::Value &, const std::string format, uint16_t interval = 0);
|
2018-10-29 17:04:09 +00:00
|
|
|
virtual ~ALabel() = default;
|
|
|
|
virtual auto update() -> void;
|
2018-12-18 16:30:54 +00:00
|
|
|
virtual std::string getIcon(uint16_t, const std::string &alt = "");
|
|
|
|
virtual operator Gtk::Widget &();
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2018-12-18 16:30:54 +00:00
|
|
|
protected:
|
2019-02-22 10:35:26 +00:00
|
|
|
bool tooltipEnabled();
|
|
|
|
|
2018-10-29 17:04:09 +00:00
|
|
|
Gtk::EventBox event_box_;
|
|
|
|
Gtk::Label label_;
|
2018-12-18 16:30:54 +00:00
|
|
|
const Json::Value &config_;
|
2018-10-29 17:04:09 +00:00
|
|
|
std::string format_;
|
|
|
|
std::mutex mutex_;
|
2018-11-23 10:57:37 +00:00
|
|
|
const std::chrono::seconds interval_;
|
2019-01-13 21:36:37 +00:00
|
|
|
bool alt_ = false;
|
|
|
|
std::string default_format_;
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2019-03-03 21:02:34 +00:00
|
|
|
virtual bool handleToggle(GdkEventButton *const &ev);
|
|
|
|
virtual bool handleScroll(GdkEventScroll *);
|
2018-08-18 09:43:48 +00:00
|
|
|
};
|
|
|
|
|
2018-12-18 16:30:54 +00:00
|
|
|
} // namespace waybar
|