feat(modules): generic label module to allow max-length on all labels

This commit is contained in:
Alexis
2018-08-18 11:43:48 +02:00
parent c128562284
commit b1fd4d7b82
19 changed files with 76 additions and 99 deletions

24
src/ALabel.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "ALabel.hpp"
waybar::ALabel::ALabel(Json::Value config)
: config_(std::move(config))
{
if (config_["max-length"]) {
label_.set_max_width_chars(config_["max-length"].asUInt());
label_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
}
}
waybar::ALabel::~ALabel()
{
// Nothing here
}
auto waybar::ALabel::update() -> void
{
// Nothing here
}
waybar::ALabel::operator Gtk::Widget &() {
return label_;
}