2018-08-18 11:43:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-08 21:05:44 +01:00
|
|
|
#include <glibmm/markup.h>
|
|
|
|
#include <gtkmm/label.h>
|
2019-04-18 17:52:00 +02:00
|
|
|
#include <json/json.h>
|
2019-06-15 14:57:52 +02:00
|
|
|
#include "AModule.hpp"
|
2018-08-18 11:43:48 +02:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
2019-06-15 14:57:52 +02:00
|
|
|
class ALabel : public AModule {
|
2019-04-18 17:52:00 +02:00
|
|
|
public:
|
2019-05-22 12:06:24 +02:00
|
|
|
ALabel(const Json::Value &, const std::string &, const std::string &, const std::string &format,
|
2020-08-13 04:46:51 +02:00
|
|
|
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false, bool enable_scroll = false);
|
2019-06-15 14:57:52 +02:00
|
|
|
virtual ~ALabel() = default;
|
2019-04-18 17:52:00 +02:00
|
|
|
virtual auto update() -> void;
|
2019-05-13 11:31:05 +02:00
|
|
|
virtual std::string getIcon(uint16_t, const std::string &alt = "", uint16_t max = 0);
|
2020-05-22 21:23:04 +02:00
|
|
|
virtual std::string getIcon(uint16_t, std::vector<std::string> &alts, uint16_t max = 0);
|
2018-10-29 18:04:09 +01:00
|
|
|
|
2019-04-18 17:52:00 +02:00
|
|
|
protected:
|
|
|
|
Gtk::Label label_;
|
|
|
|
std::string format_;
|
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_;
|
2018-10-29 18:04:09 +01:00
|
|
|
|
2019-06-15 14:57:52 +02:00
|
|
|
virtual bool handleToggle(GdkEventButton *const &e);
|
2019-05-16 09:39:06 +02:00
|
|
|
virtual std::string getState(uint8_t value, bool lesser = false);
|
2018-08-18 11:43:48 +02:00
|
|
|
};
|
|
|
|
|
2019-04-18 17:52:00 +02:00
|
|
|
} // namespace waybar
|