waybar/include/ALabel.hpp

36 lines
961 B
C++
Raw Normal View History

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