26 void ComputeRequirement()
override {
28 requirement_ = children_[0]->requirement();
32 void SetBox(
Box box)
override {
35 children_[0]->SetBox(box);
43 const int size_inner = box_.
y_max - box_.y_min;
44 if (size_inner <= 0) {
47 const int size_outter = stencil.
y_max - stencil.
y_min + 1;
48 if (size_outter >= size_inner) {
52 int size = 2 * size_outter * size_outter / size_inner;
57 2 * (stencil.
y_min - box_.y_min) * size_outter / size_inner;
59 const int x = stencil.
x_max;
60 for (
int y = stencil.
y_min; y <= stencil.
y_max; ++y) {
61 const int y_up = 2 * y + 0;
62 const int y_down = 2 * y + 1;
63 const bool up = (start_y <= y_up) && (y_up <= start_y +
size);
64 const bool down = (start_y <= y_down) && (y_down <= start_y +
size);
66 const char* c = up ? (down ?
"┃" :
"╹") : (down ?
"╻" :
" ");
71 return std::make_shared<Impl>(std::move(child));
81 void ComputeRequirement()
override {
83 requirement_ = children_[0]->requirement();
87 void SetBox(
Box box)
override {
90 children_[0]->SetBox(box);
98 const int size_inner = box_.
x_max - box_.x_min;
99 if (size_inner <= 0) {
102 const int size_outter = stencil.
x_max - stencil.
x_min + 1;
103 if (size_outter >= size_inner) {
107 int size = 2 * size_outter * size_outter / size_inner;
112 2 * (stencil.
x_min - box_.x_min) * size_outter / size_inner;
114 const int y = stencil.
y_max;
115 for (
int x = stencil.
x_min; x <= stencil.
x_max; ++x) {
116 const int x_left = 2 * x + 0;
117 const int x_right = 2 * x + 1;
118 const bool left = (start_x <= x_left) && (x_left <= start_x +
size);
119 const bool right = (start_x <= x_right) && (x_right <= start_x +
size);
122 left ? (right ?
"─" :
"╴") : (right ?
"╶" :
" ");
127 return std::make_shared<Impl>(std::move(child));
NodeDecorator(Element child)
void ComputeRequirement() override
Compute how much space an elements needs.
virtual void Render(Screen &screen)
Display an element on a ftxui::Screen.
A rectangular grid of Pixel.
Pixel & PixelAt(int x, int y)
Access a cell (Pixel) at a given position.
Element vscroll_indicator(Element)
Display a vertical scrollbar to the right. colors.
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
std::shared_ptr< Node > Element
Element hscroll_indicator(Element)
Display an horizontal scrollbar to the bottom. colors.
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.