2016-06-14 23:32:35 -04:00
|
|
|
#pragma once
|
|
|
|
|
2016-12-05 14:41:00 -05:00
|
|
|
#include <map>
|
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
#include "common.hpp"
|
2016-12-26 11:06:28 -05:00
|
|
|
#include "components/types.hpp"
|
2020-12-17 14:37:28 -05:00
|
|
|
#include "tags/types.hpp"
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2016-12-05 14:41:00 -05:00
|
|
|
using std::map;
|
|
|
|
|
2016-11-19 09:49:03 -05:00
|
|
|
// fwd decl
|
2016-06-14 23:32:35 -04:00
|
|
|
using namespace drawtypes;
|
2020-11-22 17:05:45 -05:00
|
|
|
namespace modules {
|
|
|
|
struct module_interface;
|
|
|
|
}
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
class builder {
|
|
|
|
public:
|
2016-12-30 22:32:11 -05:00
|
|
|
explicit builder(const bar_settings& bar);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2019-01-12 08:51:54 -05:00
|
|
|
void reset();
|
2016-11-02 15:22:45 -04:00
|
|
|
string flush();
|
2016-12-26 11:06:28 -05:00
|
|
|
void append(string text);
|
2019-12-11 15:38:21 -05:00
|
|
|
void node(string str);
|
|
|
|
void node(string str, int font_index);
|
|
|
|
void node(const label_t& label);
|
|
|
|
void node_repeat(const string& str, size_t n);
|
|
|
|
void node_repeat(const label_t& label, size_t n);
|
2020-05-15 13:42:32 -04:00
|
|
|
void offset(int pixels);
|
2016-12-26 11:06:28 -05:00
|
|
|
void space(size_t width);
|
|
|
|
void space();
|
|
|
|
void remove_trailing_space(size_t len);
|
|
|
|
void remove_trailing_space();
|
2016-11-02 15:22:45 -04:00
|
|
|
void font(int index);
|
2016-11-24 13:24:47 -05:00
|
|
|
void font_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void background(rgba color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void background_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void color(rgba color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void color_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void line_color(const rgba& color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void line_color_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void overline_color(rgba color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void overline_color_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void underline_color(rgba color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void underline_color_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void overline(const rgba& color = rgba{});
|
2016-11-24 13:24:47 -05:00
|
|
|
void overline_close();
|
2019-10-27 17:41:18 -04:00
|
|
|
void underline(const rgba& color = rgba{});
|
2016-11-24 13:24:47 -05:00
|
|
|
void underline_close();
|
2020-12-17 14:37:28 -05:00
|
|
|
void control(tags::controltag tag);
|
2020-05-24 12:35:12 -04:00
|
|
|
void action(mousebtn index, string action);
|
2020-11-22 17:05:45 -05:00
|
|
|
void action(mousebtn btn, const modules::module_interface& module, string action, string data);
|
2020-05-24 12:35:12 -04:00
|
|
|
void action(mousebtn index, string action, const label_t& label);
|
2020-11-22 17:05:45 -05:00
|
|
|
void action(mousebtn btn, const modules::module_interface& module, string action, string data, const label_t& label);
|
2020-05-24 12:35:12 -04:00
|
|
|
void action_close();
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
protected:
|
2020-12-17 14:37:28 -05:00
|
|
|
void tag_open(tags::syntaxtag tag, const string& value);
|
|
|
|
void tag_open(tags::attribute attr);
|
|
|
|
void tag_close(tags::syntaxtag tag);
|
|
|
|
void tag_close(tags::attribute attr);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
private:
|
2016-12-26 11:06:28 -05:00
|
|
|
const bar_settings m_bar;
|
2016-12-26 04:37:14 -05:00
|
|
|
string m_output;
|
|
|
|
|
2020-12-17 14:37:28 -05:00
|
|
|
map<tags::syntaxtag, int> m_tags{};
|
|
|
|
map<tags::syntaxtag, string> m_colors{};
|
|
|
|
map<tags::attribute, bool> m_attrs{};
|
2016-12-26 04:37:14 -05:00
|
|
|
|
2017-01-19 05:11:28 -05:00
|
|
|
int m_fontindex{0};
|
2016-06-14 23:32:35 -04:00
|
|
|
};
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|