Skip to content
You are viewing documentation for v7.0.2. Switch to latest (main).

ftxui::Node ​

cpp
#include <ftxui/dom/node.hpp>

Node is the base class for all elements in the DOM tree.

It represents a single node in the document object model (DOM) and provides the basic structure for layout and rendering. It contains methods for computing layout requirements, setting the box dimensions, selecting content, rendering to the screen, and checking the layout status. It typically contains child elements, which are also instances of Node.

Users are expected to derive from this class to create custom elements.

A list of builtin elements can be found in the elements.hpp file.

Summary ​

SymbolDescription
Node
operator=
~Node
ComputeRequirementCompute how much space an element needs.
requirement
SetBoxAssign a position and a dimension to an element for drawing.
SelectCompute the selection of an element.
RenderDisplay an element on a ftxui::Screen.
GetSelectedContent
Check

Public Member Functions ​

Node ​

cpp
Node();

Node ​

cpp
Node(Elements children);

Node ​

cpp
Node(const Node &);

Node ​

cpp
Node(const Node &&);

operator= ​

cpp
Node & operator=(const Node &);

operator= ​

cpp
Node & operator=(const Node &&);

~Node ​

cpp
virtual ~Node();

ComputeRequirement ​

cpp
virtual void ComputeRequirement();

Compute how much space an element needs.

requirement ​

cpp
Requirement requirement();

SetBox ​

cpp
virtual void SetBox(Box box);

Assign a position and a dimension to an element for drawing.

Select ​

cpp
virtual void Select(Selection & selection);

Compute the selection of an element.

Render ​

cpp
virtual void Render(Screen & screen);

Display an element on a ftxui::Screen.

Examples: component/button, component/button_animated, component/button_in_frame, component/canvas_animated, component/checkbox_in_frame, component/collapsible, component/composition, component/flexbox_gallery, component/focus, component/gallery, component/homescreen, component/input (+61 more)

GetSelectedContent ​

cpp
virtual std::string GetSelectedContent(Selection & selection);

Check ​

cpp
virtual void Check(Status * status);