1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-27 05:23:39 -04:00
polybar/include/drawtypes/label.hpp

31 lines
1,023 B
C++
Raw Normal View History

#pragma once
2016-05-19 10:41:06 -04: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-20 21:59:43 -04:00
Label(std::string text, int font)
2016-05-19 10:41:06 -04:00
: text(text), font(font){}
2016-06-20 21:59:43 -04: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 10:41:06 -04: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-20 21:59:43 -04:00
void replace_token(std::string token, std::string replacement);
2016-05-19 10:41:06 -04:00
void replace_defined_values(std::unique_ptr<Label> &label);
};
2016-06-20 21:59:43 -04: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 10:41:06 -04:00
}