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