14const std::string charset[][2] = {
22class Separator :
public Node {
24 Separator(std::string value) : value_(value) {}
26 void ComputeRequirement()
override {
31 void Render(Screen& screen)
override {
34 Pixel& pixel = screen.PixelAt(x, y);
35 pixel.character = value_;
36 pixel.automerge =
true;
44class SeparatorAuto :
public Node {
48 void ComputeRequirement()
override {
53 void Render(Screen& screen)
override {
57 const std::string c = charset[style_][is_line && !is_column];
61 Pixel& pixel = screen.PixelAt(x, y);
63 pixel.automerge =
true;
71class SeparatorWithPixel :
public SeparatorAuto {
73 SeparatorWithPixel(Pixel pixel) : SeparatorAuto(
LIGHT), pixel_(pixel) {
76 void Render(Screen& screen)
override {
79 screen.PixelAt(x, y) = pixel_;
121 return std::make_shared<SeparatorAuto>(
LIGHT);
158 return std::make_shared<SeparatorAuto>(style);
194 return std::make_shared<SeparatorAuto>(
LIGHT);
230 return std::make_shared<SeparatorAuto>(
HEAVY);
266 return std::make_shared<SeparatorAuto>(
DOUBLE);
302 return std::make_shared<SeparatorAuto>(
EMPTY);
339 return std::make_shared<Separator>(value);
369 return std::make_shared<SeparatorWithPixel>(pixel);
A rectangular grid of Pixel.
Element separatorStyled(BorderStyle)
Draw a vertical or horizontal separation in between two other elements.
Element separatorEmpty()
Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.
std::shared_ptr< Node > Element
Element separatorLight()
Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Element separatorCharacter(std::string)
Draw a vertical or horizontal separation in between two other elements.
Element separator(void)
Draw a vertical or horizontal separation in between two other elements.
Element separatorDouble()
Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Element separatorHeavy()
Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
A unicode character and its associated style.