polybar/include/drawtypes/label.hpp

31 lines
1023 B
C++
Raw Normal View History

#pragma once
2016-05-19 14:41:06 +00:00
#include <string>
#include <memory>
namespace drawtypes
{
struct Label
{
std::string text, fg, bg, ul, ol;
int font = 0, padding = 0, margin = 0;
2016-06-21 01:59:43 +00:00
Label(std::string text, int font)
2016-05-19 14:41:06 +00:00
: text(text), font(font){}
2016-06-21 01:59:43 +00:00
Label(std::string text, std::string fg = "", std::string bg = "", std::string ul = "", std::string ol = "", int font = 0, int padding = 0, int margin = 0)
2016-05-19 14:41:06 +00:00
: text(text), fg(fg), bg(bg), ul(ul), ol(ol), font(font), padding(padding), margin(margin){}
operator bool() {
return !this->text.empty();
}
std::unique_ptr<Label> clone();
2016-06-21 01:59:43 +00:00
void replace_token(std::string token, std::string replacement);
2016-05-19 14:41:06 +00:00
void replace_defined_values(std::unique_ptr<Label> &label);
};
2016-06-21 01:59:43 +00:00
std::unique_ptr<Label> get_config_label(std::string module_name, std::string label_name = "label", bool required = true, std::string def = "");
std::unique_ptr<Label> get_optional_config_label(std::string module_name, std::string label_name = "label", std::string def = "");
2016-05-19 14:41:06 +00:00
}