16 static std::string simple_border_charset[] = {
"╭",
"╮",
"╰",
"╯",
"─",
17 "│",
"┬",
"┴",
"┤",
"├"};
24 class Border :
public Node {
27 :
Node(std::move(children)),
28 charset(std::begin(simple_border_charset),
29 std::end(simple_border_charset)) {}
30 Border(
Elements children, Pixel pixel)
31 :
Node(std::move(children)), charset_pixel(10, pixel) {}
33 std::vector<Pixel> charset_pixel;
34 std::vector<std::string> charset;
36 void ComputeRequirement()
override {
51 void SetBox(Box box)
override {
55 title_box.x_min = box.x_min + 1;
56 title_box.x_max = box.x_max - 1;
57 title_box.y_min = box.y_min;
58 title_box.y_max = box.y_min;
68 void Render(Screen& screen)
override {
82 void RenderPixel(Screen& screen) {
101 void RenderChar(Screen& screen) {
107 screen.PixelAt(x,
box_.
y_min) = charset_pixel[4];
108 screen.PixelAt(x,
box_.
y_max) = charset_pixel[4];
111 screen.PixelAt(
box_.
x_min, y) = charset_pixel[5];
112 screen.PixelAt(
box_.
x_max, y) = charset_pixel[5];
139 return std::make_shared<Border>(unpack(std::move(child)));
164 return std::make_shared<Border>(unpack(std::move(content), std::move(title)));
171 return [pixel](
Element child) {
172 return std::make_shared<Border>(unpack(std::move(child)), pixel);