Waybar/include/ALabel.hpp

31 lines
906 B
C++
Raw Normal View History

#pragma once
#include <glibmm/markup.h>
#include <gtkmm/label.h>
2019-04-18 15:52:00 +00:00
#include <json/json.h>
2019-06-15 12:57:52 +00:00
#include "AModule.hpp"
namespace waybar {
2019-06-15 12:57:52 +00:00
class ALabel : public AModule {
2019-04-18 15:52:00 +00:00
public:
ALabel(const Json::Value &, const std::string &, const std::string &, const std::string &format,
2019-06-28 12:16:09 +00:00
uint16_t interval = 0, bool ellipsize = false);
2019-06-15 12:57:52 +00:00
virtual ~ALabel() = default;
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
protected:
Gtk::Label label_;
std::string format_;
std::string click_param;
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_;
2019-06-15 12:57:52 +00:00
virtual bool handleToggle(GdkEventButton *const &e);
2019-05-16 07:39:06 +00:00
virtual std::string getState(uint8_t value, bool lesser = false);
};
2019-04-18 15:52:00 +00:00
} // namespace waybar