19class Select :
public Node {
23 void ComputeRequirement()
override {
25 requirement_ = children_[0]->requirement();
26 auto& selected_box = requirement_.selected_box;
27 selected_box.x_min = 0;
28 selected_box.y_min = 0;
29 selected_box.x_max = requirement_.min_x - 1;
30 selected_box.y_max = requirement_.min_y - 1;
34 void SetBox(Box
box)
override {
36 children_[0]->SetBox(
box);
41class Focus :
public Select {
45 void ComputeRequirement()
override {
46 Select::ComputeRequirement();
70#if !defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
71 screen.SetCursor(Screen::Cursor{
80class Frame :
public Node {
85 void ComputeRequirement()
override {
87 requirement_ = children_[0]->requirement();
90 void SetBox(Box
box)
override {
92 auto& selected_box = requirement_.selected_box;
98 const int focused_dimx = selected_box.x_max - selected_box.x_min;
108 const int focused_dimy = selected_box.y_max - selected_box.y_min;
121 children_[0]->Render(
screen);
129class FocusCursor :
public Focus {
137 screen.SetCursor(Screen::Cursor{
153 return std::make_shared<Select>(
unpack(std::move(
child)));
160 return std::make_shared<Focus>(
unpack(std::move(
child)));
170 return std::make_shared<Frame>(
unpack(std::move(
child)),
true,
true);
178 return std::make_shared<Frame>(
unpack(std::move(
child)),
true,
false);
186 return std::make_shared<Frame>(
unpack(std::move(
child)),
false,
true);
199 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
213 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
227 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
241 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
255 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
269 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
virtual void SetBox(Box box)
Assign a position and a dimension to an element for drawing.
virtual void ComputeRequirement()
Compute how much space an elements needs.
Element focusCursorBarBlinking(Element)
Same as focus, but set the cursor shape to be a blinking bar.
std::shared_ptr< Node > Element
Element xframe(Element)
Same as frame, but only on the x-axis.
Element focusCursorUnderlineBlinking(Element)
Same as focus, but set the cursor shape to be a blinking underline.
Element focusCursorBar(Element)
Same as focus, but set the cursor shape to be a still block.
Element focusCursorBlock(Element)
Same as focus, but set the cursor shape to be a still block.
Element focusCursorUnderline(Element)
Same as focus, but set the cursor shape to be a still underline.
std::vector< Element > Elements
Element yframe(Element)
Same as frame, but only on the y-axis.
Element select(Element)
Set the child to be the one selected among its siblings.
Element focus(Element)
Set the child to be the one in focus globally.
Component Slider(SliderOption< T > options)
A slider in any direction.
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Element focusCursorBlockBlinking(Element)
Same as focus, but set the cursor shape to be a blinking block.
static auto Intersection(Box a, Box b) -> Box