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