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"
|
2016-06-14 23:32:35 -04:00
|
|
|
|
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
|
|
|
|
namespace drawtypes {
|
|
|
|
class label;
|
|
|
|
using label_t = shared_ptr<label>;
|
|
|
|
using icon = label;
|
|
|
|
using icon_t = label_t;
|
|
|
|
}
|
2016-06-14 23:32:35 -04:00
|
|
|
using namespace drawtypes;
|
|
|
|
|
|
|
|
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
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
string flush();
|
2016-12-26 11:06:28 -05:00
|
|
|
void append(string text);
|
2016-11-02 15:22:45 -04:00
|
|
|
void node(string str, bool add_space = false);
|
|
|
|
void node(string str, int font_index, bool add_space = false);
|
2016-11-25 07:55:15 -05:00
|
|
|
void node(const label_t& label, bool add_space = false);
|
2016-12-03 22:11:47 -05:00
|
|
|
void node_repeat(const string& str, size_t n, bool add_space = false);
|
2016-11-30 16:17:52 -05:00
|
|
|
void node_repeat(const label_t& label, size_t n, bool add_space = false);
|
2016-11-02 15:22:45 -04:00
|
|
|
void offset(int pixels = 0);
|
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();
|
2016-11-02 15:22:45 -04:00
|
|
|
void background(string color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void background_close();
|
|
|
|
void color(string color);
|
|
|
|
void color_alpha(string alpha);
|
|
|
|
void color_close();
|
2016-11-25 07:55:15 -05:00
|
|
|
void line_color(const string& color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void line_color_close();
|
2016-11-21 10:14:40 -05:00
|
|
|
void overline_color(string color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void overline_color_close();
|
2016-11-21 10:14:40 -05:00
|
|
|
void underline_color(string color);
|
2016-11-24 13:24:47 -05:00
|
|
|
void underline_color_close();
|
2016-11-25 07:55:15 -05:00
|
|
|
void overline(const string& color = "");
|
2016-11-24 13:24:47 -05:00
|
|
|
void overline_close();
|
2016-11-25 07:55:15 -05:00
|
|
|
void underline(const string& color = "");
|
2016-11-24 13:24:47 -05:00
|
|
|
void underline_close();
|
2016-11-02 15:22:45 -04:00
|
|
|
void cmd(mousebtn index, string action, bool condition = true);
|
2017-01-13 05:22:23 -05:00
|
|
|
void cmd(mousebtn index, string action, const label_t& label);
|
2016-12-04 23:32:10 -05:00
|
|
|
void cmd_close(bool condition = true);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
protected:
|
2016-11-24 13:24:47 -05:00
|
|
|
string background_hex();
|
|
|
|
string foreground_hex();
|
|
|
|
|
2016-11-25 07:55:15 -05:00
|
|
|
void tag_open(syntaxtag tag, const string& value);
|
2016-11-24 13:24:47 -05:00
|
|
|
void tag_open(attribute attr);
|
|
|
|
void tag_close(syntaxtag tag);
|
|
|
|
void tag_close(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;
|
|
|
|
|
2016-12-26 11:06:28 -05:00
|
|
|
map<syntaxtag, int> m_tags{};
|
|
|
|
map<syntaxtag, string> m_colors{};
|
2016-12-26 04:37:14 -05:00
|
|
|
|
2017-01-19 05:11:28 -05:00
|
|
|
int m_attributes{0};
|
|
|
|
int m_fontindex{0};
|
2016-12-26 04:37:14 -05:00
|
|
|
|
2016-12-26 11:06:28 -05:00
|
|
|
string m_background{};
|
|
|
|
string m_foreground{};
|
2016-06-14 23:32:35 -04:00
|
|
|
};
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|