2018-08-18 09:43:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-08 20:05:44 +00:00
|
|
|
#include <glibmm/markup.h>
|
|
|
|
#include <gtkmm/label.h>
|
2019-04-18 15:52:00 +00:00
|
|
|
#include <json/json.h>
|
2022-04-06 06:37:19 +00:00
|
|
|
|
2019-06-15 12:57:52 +00:00
|
|
|
#include "AModule.hpp"
|
2018-08-18 09:43:48 +00:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
2019-06-15 12:57:52 +00:00
|
|
|
class ALabel : public AModule {
|
2019-04-18 15:52:00 +00:00
|
|
|
public:
|
2019-05-22 10:06:24 +00:00
|
|
|
ALabel(const Json::Value &, const std::string &, const std::string &, const std::string &format,
|
2022-04-06 06:37:19 +00:00
|
|
|
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false,
|
|
|
|
bool enable_scroll = false);
|
2019-06-15 12:57:52 +00:00
|
|
|
virtual ~ALabel() = default;
|
2023-03-02 13:57:07 +00:00
|
|
|
auto update() -> void override;
|
2019-05-13 09:31:05 +00:00
|
|
|
virtual std::string getIcon(uint16_t, const std::string &alt = "", uint16_t max = 0);
|
2021-07-15 06:52:02 +00:00
|
|
|
virtual std::string getIcon(uint16_t, const std::vector<std::string> &alts, uint16_t max = 0);
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
protected:
|
2022-04-06 06:37:19 +00:00
|
|
|
Gtk::Label label_;
|
|
|
|
std::string format_;
|
2018-11-23 10:57:37 +00:00
|
|
|
const std::chrono::seconds interval_;
|
2022-04-06 06:37:19 +00:00
|
|
|
bool alt_ = false;
|
|
|
|
std::string default_format_;
|
2018-10-29 17:04:09 +00:00
|
|
|
|
2024-01-08 16:03:42 +00:00
|
|
|
//todo bool handleToggle(GdkEventButton *const &e) override;
|
2019-05-16 07:39:06 +00:00
|
|
|
virtual std::string getState(uint8_t value, bool lesser = false);
|
2018-08-18 09:43:48 +00:00
|
|
|
};
|
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
} // namespace waybar
|