18class Focus :
public Node {
22 void ComputeRequirement()
override {
24 requirement_ = children_[0]->requirement();
25 requirement_.focused.enabled =
true;
26 requirement_.focused.node =
this;
27 requirement_.focused.box.x_min = 0;
28 requirement_.focused.box.y_min = 0;
29 requirement_.focused.box.x_max = requirement_.min_x - 1;
30 requirement_.focused.box.y_max = requirement_.min_y - 1;
33 void SetBox(Box box)
override {
35 children_[0]->SetBox(box);
39class Frame :
public Node {
44 void SetBox(Box box)
override {
75 children_[0]->Render(
screen);
83class FocusCursor :
public Focus {
89 void ComputeRequirement()
override {
90 Focus::ComputeRequirement();
91 requirement_.focused.cursor_shape = shape_;
102 return std::make_shared<Focus>(
unpack(std::move(
child)));
119 return std::make_shared<Frame>(
unpack(std::move(
child)),
true,
true);
127 return std::make_shared<Frame>(
unpack(std::move(
child)),
true,
false);
135 return std::make_shared<Frame>(
unpack(std::move(
child)),
false,
true);
148 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
162 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
176 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
190 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
204 return std::make_shared<FocusCursor>(
unpack(std::move(
child)),
218 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
std::shared_ptr< T > Make(Args &&... args)
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 e)
Set the child to be the one focused among its siblings.
Element focus(Element)
Set the child to be the one focused among its siblings.
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