25 void ComputeRequirement()
override {
27 requirement_ = children_[0]->requirement();
31 void SetBox(
Box box)
override {
34 children_[0]->SetBox(box);
42 const int size_inner = box_.
y_max - box_.y_min;
43 if (size_inner <= 0) {
46 const int size_outter = stencil.
y_max - stencil.
y_min + 1;
47 if (size_outter >= size_inner) {
51 int size = 2 * size_outter * size_outter / size_inner;
56 2 * (stencil.
y_min - box_.y_min) * size_outter / size_inner;
58 const int x = stencil.
x_max;
59 for (
int y = stencil.
y_min; y <= stencil.
y_max; ++y) {
60 const int y_up = 2 * y + 0;
61 const int y_down = 2 * y + 1;
62 const bool up = (start_y <= y_up) && (y_up <= start_y +
size);
63 const bool down = (start_y <= y_down) && (y_down <= start_y +
size);
65 const char* c = up ? (down ?
"┃" :
"╹") : (down ?
"╻" :
" ");
70 return std::make_shared<Impl>(std::move(child));
80 void ComputeRequirement()
override {
82 requirement_ = children_[0]->requirement();
86 void SetBox(
Box box)
override {
89 children_[0]->SetBox(box);
97 const int size_inner = box_.
x_max - box_.x_min;
98 if (size_inner <= 0) {
101 const int size_outter = stencil.
x_max - stencil.
x_min + 1;
102 if (size_outter >= size_inner) {
106 int size = 2 * size_outter * size_outter / size_inner;
111 2 * (stencil.
x_min - box_.x_min) * size_outter / size_inner;
113 const int y = stencil.
y_max;
114 for (
int x = stencil.
x_min; x <= stencil.
x_max; ++x) {
115 const int x_left = 2 * x + 0;
116 const int x_right = 2 * x + 1;
117 const bool left = (start_x <= x_left) && (x_left <= start_x +
size);
118 const bool right = (start_x <= x_right) && (x_right <= start_x +
size);
121 left ? (right ?
"─" :
"╴") : (right ?
"╶" :
" ");
126 return std::make_shared<Impl>(std::move(child));
Pixel & PixelAt(int x, int y)
Access a cell (Pixel) at a given position.
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.
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.