FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
Classes | Functions
ftxui/component

## Detailed Description

Please check the tutorial of the `ftxui/component` module.

## Classes
class | ComponentBase
| It implement rendering itself as ftxui::Element. It implement keyboard navigation by responding to ftxui::Event. More...
struct | UnderlineOption
| Option for the underline effect. More...
struct | AnimatedColorOption
| Option about a potentially animated color. More...
struct | MenuEntryOption
| Option for the MenuEntry component. More...
struct | MenuOption
| Option for the Menu component. More...
struct | ButtonOption
| Option for the AnimatedButton component. More...
struct | CheckboxOption
| Option for the Checkbox component. More...
struct | InputOption
| Option for the Input component. More...
struct | RadioboxOption
| Option for the Radiobox component. More...
struct | WindowRenderState
| State passed to the `Window` component's render function. More...
struct | DropdownOption
| Option for the Dropdown component.A dropdown menu is a checkbox opening/closing a radiobox. More...
struct | Event
| Represent an event. It can be key press event, a terminal resize, or more ... More...
class | Loop
| Loop is a class that manages the event loop for a component. More...
struct | Mouse
| A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta). More...
class | ScreenInteractive
| ScreenInteractive is a `Screen` that can handle events, run a main loop, and manage components. More...

## Functions
void | RequestAnimationFrame ()
| RequestAnimationFrame is a function that requests a new frame to be drawn in the next animation cycle.
Component | Button (ButtonOption option)
| Draw a button. Execute a function when clicked.
Component | Button (ConstStringRef label, std::function< void()> on_click, ButtonOption option)
| Draw a button. Execute a function when clicked.
Component | CatchEvent (Component child, std::function< bool(Event event)> on_event)
| Return a component, using |on_event| to catch events. This function must returns true when the event has been handled, false otherwise.
ComponentDecorator | CatchEvent (std::function< bool(Event)> on_event)
| Decorate a component, using |on_event| to catch events. This function must returns true when the event has been handled, false otherwise.
Component | Checkbox (CheckboxOption option)
| Draw checkable element.
Component | Checkbox (ConstStringRef label, bool *checked, CheckboxOption option)
| Draw checkable element.
Component | Vertical (Components children)
| A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or 'j'/'k' keys.
Component | Vertical (Components children, int *selector)
| A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or 'j'/'k' keys. This is useful for implementing a Menu for instance.
Component | Horizontal (Components children)
| A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow key or 'h'/'l' keys.
Component | Horizontal (Components children, int *selector)
| A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow key or 'h'/'l' keys.
Component | Tab (Components children, int *selector)
| A list of components, where only one is drawn and interacted with at a time. The |selector| gives the index of the selected component. This is useful to implement tabs.
Component | Stacked (Components children)
| A list of components to be stacked on top of each other. Events are propagated to the first component, then the second if not handled, etc. The components are drawn in the reverse order they are given. When a component take focus, it is put at the front, without changing the relative order of the other elements.
Component | Dropdown (ConstStringListRef entries, int *selected)
| A dropdown menu.
Component | Dropdown (DropdownOption option)
| A dropdown menu.
Component | Hoverable (Component component, bool *hover)
| Wrap a component. Gives the ability to know if it is hovered by the mouse.
Component | Hoverable (Component component, std::function< void()> on_enter, std::function< void()> on_leave)
| Wrap a component. Uses callbacks.
ComponentDecorator | Hoverable (bool *hover)
| Wrap a component. Gives the ability to know if it is hovered by the mouse.
ComponentDecorator | Hoverable (std::function< void()> on_enter, std::function< void()> on_leave)
| Wrap a component. Gives the ability to know if it is hovered by the mouse.
Component | Hoverable (Component component, std::function< void(bool)> on_change)
| Wrap a component. Gives the ability to know if it is hovered by the mouse.
ComponentDecorator | Hoverable (std::function< void(bool)> on_change)
| Wrap a component. Gives the ability to know if it is hovered by the mouse.
Component | Input (InputOption option)
| An input box for editing text.
Component | Input (StringRef content, InputOption option)
| An input box for editing text.
Component | Input (StringRef content, StringRef placeholder, InputOption option)
| An input box for editing text.
Component | Maybe (Component child, std::function< bool()> show)
| Decorate a component |child|. It is shown only when |show| returns true.
ComponentDecorator | Maybe (std::function< bool()> show)
| Decorate a component. It is shown only when the |show| function returns true.
Component | Maybe (Component child, const bool *show)
| Decorate a component |child|. It is shown only when |show| is true.
ComponentDecorator | Maybe (const bool *show)
| Decorate a component. It is shown only when |show| is true.
Component | Menu (MenuOption option)
| A list of text. The focused element is selected.
Component | Menu (ConstStringListRef entries, int *selected, MenuOption option)
| A list of text. The focused element is selected.
Component | Toggle (ConstStringListRef entries, int *selected)
| An horizontal list of elements. The user can navigate through them.
Component | MenuEntry (ConstStringRef label, MenuEntryOption option)
| A specific menu entry. They can be put into a Container::Vertical to form a menu.
Component | MenuEntry (MenuEntryOption option)
| A specific menu entry. They can be put into a Container::Vertical to form a menu.
Component | Modal (Component main, Component modal, const bool *show_modal)
ComponentDecorator | Modal (Component modal, const bool *show_modal)
Component | Radiobox (RadioboxOption option)
| A list of element, where only one can be selected.
Component | Radiobox (ConstStringListRef entries, int *selected, RadioboxOption option)
| A list of element, where only one can be selected.
Component | Renderer (std::function< Element()> render)
| Return a component, using |render| to render its interface.
Component | Renderer (Component child, std::function< Element()> render)
| Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Component | Renderer (std::function< Element(bool)> render)
| Return a focusable component, using |render| to render its interface.
ComponentDecorator | Renderer (ElementDecorator decorator)
| Decorate a component, by decorating what it renders.
Component | ResizableSplitLeft (Component main, Component back, int *main_size)
| An horizontal split in between two components, configurable using the mouse.
Component | ResizableSplitRight (Component main, Component back, int *main_size)
| An horizontal split in between two components, configurable using the mouse.
Component | ResizableSplitTop (Component main, Component back, int *main_size)
| An vertical split in between two components, configurable using the mouse.
Component | ResizableSplitBottom (Component main, Component back, int *main_size)
| An vertical split in between two components, configurable using the mouse.
Component | Slider (ConstStringRef label, Ref< int > value, ConstRef< int > min, ConstRef< int > max, ConstRef< int > increment)
| An horizontal slider.
Component | Window (WindowOptions option)
| A draggeable / resizeable window. To use multiple of them, they must be stacked using `Container::Stacked({...})` component;.

## Class Documentation

## ◆ ftxui::ComponentBase

class ftxui::ComponentBase

It implement rendering itself as ftxui::Element. It implement keyboard navigation by responding to ftxui::Event.

Definition at line 30 of file component_base.hpp.

### Public Member Functions
| ComponentBase (Components children)
virtual | ~ComponentBase ()
| ComponentBase ()=default
| ComponentBase (const ComponentBase &)=delete
| ComponentBase (ComponentBase &&)=delete
ComponentBase & | operator= (const ComponentBase &)=delete
ComponentBase & | operator= (ComponentBase &&)=delete
ComponentBase * | Parent () const
| Return the parent ComponentBase, or nul if any.
Component & | ChildAt (size_t i)
| Access the child at index `i`.
size_t | ChildCount () const
| Returns the number of children.
int | Index () const
| Return index of the component in its parent. -1 if no parent.
void | Add (Component children)
| Add a child. @param child The child to be attached.
void | Detach ()
| Detach this child from its parent.
void | DetachAllChildren ()
| Remove all children.
Element | Render ()
| Draw the component. Build a ftxui::Element to be drawn on the ftxui::Screen representing this ftxui::ComponentBase. Please override OnRender() to modify the rendering.
virtual Element | OnRender ()
| Draw the component. Build a ftxui::Element to be drawn on the ftxi::Screen representing this ftxui::ComponentBase. This function is means to be overridden.
virtual bool | OnEvent (Event)
| Called in response to an event.
virtual void | OnAnimation (animation::Params &params)
| Called in response to an animation event.
virtual Component | ActiveChild ()
| Return the currently Active child.
virtual bool | Focusable () const
| Return true when the component contains focusable elements. The non focusable Components will be skipped when navigating using the keyboard.
bool | Active () const
| Returns if the element if the currently active child of its parent.
bool | Focused () const
| Returns if the elements if focused by the user. True when the ComponentBase is focused by the user. An element is Focused when it is with all its ancestors the ActiveChild() of their parents, and it Focusable().
virtual void | SetActiveChild (ComponentBase *child)
| Make the |child| to be the "active" one.
void | SetActiveChild (Component child)
| Make the |child| to be the "active" one.
void | TakeFocus ()
| Configure all the ancestors to give focus to this component.
### Protected Member Functions
CapturedMouse | CaptureMouse (const Event &event)
| Take the CapturedMouse if available. There is only one component of them. It represents a component taking priority over others.
### Protected Attributes
Components | children_

#### Constructor & Destructor Documentation

## ◆ ComponentBase() [1/4]

ComponentBase | ( | Components | children | ) |
| inline explicit

Definition at line 32 of file component_base.hpp.

## ◆ ~ComponentBase()

~ComponentBase | ( |  | ) |
| virtual

Definition at line 31 of file component.cpp.

## ◆ ComponentBase() [2/4]

ComponentBase | ( |  | ) |
| default

## ◆ ComponentBase() [3/4]

ComponentBase | ( | const ComponentBase & |  | ) |
| delete

## ◆ ComponentBase() [4/4]

ComponentBase | ( | ComponentBase && |  | ) |
| delete

#### Member Function Documentation

## ◆ operator=() [1/2]

ComponentBase & operator= | ( | const ComponentBase & |  | ) |
| delete

## ◆ operator=() [2/2]

ComponentBase & operator= | ( | ComponentBase && |  | ) |
| delete

## ◆ Parent()

ComponentBase * Parent | ( |  | ) | const

Return the parent ComponentBase, or nul if any.

See also
  Detach
  Parent

Definition at line 38 of file component.cpp.

## ◆ ChildAt()

Component & ChildAt | ( | size_t | i | ) |

Access the child at index `i`.

Definition at line 43 of file component.cpp.

## ◆ ChildCount()

size_t ChildCount | ( |  | ) | const

Returns the number of children.

Definition at line 49 of file component.cpp.

## ◆ Index()

int Index | ( |  | ) | const

Return index of the component in its parent. -1 if no parent.

Definition at line 54 of file component.cpp.

## ◆ Add()

void Add | ( | Component | children | ) |

Add a child. @param child The child to be attached.

Definition at line 70 of file component.cpp.

## ◆ Detach()

void Detach | ( |  | ) |

Detach this child from its parent.

See also
  Detach
  Parent

Definition at line 79 of file component.cpp.

## ◆ DetachAllChildren()

void DetachAllChildren | ( |  | ) |

Remove all children.

Definition at line 94 of file component.cpp.

## ◆ Render()

Element Render | ( |  | ) |

Draw the component. Build a ftxui::Element to be drawn on the ftxui::Screen representing this ftxui::ComponentBase. Please override OnRender() to modify the rendering.

Definition at line 103 of file component.cpp.

## ◆ OnRender()

Element OnRender | ( |  | ) |
| virtual

Draw the component. Build a ftxui::Element to be drawn on the ftxi::Screen representing this ftxui::ComponentBase. This function is means to be overridden.

Definition at line 138 of file component.cpp.

## ◆ OnEvent()

bool OnEvent | ( | Event | event | ) |
| virtual

Called in response to an event.

Parameters

  event | The event.

Returns
  True when the event has been handled. The default implementation called OnEvent on every child until one return true. If none returns true, return false.

Definition at line 151 of file component.cpp.

## ◆ OnAnimation()

void OnAnimation | ( | animation::Params & | params | ) |
| virtual

Called in response to an animation event.

Parameters

  params | the parameters of the animation The default implementation dispatch the event to every child.

Definition at line 163 of file component.cpp.

## ◆ ActiveChild()

Component ActiveChild | ( |  | ) |
| virtual

Return the currently Active child.

Returns
  the currently Active child.

Definition at line 171 of file component.cpp.

## ◆ Focusable()

bool Focusable | ( |  | ) | const
| virtual

Return true when the component contains focusable elements. The non focusable Components will be skipped when navigating using the keyboard.

Definition at line 183 of file component.cpp.

## ◆ Active()

bool Active | ( |  | ) | const

Returns if the element if the currently active child of its parent.

Definition at line 193 of file component.cpp.

## ◆ Focused()

bool Focused | ( |  | ) | const

Returns if the elements if focused by the user. True when the ComponentBase is focused by the user. An element is Focused when it is with all its ancestors the ActiveChild() of their parents, and it Focusable().

Definition at line 201 of file component.cpp.

## ◆ SetActiveChild() [1/2]

void SetActiveChild | ( | ComponentBase * | child | ) |
| virtual

Make the |child| to be the "active" one.

Parameters

  child | the child to become active.

Definition at line 211 of file component.cpp.

## ◆ SetActiveChild() [2/2]

void SetActiveChild | ( | Component | child | ) |

Make the |child| to be the "active" one.

Parameters

  child | the child to become active.

Definition at line 215 of file component.cpp.

## ◆ TakeFocus()

void TakeFocus | ( |  | ) |

Configure all the ancestors to give focus to this component.

Definition at line 220 of file component.cpp.

## ◆ CaptureMouse()

CapturedMouse CaptureMouse | ( | const Event & | event | ) |
| protected

Take the CapturedMouse if available. There is only one component of them. It represents a component taking priority over others.

Parameters

  event | The event

Definition at line 231 of file component.cpp.

#### Member Data Documentation

## ◆ children_

Components children_
| protected

Definition at line 96 of file component_base.hpp.

## ◆ ftxui::UnderlineOption

struct ftxui::UnderlineOption

Option for the underline effect.

Definition at line 32 of file component_options.hpp.

### Public Member Functions
void | SetAnimation (animation::Duration d, animation::easing::Function f)
| Set how the underline should animate.
void | SetAnimationDuration (animation::Duration d)
| Set how the underline should animate.
void | SetAnimationFunction (animation::easing::Function f)
| Set how the underline should animate.
void | SetAnimationFunction (animation::easing::Function f_leader, animation::easing::Function f_follower)
| Set how the underline should animate. This is useful to desynchronize the animation of the leader and the follower.
### Public Attributes
bool | enabled = false
Color | color_active = Color::White
Color | color_inactive = Color::GrayDark
animation::easing::Function | leader_function
animation::easing::Function | follower_function
animation::Duration | leader_duration = std::chrono::milliseconds(250)
animation::Duration | leader_delay = std::chrono::milliseconds(0)
animation::Duration | follower_duration = std::chrono::milliseconds(250)
animation::Duration | follower_delay = std::chrono::milliseconds(0)

#### Member Function Documentation

## ◆ SetAnimation()

void SetAnimation | ( | animation::Duration | d,
|  | animation::easing::Function | f )

Set how the underline should animate.

Parameters

  d | The duration of the animation.
  f | The easing function of the animation.

Definition at line 34 of file component_options.cpp.

## ◆ SetAnimationDuration()

void SetAnimationDuration | ( | animation::Duration | d | ) |

Set how the underline should animate.

Parameters

  d | The duration of the animation.

Definition at line 42 of file component_options.cpp.

## ◆ SetAnimationFunction() [1/2]

void SetAnimationFunction | ( | animation::easing::Function | f | ) |

Set how the underline should animate.

Parameters

  f | The easing function of the animation.

Definition at line 49 of file component_options.cpp.

## ◆ SetAnimationFunction() [2/2]

void SetAnimationFunction | ( | animation::easing::Function | f_leader,
|  | animation::easing::Function | f_follower )

Set how the underline should animate. This is useful to desynchronize the animation of the leader and the follower.

Parameters

  f_leader | The duration of the animation for the leader.
  f_follower | The duration of the animation for the follower.

Definition at line 59 of file component_options.cpp.

#### Member Data Documentation

## ◆ enabled

bool enabled = false

Definition at line 33 of file component_options.hpp.

## ◆ color_active

Color color_active = Color::White

Definition at line 35 of file component_options.hpp.

## ◆ color_inactive

Color color_inactive = Color::GrayDark

Definition at line 36 of file component_options.hpp.

## ◆ leader_function

animation::easing::Function leader_function

Initial value:
=
animation::easing::QuadraticInOut
ftxui::animation::easing::QuadraticInOut
float QuadraticInOut(float p)
Definition animation.cpp:46

Definition at line 38 of file component_options.hpp.

## ◆ follower_function

animation::easing::Function follower_function

Initial value:
=
animation::easing::QuadraticInOut

Definition at line 40 of file component_options.hpp.

## ◆ leader_duration

animation::Duration leader_duration = std::chrono::milliseconds(250)

Definition at line 43 of file component_options.hpp.

## ◆ leader_delay

animation::Duration leader_delay = std::chrono::milliseconds(0)

Definition at line 44 of file component_options.hpp.

## ◆ follower_duration

animation::Duration follower_duration = std::chrono::milliseconds(250)

Definition at line 45 of file component_options.hpp.

## ◆ follower_delay

animation::Duration follower_delay = std::chrono::milliseconds(0)

Definition at line 46 of file component_options.hpp.

## ◆ ftxui::AnimatedColorOption

struct ftxui::AnimatedColorOption

Option about a potentially animated color.

Definition at line 57 of file component_options.hpp.

### Public Member Functions
void | Set (Color inactive, Color active, animation::Duration duration=std::chrono::milliseconds(250), animation::easing::Function function=animation::easing::QuadraticInOut)
| A color option that can be animated. @params _inactive The color when the component is inactive. @params _active The color when the component is active. @params _duration The duration of the animation. @params _function The easing function of the animation.
### Public Attributes
bool | enabled = false
Color | inactive
Color | active
animation::Duration | duration = std::chrono::milliseconds(250)
animation::easing::Function | function = animation::easing::QuadraticInOut

#### Member Function Documentation

## ◆ Set()

void Set | ( | Color | inactive,
|  | Color | active,
|  | animation::Duration | duration = std::chrono::milliseconds(250),
|  | animation::easing::Function | function = animation::easing::QuadraticInOut )

A color option that can be animated. @params _inactive The color when the component is inactive. @params _active The color when the component is active. @params _duration The duration of the animation. @params _function The easing function of the animation.

Definition at line 20 of file component_options.cpp.

#### Member Data Documentation

## ◆ enabled

bool enabled = false

Definition at line 64 of file component_options.hpp.

## ◆ inactive

Color inactive

Definition at line 65 of file component_options.hpp.

## ◆ active

Color active

Definition at line 66 of file component_options.hpp.

## ◆ duration

animation::Duration duration = std::chrono::milliseconds(250)

Definition at line 67 of file component_options.hpp.

## ◆ function

animation::easing::Function function = animation::easing::QuadraticInOut

Definition at line 68 of file component_options.hpp.

## ◆ ftxui::MenuEntryOption

struct ftxui::MenuEntryOption

Option for the MenuEntry component.

Definition at line 78 of file component_options.hpp.

### Public Attributes
ConstStringRef | label = "MenuEntry"
std::function< Element(const EntryState &state)> | transform
AnimatedColorsOption | animated_colors

#### Member Data Documentation

## ◆ label

ConstStringRef label = "MenuEntry"

Definition at line 79 of file component_options.hpp.

## ◆ transform

std::function<Element(const EntryState& state)> transform

Definition at line 80 of file component_options.hpp.

## ◆ animated_colors

AnimatedColorsOption animated_colors

Definition at line 81 of file component_options.hpp.

## ◆ ftxui::MenuOption

struct ftxui::MenuOption

Option for the Menu component.

Definition at line 86 of file component_options.hpp.

### Static Public Member Functions
static MenuOption | Horizontal ()
| Standard options for a horizontal menu. This can be useful to implement a tab bar.
static MenuOption | HorizontalAnimated ()
| Standard options for an animated horizontal menu. This can be useful to implement a tab bar.
static MenuOption | Vertical ()
| Standard options for a vertical menu. This can be useful to implement a list of selectable items.
static MenuOption | VerticalAnimated ()
| Standard options for an animated vertical menu. This can be useful to implement a list of selectable items.
static MenuOption | Toggle ()
| Standard options for a horizontal menu with some separator. This can be useful to implement a tab bar.
### Public Attributes
ConstStringListRef | entries
Ref< int > | selected = 0
UnderlineOption | underline
MenuEntryOption | entries_option
Direction | direction = Direction::Down
std::function< Element()> | elements_prefix
std::function< Element()> | elements_infix
std::function< Element()> | elements_postfix
std::function< void()> | on_change
std::function< void()> | on_enter
Ref< int > | focused_entry = 0

#### Member Function Documentation

## ◆ Horizontal()

MenuOption Horizontal | ( |  | ) |
| static

Standard options for a horizontal menu. This can be useful to implement a tab bar.

Definition at line 69 of file component_options.cpp.

## ◆ HorizontalAnimated()

MenuOption HorizontalAnimated | ( |  | ) |
| static

Standard options for an animated horizontal menu. This can be useful to implement a tab bar.

Definition at line 93 of file component_options.cpp.

## ◆ Vertical()

MenuOption Vertical | ( |  | ) |
| static

Standard options for a vertical menu. This can be useful to implement a list of selectable items.

Definition at line 102 of file component_options.cpp.

## ◆ VerticalAnimated()

MenuOption VerticalAnimated | ( |  | ) |
| static

Standard options for an animated vertical menu. This can be useful to implement a list of selectable items.

Definition at line 123 of file component_options.cpp.

## ◆ Toggle()

MenuOption Toggle | ( |  | ) |
| static

Standard options for a horizontal menu with some separator. This can be useful to implement a tab bar.

Definition at line 145 of file component_options.cpp.

#### Member Data Documentation

## ◆ entries

ConstStringListRef entries

Definition at line 94 of file component_options.hpp.

## ◆ selected

Ref<int> selected = 0

> ‍The list of entries.

Definition at line 95 of file component_options.hpp.

## ◆ underline

UnderlineOption underline

> ‍The index of the selected entry.

Definition at line 98 of file component_options.hpp.

## ◆ entries_option

MenuEntryOption entries_option

Definition at line 99 of file component_options.hpp.

## ◆ direction

Direction direction = Direction::Down

Definition at line 100 of file component_options.hpp.

## ◆ elements_prefix

std::function<Element()> elements_prefix

Definition at line 101 of file component_options.hpp.

## ◆ elements_infix

std::function<Element()> elements_infix

Definition at line 102 of file component_options.hpp.

## ◆ elements_postfix

std::function<Element()> elements_postfix

Definition at line 103 of file component_options.hpp.

## ◆ on_change

std::function<void()> on_change

Definition at line 106 of file component_options.hpp.

## ◆ on_enter

std::function<void()> on_enter

> ‍Called when the selected entry changes.

Definition at line 107 of file component_options.hpp.

## ◆ focused_entry

Ref<int> focused_entry = 0

> ‍Called when the user presses enter.

Definition at line 108 of file component_options.hpp.

## ◆ ftxui::ButtonOption

struct ftxui::ButtonOption

Option for the AnimatedButton component.

Definition at line 113 of file component_options.hpp.

### Static Public Member Functions
static ButtonOption | Ascii ()
| Create a ButtonOption, highlighted using [] characters.
static ButtonOption | Simple ()
| Create a ButtonOption, inverted when focused.
static ButtonOption | Border ()
| Create a ButtonOption. The button is shown using a border, inverted when focused. This is the current default.
static ButtonOption | Animated ()
| Create a ButtonOption, using animated colors.
static ButtonOption | Animated (Color color)
| Create a ButtonOption, using animated colors.
static ButtonOption | Animated (Color background, Color foreground)
| Create a ButtonOption, using animated colors.
static ButtonOption | Animated (Color background, Color foreground, Color background_active, Color foreground_active)
| Create a ButtonOption, using animated colors.
### Public Attributes
ConstStringRef | label = "Button"
std::function< void()> | on_click = [] {}
std::function< Element(const EntryState &)> | transform
AnimatedColorsOption | animated_colors

#### Member Function Documentation

## ◆ Ascii()

ButtonOption Ascii | ( |  | ) |
| static

Create a ButtonOption, highlighted using [] characters.

Definition at line 153 of file component_options.cpp.

## ◆ Simple()

ButtonOption Simple | ( |  | ) |
| static

Create a ButtonOption, inverted when focused.

Definition at line 165 of file component_options.cpp.

## ◆ Border()

ButtonOption Border | ( |  | ) |
| static

Create a ButtonOption. The button is shown using a border, inverted when focused. This is the current default.

Definition at line 179 of file component_options.cpp.

## ◆ Animated() [1/4]

ButtonOption Animated | ( |  | ) |
| static

Create a ButtonOption, using animated colors.

Definition at line 196 of file component_options.cpp.

## ◆ Animated() [2/4]

ButtonOption Animated | ( | Color | color | ) |
| static

Create a ButtonOption, using animated colors.

Definition at line 203 of file component_options.cpp.

## ◆ Animated() [3/4]

ButtonOption Animated | ( | Color | background,
|  | Color | foreground )
| static

Create a ButtonOption, using animated colors.

Definition at line 213 of file component_options.cpp.

## ◆ Animated() [4/4]

ButtonOption Animated | ( | Color | background,
|  | Color | foreground,
|  | Color | background_active,
|  | Color | foreground_active )
| static

Create a ButtonOption, using animated colors.

Definition at line 225 of file component_options.cpp.

#### Member Data Documentation

## ◆ label

ConstStringRef label = "Button"

Definition at line 126 of file component_options.hpp.

## ◆ on_click

std::function<void()> on_click = [] {}

Definition at line 127 of file component_options.hpp.

## ◆ transform

std::function<Element(const EntryState&)> transform

Definition at line 130 of file component_options.hpp.

## ◆ animated_colors

AnimatedColorsOption animated_colors

Definition at line 131 of file component_options.hpp.

## ◆ ftxui::CheckboxOption

struct ftxui::CheckboxOption

Option for the Checkbox component.

Definition at line 136 of file component_options.hpp.

### Static Public Member Functions
static CheckboxOption | Simple ()
| Option for standard Checkbox.
### Public Attributes
ConstStringRef | label = "Checkbox"
Ref< bool > | checked = false
std::function< Element(const EntryState &)> | transform
std::function< void()> | on_change = [] {}
| Called when the user change the state.

#### Member Function Documentation

## ◆ Simple()

CheckboxOption Simple | ( |  | ) |
| static

Option for standard Checkbox.

Definition at line 244 of file component_options.cpp.

#### Member Data Documentation

## ◆ label

ConstStringRef label = "Checkbox"

Definition at line 140 of file component_options.hpp.

## ◆ checked

Ref<bool> checked = false

Definition at line 142 of file component_options.hpp.

## ◆ transform

std::function<Element(const EntryState&)> transform

Definition at line 145 of file component_options.hpp.

## ◆ on_change

std::function<void()> on_change = [] {}

Called when the user change the state.

Definition at line 149 of file component_options.hpp.

## ◆ ftxui::InputOption

struct ftxui::InputOption

Option for the Input component.

Definition at line 163 of file component_options.hpp.

### Static Public Member Functions
static InputOption | Default ()
| Create the default input style:
static InputOption | Spacious ()
| A white on black style with high margins:
### Public Attributes
StringRef | content = ""
| The content of the input.
StringRef | placeholder = ""
| The content of the input when it's empty.
std::function< Element(InputState)> | transform
Ref< bool > | password = false
| Obscure the input content using '*'.
Ref< bool > | multiline = true
| Whether the input can be multiline.
Ref< bool > | insert = true
| Insert or overtype character mode.
std::function< void()> | on_change = [] {}
| Called when the content changes.
std::function< void()> | on_enter = [] {}
| Called when the user presses enter.
Ref< int > | cursor_position = 0

#### Member Function Documentation

## ◆ Default()

InputOption Default | ( |  | ) |
| static

Create the default input style:

Standard options for the input component.

Definition at line 292 of file component_options.cpp.

## ◆ Spacious()

InputOption Spacious | ( |  | ) |
| static

A white on black style with high margins:

Standard options for a more beautiful input component.

Definition at line 314 of file component_options.cpp.

#### Member Data Documentation

## ◆ content

StringRef content = ""

The content of the input.

Definition at line 172 of file component_options.hpp.

## ◆ placeholder

StringRef placeholder = ""

The content of the input when it's empty.

Definition at line 175 of file component_options.hpp.

## ◆ transform

std::function<Element(InputState)> transform

Definition at line 178 of file component_options.hpp.

## ◆ password

Ref<bool> password = false

Obscure the input content using '*'.

Definition at line 179 of file component_options.hpp.

## ◆ multiline

Ref<bool> multiline = true

Whether the input can be multiline.

Definition at line 180 of file component_options.hpp.

## ◆ insert

Ref<bool> insert = true

Insert or overtype character mode.

Definition at line 181 of file component_options.hpp.

## ◆ on_change

std::function<void()> on_change = [] {}

Called when the content changes.

Definition at line 184 of file component_options.hpp.

## ◆ on_enter

std::function<void()> on_enter = [] {}

Called when the user presses enter.

Definition at line 186 of file component_options.hpp.

## ◆ cursor_position

Ref<int> cursor_position = 0

Definition at line 189 of file component_options.hpp.

## ◆ ftxui::RadioboxOption

struct ftxui::RadioboxOption

Option for the Radiobox component.

Definition at line 194 of file component_options.hpp.

### Static Public Member Functions
static RadioboxOption | Simple ()
| Option for standard Radiobox.
### Public Attributes
ConstStringListRef | entries
Ref< int > | selected = 0
std::function< Element(const EntryState &)> | transform
std::function< void()> | on_change = [] {}
| Called when the selected entry changes.
Ref< int > | focused_entry = 0

#### Member Function Documentation

## ◆ Simple()

RadioboxOption Simple | ( |  | ) |
| static

Option for standard Radiobox.

Definition at line 268 of file component_options.cpp.

#### Member Data Documentation

## ◆ entries

ConstStringListRef entries

Definition at line 199 of file component_options.hpp.

## ◆ selected

Ref<int> selected = 0

Definition at line 200 of file component_options.hpp.

## ◆ transform

std::function<Element(const EntryState&)> transform

Definition at line 203 of file component_options.hpp.

## ◆ on_change

std::function<void()> on_change = [] {}

Called when the selected entry changes.

Definition at line 207 of file component_options.hpp.

## ◆ focused_entry

Ref<int> focused_entry = 0

Definition at line 208 of file component_options.hpp.

## ◆ ftxui::WindowRenderState

struct ftxui::WindowRenderState

State passed to the `Window` component's render function.

Definition at line 237 of file component_options.hpp.

### Public Attributes
Element | inner
| The element wrapped inside this window.
const std::string & | title
| The title of the window.
bool | active = false
| Whether the window is the active one.
bool | drag = false
| Whether the window is being dragged.
bool | resize = false
| Whether the window is being resized.
bool | hover_left = false
| Whether the resizeable left side is hovered.
bool | hover_right = false
| Whether the resizeable right side is hovered.
bool | hover_top = false
| Whether the resizeable top side is hovered.
bool | hover_down = false
| Whether the resizeable down side is hovered.

#### Member Data Documentation

## ◆ inner

Element inner

The element wrapped inside this window.

Definition at line 238 of file component_options.hpp.

## ◆ title

const std::string& title

The title of the window.

Definition at line 239 of file component_options.hpp.

## ◆ active

bool active = false

Whether the window is the active one.

Definition at line 240 of file component_options.hpp.

## ◆ drag

bool drag = false

Whether the window is being dragged.

Definition at line 241 of file component_options.hpp.

## ◆ resize

bool resize = false

Whether the window is being resized.

Definition at line 242 of file component_options.hpp.

## ◆ hover_left

bool hover_left = false

Whether the resizeable left side is hovered.

Definition at line 243 of file component_options.hpp.

## ◆ hover_right

bool hover_right = false

Whether the resizeable right side is hovered.

Definition at line 244 of file component_options.hpp.

## ◆ hover_top

bool hover_top = false

Whether the resizeable top side is hovered.

Definition at line 245 of file component_options.hpp.

## ◆ hover_down

bool hover_down = false

Whether the resizeable down side is hovered.

Definition at line 246 of file component_options.hpp.

## ◆ ftxui::DropdownOption

struct ftxui::DropdownOption

Option for the Dropdown component.

A dropdown menu is a checkbox opening/closing a radiobox.

Definition at line 272 of file component_options.hpp.

### Public Attributes
Ref< bool > | open = false
| Whether the dropdown is open or closed:
CheckboxOption | checkbox
RadioboxOption | radiobox
std::function< Element(bool open, Element checkbox, Element radiobox)> | transform

#### Member Data Documentation

## ◆ open

Ref<bool> open = false

Whether the dropdown is open or closed:

Definition at line 274 of file component_options.hpp.

## ◆ checkbox

CheckboxOption checkbox

Definition at line 276 of file component_options.hpp.

## ◆ radiobox

RadioboxOption radiobox

Definition at line 278 of file component_options.hpp.

## ◆ transform

std::function<Element(bool open, Element checkbox, Element radiobox)> transform

Definition at line 281 of file component_options.hpp.

## ◆ ftxui::Event

struct ftxui::Event

Represent an event. It can be key press event, a terminal resize, or more ...

For example:

- Printable character can be created using Event::Character('a').
- Some special are predefined, like Event::ArrowLeft.
- One can find arbitrary code for special Events using: ./example/util/print_key_press For instance, CTLR+A maps to Event::Special({1});

Useful documentation about xterm specification: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

Definition at line 29 of file event.hpp.

### Public Member Functions
bool | operator== (const Event &other) const
bool | operator!= (const Event &other) const
bool | operator< (const Event &other) const
const std::string & | input () const
bool | is_character () const
std::string | character () const
bool | is_mouse () const
struct Mouse & | mouse ()
bool | is_cursor_position () const
int | cursor_x () const
int | cursor_y () const
bool | is_cursor_shape () const
int | cursor_shape () const
std::string | DebugString () const
| Return a string representation of the event.
### Static Public Member Functions
static Event | Character (std::string)
| An event corresponding to a given typed character.
static Event | Character (char)
| An event corresponding to a given typed character.
static Event | Character (wchar_t)
| An event corresponding to a given typed character.
static Event | Special (std::string)
| An custom event whose meaning is defined by the user of the library.
static Event | Mouse (std::string, Mouse mouse)
| An event corresponding to a given typed character.
static Event | CursorPosition (std::string, int x, int y)
static Event | CursorShape (std::string, int shape)
| An event corresponding to a terminal DCS (Device Control String).
### Public Attributes
ScreenInteractive * | screen_ = nullptr
### Static Public Attributes
static const Event | ArrowLeft = Event::Special("\x1B[D")
static const Event | ArrowRight = Event::Special("\x1B[C")
static const Event | ArrowUp = Event::Special("\x1B[A")
static const Event | ArrowDown = Event::Special("\x1B[B")
static const Event | ArrowLeftCtrl = Event::Special("\x1B[1;5D")
static const Event | ArrowRightCtrl = Event::Special("\x1B[1;5C")
static const Event | ArrowUpCtrl = Event::Special("\x1B[1;5A")
static const Event | ArrowDownCtrl = Event::Special("\x1B[1;5B")
static const Event | Backspace = Event::Special({127})
static const Event | Delete = Event::Special("\x1B[3~")
static const Event | Return = Event::Special({10})
static const Event | Escape = Event::Special("\x1B")
static const Event | Tab = Event::Special({9})
static const Event | TabReverse = Event::Special({27, 91, 90})
static const Event | Insert = Event::Special("\x1B[2~")
static const Event | Home = Event::Special({27, 91, 72})
static const Event | End = Event::Special({27, 91, 70})
static const Event | PageUp = Event::Special({27, 91, 53, 126})
static const Event | PageDown = Event::Special({27, 91, 54, 126})
static const Event | F1 = Event::Special("\x1BOP")
static const Event | F2 = Event::Special("\x1BOQ")
static const Event | F3 = Event::Special("\x1BOR")
static const Event | F4 = Event::Special("\x1BOS")
static const Event | F5 = Event::Special("\x1B[15~")
static const Event | F6 = Event::Special("\x1B[17~")
static const Event | F7 = Event::Special("\x1B[18~")
static const Event | F8 = Event::Special("\x1B[19~")
static const Event | F9 = Event::Special("\x1B[20~")
static const Event | F10 = Event::Special("\x1B[21~")
static const Event | F11 = Event::Special("\x1B[23~")
static const Event | F12 = Event::Special("\x1B[24~")
static const Event | a = Event::Character("a")
static const Event | A = Event::Character("A")
static const Event | CtrlA = Event::Special("\x01")
static const Event | AltA = Event::Special("\x1b""a")
static const Event | CtrlAltA = Event::Special("\x1b\x01")
static const Event | b = Event::Character("b")
static const Event | B = Event::Character("B")
static const Event | CtrlB = Event::Special("\x02")
static const Event | AltB = Event::Special("\x1b""b")
static const Event | CtrlAltB = Event::Special("\x1b\x02")
static const Event | c = Event::Character("c")
static const Event | C = Event::Character("C")
static const Event | CtrlC = Event::Special("\x03")
static const Event | AltC = Event::Special("\x1b""c")
static const Event | CtrlAltC = Event::Special("\x1b\x03")
static const Event | d = Event::Character("d")
static const Event | D = Event::Character("D")
static const Event | CtrlD = Event::Special("\x04")
static const Event | AltD = Event::Special("\x1b""d")
static const Event | CtrlAltD = Event::Special("\x1b\x04")
static const Event | e = Event::Character("e")
static const Event | E = Event::Character("E")
static const Event | CtrlE = Event::Special("\x05")
static const Event | AltE = Event::Special("\x1b""e")
static const Event | CtrlAltE = Event::Special("\x1b\x05")
static const Event | f = Event::Character("f")
static const Event | F = Event::Character("F")
static const Event | CtrlF = Event::Special("\x06")
static const Event | AltF = Event::Special("\x1b""f")
static const Event | CtrlAltF = Event::Special("\x1b\x06")
static const Event | g = Event::Character("g")
static const Event | G = Event::Character("G")
static const Event | CtrlG = Event::Special("\x07")
static const Event | AltG = Event::Special("\x1b""g")
static const Event | CtrlAltG = Event::Special("\x1b\x07")
static const Event | h = Event::Character("h")
static const Event | H = Event::Character("H")
static const Event | CtrlH = Event::Special("\x08")
static const Event | AltH = Event::Special("\x1b""h")
static const Event | CtrlAltH = Event::Special("\x1b\x08")
static const Event | i = Event::Character("i")
static const Event | I = Event::Character("I")
static const Event | CtrlI = Event::Special("\x09")
static const Event | AltI = Event::Special("\x1b""i")
static const Event | CtrlAltI = Event::Special("\x1b\x09")
static const Event | j = Event::Character("j")
static const Event | J = Event::Character("J")
static const Event | CtrlJ = Event::Special("\x0a")
static const Event | AltJ = Event::Special("\x1b""j")
static const Event | CtrlAltJ = Event::Special("\x1b\x0a")
static const Event | k = Event::Character("k")
static const Event | K = Event::Character("K")
static const Event | CtrlK = Event::Special("\x0b")
static const Event | AltK = Event::Special("\x1b""k")
static const Event | CtrlAltK = Event::Special("\x1b\x0b")
static const Event | l = Event::Character("l")
static const Event | L = Event::Character("L")
static const Event | CtrlL = Event::Special("\x0c")
static const Event | AltL = Event::Special("\x1b""l")
static const Event | CtrlAltL = Event::Special("\x1b\x0c")
static const Event | m = Event::Character("m")
static const Event | M = Event::Character("M")
static const Event | CtrlM = Event::Special("\x0d")
static const Event | AltM = Event::Special("\x1b""m")
static const Event | CtrlAltM = Event::Special("\x1b\x0d")
static const Event | n = Event::Character("n")
static const Event | N = Event::Character("N")
static const Event | CtrlN = Event::Special("\x0e")
static const Event | AltN = Event::Special("\x1b""n")
static const Event | CtrlAltN = Event::Special("\x1b\x0e")
static const Event | o = Event::Character("o")
static const Event | O = Event::Character("O")
static const Event | CtrlO = Event::Special("\x0f")
static const Event | AltO = Event::Special("\x1b""o")
static const Event | CtrlAltO = Event::Special("\x1b\x0f")
static const Event | p = Event::Character("p")
static const Event | P = Event::Character("P")
static const Event | CtrlP = Event::Special("\x10")
static const Event | AltP = Event::Special("\x1b""p")
static const Event | CtrlAltP = Event::Special("\x1b\x10")
static const Event | q = Event::Character("q")
static const Event | Q = Event::Character("Q")
static const Event | CtrlQ = Event::Special("\x11")
static const Event | AltQ = Event::Special("\x1b""q")
static const Event | CtrlAltQ = Event::Special("\x1b\x11")
static const Event | r = Event::Character("r")
static const Event | R = Event::Character("R")
static const Event | CtrlR = Event::Special("\x12")
static const Event | AltR = Event::Special("\x1b""r")
static const Event | CtrlAltR = Event::Special("\x1b\x12")
static const Event | s = Event::Character("s")
static const Event | S = Event::Character("S")
static const Event | CtrlS = Event::Special("\x13")
static const Event | AltS = Event::Special("\x1b""s")
static const Event | CtrlAltS = Event::Special("\x1b\x13")
static const Event | t = Event::Character("t")
static const Event | T = Event::Character("T")
static const Event | CtrlT = Event::Special("\x14")
static const Event | AltT = Event::Special("\x1b""t")
static const Event | CtrlAltT = Event::Special("\x1b\x14")
static const Event | u = Event::Character("u")
static const Event | U = Event::Character("U")
static const Event | CtrlU = Event::Special("\x15")
static const Event | AltU = Event::Special("\x1b""u")
static const Event | CtrlAltU = Event::Special("\x1b\x15")
static const Event | v = Event::Character("v")
static const Event | V = Event::Character("V")
static const Event | CtrlV = Event::Special("\x16")
static const Event | AltV = Event::Special("\x1b""v")
static const Event | CtrlAltV = Event::Special("\x1b\x16")
static const Event | w = Event::Character("w")
static const Event | W = Event::Character("W")
static const Event | CtrlW = Event::Special("\x17")
static const Event | AltW = Event::Special("\x1b""w")
static const Event | CtrlAltW = Event::Special("\x1b\x17")
static const Event | x = Event::Character("x")
static const Event | X = Event::Character("X")
static const Event | CtrlX = Event::Special("\x18")
static const Event | AltX = Event::Special("\x1b""x")
static const Event | CtrlAltX = Event::Special("\x1b\x18")
static const Event | y = Event::Character("y")
static const Event | Y = Event::Character("Y")
static const Event | CtrlY = Event::Special("\x19")
static const Event | AltY = Event::Special("\x1b""y")
static const Event | CtrlAltY = Event::Special("\x1b\x19")
static const Event | z = Event::Character("z")
static const Event | Z = Event::Character("Z")
static const Event | CtrlZ = Event::Special("\x1a")
static const Event | AltZ = Event::Special("\x1b""z")
static const Event | CtrlAltZ = Event::Special("\x1b\x1a")
static const Event | Custom = Event::Special({0})

#### Member Function Documentation

## ◆ Character() [1/3]

Event Character | ( | std::string | input | ) |
| static

An event corresponding to a given typed character.

Parameters

  input | The character typed by the user.

Definition at line 28 of file event.cpp.

## ◆ Character() [2/3]

Event Character | ( | char | c | ) |
| static

An event corresponding to a given typed character.

Parameters

  c | The character typed by the user.

Definition at line 38 of file event.cpp.

## ◆ Character() [3/3]

Event Character | ( | wchar_t | c | ) |
| static

An event corresponding to a given typed character.

Parameters

  c | The character typed by the user.

Definition at line 45 of file event.cpp.

## ◆ Special()

Event Special | ( | std::string | input | ) |
| static

An custom event whose meaning is defined by the user of the library.

Parameters

  input | An arbitrary sequence of character defined by the developer.

Definition at line 74 of file event.cpp.

## ◆ Mouse()

Event Mouse | ( | std::string | input,
|  | Mouse | mouse )
| static

An event corresponding to a given typed character.

Parameters

  input | The sequence of character send by the terminal.
  mouse | The mouse state.

Definition at line 53 of file event.cpp.

## ◆ CursorPosition()

Event CursorPosition | ( | std::string | input,
|  | int | x,
|  | int | y )
| static

Definition at line 82 of file event.cpp.

## ◆ CursorShape()

Event CursorShape | ( | std::string | input,
|  | int | shape )
| static

An event corresponding to a terminal DCS (Device Control String).

Definition at line 63 of file event.cpp.

## ◆ operator==()

bool operator== | ( | const Event & | other | ) | const
| inline

Definition at line 100 of file event.hpp.

## ◆ operator!=()

bool operator!= | ( | const Event & | other | ) | const
| inline

Definition at line 101 of file event.hpp.

## ◆ operator<()

bool operator< | ( | const Event & | other | ) | const
| inline

Definition at line 102 of file event.hpp.

## ◆ input()

const std::string & input | ( |  | ) | const
| inline

Definition at line 104 of file event.hpp.

## ◆ is_character()

bool is_character | ( |  | ) | const
| inline

Definition at line 106 of file event.hpp.

## ◆ character()

std::string character | ( |  | ) | const
| inline

Definition at line 107 of file event.hpp.

## ◆ is_mouse()

bool is_mouse | ( |  | ) | const
| inline

Definition at line 109 of file event.hpp.

## ◆ mouse()

struct Mouse & mouse | ( |  | ) |
| inline

Definition at line 110 of file event.hpp.

## ◆ is_cursor_position()

bool is_cursor_position | ( |  | ) | const
| inline

Definition at line 113 of file event.hpp.

## ◆ cursor_x()

int cursor_x | ( |  | ) | const
| inline

Definition at line 114 of file event.hpp.

## ◆ cursor_y()

int cursor_y | ( |  | ) | const
| inline

Definition at line 115 of file event.hpp.

## ◆ is_cursor_shape()

bool is_cursor_shape | ( |  | ) | const
| inline

Definition at line 117 of file event.hpp.

## ◆ cursor_shape()

int cursor_shape | ( |  | ) | const
| inline

Definition at line 118 of file event.hpp.

## ◆ DebugString()

std::string DebugString | ( |  | ) | const

Return a string representation of the event.

Definition at line 91 of file event.cpp.

#### Member Data Documentation

## ◆ ArrowLeft

const Event ArrowLeft = Event::Special("\x1B[D")
| static

Definition at line 40 of file event.hpp.

## ◆ ArrowRight

const Event ArrowRight = Event::Special("\x1B[C")
| static

Definition at line 41 of file event.hpp.

## ◆ ArrowUp

const Event ArrowUp = Event::Special("\x1B[A")
| static

Definition at line 42 of file event.hpp.

## ◆ ArrowDown

const Event ArrowDown = Event::Special("\x1B[B")
| static

Definition at line 43 of file event.hpp.

## ◆ ArrowLeftCtrl

const Event ArrowLeftCtrl = Event::Special("\x1B[1;5D")
| static

Definition at line 45 of file event.hpp.

## ◆ ArrowRightCtrl

const Event ArrowRightCtrl = Event::Special("\x1B[1;5C")
| static

Definition at line 46 of file event.hpp.

## ◆ ArrowUpCtrl

const Event ArrowUpCtrl = Event::Special("\x1B[1;5A")
| static

Definition at line 47 of file event.hpp.

## ◆ ArrowDownCtrl

const Event ArrowDownCtrl = Event::Special("\x1B[1;5B")
| static

Definition at line 48 of file event.hpp.

## ◆ Backspace

const Event Backspace = Event::Special({127})
| static

Definition at line 51 of file event.hpp.

## ◆ Delete

const Event Delete = Event::Special("\x1B[3~")
| static

Definition at line 52 of file event.hpp.

## ◆ Return

const Event Return = Event::Special({10})
| static

Definition at line 53 of file event.hpp.

## ◆ Escape

const Event Escape = Event::Special("\x1B")
| static

Definition at line 54 of file event.hpp.

## ◆ Tab

const Event Tab = Event::Special({9})
| static

Definition at line 55 of file event.hpp.

## ◆ TabReverse

const Event TabReverse = Event::Special({27, 91, 90})
| static

Definition at line 56 of file event.hpp.

## ◆ Insert

const Event Insert = Event::Special("\x1B[2~")
| static

Definition at line 59 of file event.hpp.

## ◆ Home

const Event Home = Event::Special({27, 91, 72})
| static

Definition at line 60 of file event.hpp.

## ◆ End

const Event End = Event::Special({27, 91, 70})
| static

Definition at line 61 of file event.hpp.

## ◆ PageUp

const Event PageUp = Event::Special({27, 91, 53, 126})
| static

Definition at line 62 of file event.hpp.

## ◆ PageDown

const Event PageDown = Event::Special({27, 91, 54, 126})
| static

Definition at line 63 of file event.hpp.

## ◆ F1

const Event F1 = Event::Special("\x1BOP")
| static

Definition at line 66 of file event.hpp.

## ◆ F2

const Event F2 = Event::Special("\x1BOQ")
| static

Definition at line 66 of file event.hpp.

## ◆ F3

const Event F3 = Event::Special("\x1BOR")
| static

Definition at line 66 of file event.hpp.

## ◆ F4

const Event F4 = Event::Special("\x1BOS")
| static

Definition at line 66 of file event.hpp.

## ◆ F5

const Event F5 = Event::Special("\x1B[15~")
| static

Definition at line 66 of file event.hpp.

## ◆ F6

const Event F6 = Event::Special("\x1B[17~")
| static

Definition at line 66 of file event.hpp.

## ◆ F7

const Event F7 = Event::Special("\x1B[18~")
| static

Definition at line 66 of file event.hpp.

## ◆ F8

const Event F8 = Event::Special("\x1B[19~")
| static

Definition at line 66 of file event.hpp.

## ◆ F9

const Event F9 = Event::Special("\x1B[20~")
| static

Definition at line 66 of file event.hpp.

## ◆ F10

const Event F10 = Event::Special("\x1B[21~")
| static

Definition at line 66 of file event.hpp.

## ◆ F11

const Event F11 = Event::Special("\x1B[23~")
| static

Definition at line 66 of file event.hpp.

## ◆ F12

const Event F12 = Event::Special("\x1B[24~")
| static

Definition at line 66 of file event.hpp.

## ◆ a

const Event a = Event::Character("a")
| static

Definition at line 69 of file event.hpp.

## ◆ A

const Event A = Event::Character("A")
| static

Definition at line 69 of file event.hpp.

## ◆ CtrlA

const Event CtrlA = Event::Special("\x01")
| static

Definition at line 69 of file event.hpp.

## ◆ AltA

const Event AltA = Event::Special("\x1b""a")
| static

Definition at line 69 of file event.hpp.

## ◆ CtrlAltA

const Event CtrlAltA = Event::Special("\x1b\x01")
| static

Definition at line 69 of file event.hpp.

## ◆ b

const Event b = Event::Character("b")
| static

Definition at line 70 of file event.hpp.

## ◆ B

const Event B = Event::Character("B")
| static

Definition at line 70 of file event.hpp.

## ◆ CtrlB

const Event CtrlB = Event::Special("\x02")
| static

Definition at line 70 of file event.hpp.

## ◆ AltB

const Event AltB = Event::Special("\x1b""b")
| static

Definition at line 70 of file event.hpp.

## ◆ CtrlAltB

const Event CtrlAltB = Event::Special("\x1b\x02")
| static

Definition at line 70 of file event.hpp.

## ◆ c

const Event c = Event::Character("c")
| static

Definition at line 71 of file event.hpp.

## ◆ C

const Event C = Event::Character("C")
| static

Definition at line 71 of file event.hpp.

## ◆ CtrlC

const Event CtrlC = Event::Special("\x03")
| static

Definition at line 71 of file event.hpp.

## ◆ AltC

const Event AltC = Event::Special("\x1b""c")
| static

Definition at line 71 of file event.hpp.

## ◆ CtrlAltC

const Event CtrlAltC = Event::Special("\x1b\x03")
| static

Definition at line 71 of file event.hpp.

## ◆ d

const Event d = Event::Character("d")
| static

Definition at line 72 of file event.hpp.

## ◆ D

const Event D = Event::Character("D")
| static

Definition at line 72 of file event.hpp.

## ◆ CtrlD

const Event CtrlD = Event::Special("\x04")
| static

Definition at line 72 of file event.hpp.

## ◆ AltD

const Event AltD = Event::Special("\x1b""d")
| static

Definition at line 72 of file event.hpp.

## ◆ CtrlAltD

const Event CtrlAltD = Event::Special("\x1b\x04")
| static

Definition at line 72 of file event.hpp.

## ◆ e

const Event e = Event::Character("e")
| static

Definition at line 73 of file event.hpp.

## ◆ E

const Event E = Event::Character("E")
| static

Definition at line 73 of file event.hpp.

## ◆ CtrlE

const Event CtrlE = Event::Special("\x05")
| static

Definition at line 73 of file event.hpp.

## ◆ AltE

const Event AltE = Event::Special("\x1b""e")
| static

Definition at line 73 of file event.hpp.

## ◆ CtrlAltE

const Event CtrlAltE = Event::Special("\x1b\x05")
| static

Definition at line 73 of file event.hpp.

## ◆ f

const Event f = Event::Character("f")
| static

Definition at line 74 of file event.hpp.

## ◆ F

const Event F = Event::Character("F")
| static

Definition at line 74 of file event.hpp.

## ◆ CtrlF

const Event CtrlF = Event::Special("\x06")
| static

Definition at line 74 of file event.hpp.

## ◆ AltF

const Event AltF = Event::Special("\x1b""f")
| static

Definition at line 74 of file event.hpp.

## ◆ CtrlAltF

const Event CtrlAltF = Event::Special("\x1b\x06")
| static

Definition at line 74 of file event.hpp.

## ◆ g

const Event g = Event::Character("g")
| static

Definition at line 75 of file event.hpp.

## ◆ G

const Event G = Event::Character("G")
| static

Definition at line 75 of file event.hpp.

## ◆ CtrlG

const Event CtrlG = Event::Special("\x07")
| static

Definition at line 75 of file event.hpp.

## ◆ AltG

const Event AltG = Event::Special("\x1b""g")
| static

Definition at line 75 of file event.hpp.

## ◆ CtrlAltG

const Event CtrlAltG = Event::Special("\x1b\x07")
| static

Definition at line 75 of file event.hpp.

## ◆ h

const Event h = Event::Character("h")
| static

Definition at line 76 of file event.hpp.

## ◆ H

const Event H = Event::Character("H")
| static

Definition at line 76 of file event.hpp.

## ◆ CtrlH

const Event CtrlH = Event::Special("\x08")
| static

Definition at line 76 of file event.hpp.

## ◆ AltH

const Event AltH = Event::Special("\x1b""h")
| static

Definition at line 76 of file event.hpp.

## ◆ CtrlAltH

const Event CtrlAltH = Event::Special("\x1b\x08")
| static

Definition at line 76 of file event.hpp.

## ◆ i

const Event i = Event::Character("i")
| static

Definition at line 77 of file event.hpp.

## ◆ I

const Event I = Event::Character("I")
| static

Definition at line 77 of file event.hpp.

## ◆ CtrlI

const Event CtrlI = Event::Special("\x09")
| static

Definition at line 77 of file event.hpp.

## ◆ AltI

const Event AltI = Event::Special("\x1b""i")
| static

Definition at line 77 of file event.hpp.

## ◆ CtrlAltI

const Event CtrlAltI = Event::Special("\x1b\x09")
| static

Definition at line 77 of file event.hpp.

## ◆ j

const Event j = Event::Character("j")
| static

Definition at line 78 of file event.hpp.

## ◆ J

const Event J = Event::Character("J")
| static

Definition at line 78 of file event.hpp.

## ◆ CtrlJ

const Event CtrlJ = Event::Special("\x0a")
| static

Definition at line 78 of file event.hpp.

## ◆ AltJ

const Event AltJ = Event::Special("\x1b""j")
| static

Definition at line 78 of file event.hpp.

## ◆ CtrlAltJ

const Event CtrlAltJ = Event::Special("\x1b\x0a")
| static

Definition at line 78 of file event.hpp.

## ◆ k

const Event k = Event::Character("k")
| static

Definition at line 79 of file event.hpp.

## ◆ K

const Event K = Event::Character("K")
| static

Definition at line 79 of file event.hpp.

## ◆ CtrlK

const Event CtrlK = Event::Special("\x0b")
| static

Definition at line 79 of file event.hpp.

## ◆ AltK

const Event AltK = Event::Special("\x1b""k")
| static

Definition at line 79 of file event.hpp.

## ◆ CtrlAltK

const Event CtrlAltK = Event::Special("\x1b\x0b")
| static

Definition at line 79 of file event.hpp.

## ◆ l

const Event l = Event::Character("l")
| static

Definition at line 80 of file event.hpp.

## ◆ L

const Event L = Event::Character("L")
| static

Definition at line 80 of file event.hpp.

## ◆ CtrlL

const Event CtrlL = Event::Special("\x0c")
| static

Definition at line 80 of file event.hpp.

## ◆ AltL

const Event AltL = Event::Special("\x1b""l")
| static

Definition at line 80 of file event.hpp.

## ◆ CtrlAltL

const Event CtrlAltL = Event::Special("\x1b\x0c")
| static

Definition at line 80 of file event.hpp.

## ◆ m

const Event m = Event::Character("m")
| static

Definition at line 81 of file event.hpp.

## ◆ M

const Event M = Event::Character("M")
| static

Definition at line 81 of file event.hpp.

## ◆ CtrlM

const Event CtrlM = Event::Special("\x0d")
| static

Definition at line 81 of file event.hpp.

## ◆ AltM

const Event AltM = Event::Special("\x1b""m")
| static

Definition at line 81 of file event.hpp.

## ◆ CtrlAltM

const Event CtrlAltM = Event::Special("\x1b\x0d")
| static

Definition at line 81 of file event.hpp.

## ◆ n

const Event n = Event::Character("n")
| static

Definition at line 82 of file event.hpp.

## ◆ N

const Event N = Event::Character("N")
| static

Definition at line 82 of file event.hpp.

## ◆ CtrlN

const Event CtrlN = Event::Special("\x0e")
| static

Definition at line 82 of file event.hpp.

## ◆ AltN

const Event AltN = Event::Special("\x1b""n")
| static

Definition at line 82 of file event.hpp.

## ◆ CtrlAltN

const Event CtrlAltN = Event::Special("\x1b\x0e")
| static

Definition at line 82 of file event.hpp.

## ◆ o

const Event o = Event::Character("o")
| static

Definition at line 83 of file event.hpp.

## ◆ O

const Event O = Event::Character("O")
| static

Definition at line 83 of file event.hpp.

## ◆ CtrlO

const Event CtrlO = Event::Special("\x0f")
| static

Definition at line 83 of file event.hpp.

## ◆ AltO

const Event AltO = Event::Special("\x1b""o")
| static

Definition at line 83 of file event.hpp.

## ◆ CtrlAltO

const Event CtrlAltO = Event::Special("\x1b\x0f")
| static

Definition at line 83 of file event.hpp.

## ◆ p

const Event p = Event::Character("p")
| static

Definition at line 84 of file event.hpp.

## ◆ P

const Event P = Event::Character("P")
| static

Definition at line 84 of file event.hpp.

## ◆ CtrlP

const Event CtrlP = Event::Special("\x10")
| static

Definition at line 84 of file event.hpp.

## ◆ AltP

const Event AltP = Event::Special("\x1b""p")
| static

Definition at line 84 of file event.hpp.

## ◆ CtrlAltP

const Event CtrlAltP = Event::Special("\x1b\x10")
| static

Definition at line 84 of file event.hpp.

## ◆ q

const Event q = Event::Character("q")
| static

Definition at line 85 of file event.hpp.

## ◆ Q

const Event Q = Event::Character("Q")
| static

Definition at line 85 of file event.hpp.

## ◆ CtrlQ

const Event CtrlQ = Event::Special("\x11")
| static

Definition at line 85 of file event.hpp.

## ◆ AltQ

const Event AltQ = Event::Special("\x1b""q")
| static

Definition at line 85 of file event.hpp.

## ◆ CtrlAltQ

const Event CtrlAltQ = Event::Special("\x1b\x11")
| static

Definition at line 85 of file event.hpp.

## ◆ r

const Event r = Event::Character("r")
| static

Definition at line 86 of file event.hpp.

## ◆ R

const Event R = Event::Character("R")
| static

Definition at line 86 of file event.hpp.

## ◆ CtrlR

const Event CtrlR = Event::Special("\x12")
| static

Definition at line 86 of file event.hpp.

## ◆ AltR

const Event AltR = Event::Special("\x1b""r")
| static

Definition at line 86 of file event.hpp.

## ◆ CtrlAltR

const Event CtrlAltR = Event::Special("\x1b\x12")
| static

Definition at line 86 of file event.hpp.

## ◆ s

const Event s = Event::Character("s")
| static

Definition at line 87 of file event.hpp.

## ◆ S

const Event S = Event::Character("S")
| static

Definition at line 87 of file event.hpp.

## ◆ CtrlS

const Event CtrlS = Event::Special("\x13")
| static

Definition at line 87 of file event.hpp.

## ◆ AltS

const Event AltS = Event::Special("\x1b""s")
| static

Definition at line 87 of file event.hpp.

## ◆ CtrlAltS

const Event CtrlAltS = Event::Special("\x1b\x13")
| static

Definition at line 87 of file event.hpp.

## ◆ t

const Event t = Event::Character("t")
| static

Definition at line 88 of file event.hpp.

## ◆ T

const Event T = Event::Character("T")
| static

Definition at line 88 of file event.hpp.

## ◆ CtrlT

const Event CtrlT = Event::Special("\x14")
| static

Definition at line 88 of file event.hpp.

## ◆ AltT

const Event AltT = Event::Special("\x1b""t")
| static

Definition at line 88 of file event.hpp.

## ◆ CtrlAltT

const Event CtrlAltT = Event::Special("\x1b\x14")
| static

Definition at line 88 of file event.hpp.

## ◆ u

const Event u = Event::Character("u")
| static

Definition at line 89 of file event.hpp.

## ◆ U

const Event U = Event::Character("U")
| static

Definition at line 89 of file event.hpp.

## ◆ CtrlU

const Event CtrlU = Event::Special("\x15")
| static

Definition at line 89 of file event.hpp.

## ◆ AltU

const Event AltU = Event::Special("\x1b""u")
| static

Definition at line 89 of file event.hpp.

## ◆ CtrlAltU

const Event CtrlAltU = Event::Special("\x1b\x15")
| static

Definition at line 89 of file event.hpp.

## ◆ v

const Event v = Event::Character("v")
| static

Definition at line 90 of file event.hpp.

## ◆ V

const Event V = Event::Character("V")
| static

Definition at line 90 of file event.hpp.

## ◆ CtrlV

const Event CtrlV = Event::Special("\x16")
| static

Definition at line 90 of file event.hpp.

## ◆ AltV

const Event AltV = Event::Special("\x1b""v")
| static

Definition at line 90 of file event.hpp.

## ◆ CtrlAltV

const Event CtrlAltV = Event::Special("\x1b\x16")
| static

Definition at line 90 of file event.hpp.

## ◆ w

const Event w = Event::Character("w")
| static

Definition at line 91 of file event.hpp.

## ◆ W

const Event W = Event::Character("W")
| static

Definition at line 91 of file event.hpp.

## ◆ CtrlW

const Event CtrlW = Event::Special("\x17")
| static

Definition at line 91 of file event.hpp.

## ◆ AltW

const Event AltW = Event::Special("\x1b""w")
| static

Definition at line 91 of file event.hpp.

## ◆ CtrlAltW

const Event CtrlAltW = Event::Special("\x1b\x17")
| static

Definition at line 91 of file event.hpp.

## ◆ x

const Event x = Event::Character("x")
| static

Definition at line 92 of file event.hpp.

## ◆ X

const Event X = Event::Character("X")
| static

Definition at line 92 of file event.hpp.

## ◆ CtrlX

const Event CtrlX = Event::Special("\x18")
| static

Definition at line 92 of file event.hpp.

## ◆ AltX

const Event AltX = Event::Special("\x1b""x")
| static

Definition at line 92 of file event.hpp.

## ◆ CtrlAltX

const Event CtrlAltX = Event::Special("\x1b\x18")
| static

Definition at line 92 of file event.hpp.

## ◆ y

const Event y = Event::Character("y")
| static

Definition at line 93 of file event.hpp.

## ◆ Y

const Event Y = Event::Character("Y")
| static

Definition at line 93 of file event.hpp.

## ◆ CtrlY

const Event CtrlY = Event::Special("\x19")
| static

Definition at line 93 of file event.hpp.

## ◆ AltY

const Event AltY = Event::Special("\x1b""y")
| static

Definition at line 93 of file event.hpp.

## ◆ CtrlAltY

const Event CtrlAltY = Event::Special("\x1b\x19")
| static

Definition at line 93 of file event.hpp.

## ◆ z

const Event z = Event::Character("z")
| static

Definition at line 94 of file event.hpp.

## ◆ Z

const Event Z = Event::Character("Z")
| static

Definition at line 94 of file event.hpp.

## ◆ CtrlZ

const Event CtrlZ = Event::Special("\x1a")
| static

Definition at line 94 of file event.hpp.

## ◆ AltZ

const Event AltZ = Event::Special("\x1b""z")
| static

Definition at line 94 of file event.hpp.

## ◆ CtrlAltZ

const Event CtrlAltZ = Event::Special("\x1b\x1a")
| static

Definition at line 94 of file event.hpp.

## ◆ Custom

const Event Custom = Event::Special({0})
| static

Definition at line 97 of file event.hpp.

## ◆ screen_

ScreenInteractive* screen_ = nullptr

Definition at line 124 of file event.hpp.

## ◆ mouse

struct Mouse mouse

Definition at line 144 of file event.hpp.

## ◆ cursor

struct Cursor cursor

Definition at line 145 of file event.hpp.

## ◆ cursor_shape

int cursor_shape

Definition at line 146 of file event.hpp.

## ◆ ftxui::Loop

class ftxui::Loop

Loop is a class that manages the event loop for a component.

It is responsible for running the component, handling events, and updating the screen.

The Loop class is designed to be used with a ScreenInteractive object, which represents the terminal screen.

Example

#include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/component/loop.hpp>
int main() {
auto screen = ftxui::ScreenInteractive::TerminalOutput();
auto component = ftxui::Button("Click me", [] { ... });
ftxui::Loop loop(screen.get(), component);
// Either
loop.Run(); // Blocking until the component quits.
// Or
loop.RunOnce(); // Non-blocking, returns immediately.
// Or
loop.RunOnceBlocking(); // Blocking until handling one event.
// Or in a loop:
while (!loop.HasQuitted()) {
loop.RunOnce();
// Do something else like running a different library loop function.
}
}
component.hpp
main
int main()
Definition examples/component/button.cpp:33
ftxui::ScreenInteractive::TerminalOutput
static ScreenInteractive TerminalOutput()
Definition screen_interactive.cpp:410
ftxui::Loop
Loop is a class that manages the event loop for a component.
Definition loop.hpp:56
ftxui::Button
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
Definition src/ftxui/component/button.cpp:175
loop.hpp
screen_interactive.hpp

Definition at line 56 of file loop.hpp.

### Public Member Functions
| Loop (ScreenInteractive *screen, Component component)
| A Loop is a wrapper around a Component and a ScreenInteractive. It is used to run a Component in a terminal.
| ~Loop ()
bool | HasQuitted ()
| Whether the loop has quitted.
void | RunOnce ()
| Execute the loop. Make the `component` to process every pending tasks/events. A new frame might be drawn if the previous was invalidated. Return true until the loop hasn't completed.
void | RunOnceBlocking ()
| Wait for at least one event to be handled and execute `Loop::RunOnce()`.
void | Run ()
| Loop (const Loop &)=default
| Loop (Loop &&)=delete
Loop & | operator= (Loop &&)=delete
| Loop (const ScreenInteractive &)=delete
Loop & | operator= (const Loop &)=delete

#### Constructor & Destructor Documentation

## ◆ Loop() [1/4]

Loop | ( | ScreenInteractive * | screen,
|  | Component | component )

A Loop is a wrapper around a Component and a ScreenInteractive. It is used to run a Component in a terminal.

See also
  Component, ScreenInteractive.
  ScreenInteractive::Loop().
  ScreenInteractive::ExitLoop().

Parameters

  [in] | screen | The screen to use.
  [in] | component | The component to run.

Definition at line 20 of file loop.cpp.

## ◆ ~Loop()

~Loop | ( |  | ) |

Definition at line 25 of file loop.cpp.

## ◆ Loop() [2/4]

Loop | ( | const Loop & |  | ) |
| default

## ◆ Loop() [3/4]

Loop | ( | Loop && |  | ) |
| delete

## ◆ Loop() [4/4]

Loop | ( | const ScreenInteractive & |  | ) |
| delete

#### Member Function Documentation

## ◆ HasQuitted()

bool HasQuitted | ( |  | ) |

Whether the loop has quitted.

Definition at line 30 of file loop.cpp.

## ◆ RunOnce()

void RunOnce | ( |  | ) |

Execute the loop. Make the `component` to process every pending tasks/events. A new frame might be drawn if the previous was invalidated. Return true until the loop hasn't completed.

Definition at line 37 of file loop.cpp.

## ◆ RunOnceBlocking()

void RunOnceBlocking | ( |  | ) |

Wait for at least one event to be handled and execute `Loop::RunOnce()`.

Definition at line 43 of file loop.cpp.

## ◆ Run()

void Run | ( |  | ) |

Execute the loop, blocking the current thread, up until the loop has quitted.

Definition at line 49 of file loop.cpp.

## ◆ operator=() [1/2]

Loop & operator= | ( | Loop && |  | ) |
| delete

## ◆ operator=() [2/2]

Loop & operator= | ( | const Loop & |  | ) |
| delete

## ◆ ftxui::Mouse

struct ftxui::Mouse

A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta).

Definition at line 11 of file mouse.hpp.

### Public Types
enum | Button { Left = 0 , Middle = 1 , Right = 2 , None = 3 , WheelUp = 4 , WheelDown = 5 , WheelLeft = 6 , WheelRight = 7 }
enum | Motion { Released = 0 , Pressed = 1 , Moved = 2 }
### Public Attributes
Button | button = Button::None
Motion | motion = Motion::Pressed
bool | shift = false
bool | meta = false
bool | control = false
int | x = 0
int | y = 0

#### Member Enumeration Documentation

## ◆ Button

enum Button

Enumerator
Left |
Middle |
Right |
None |
WheelUp |
WheelDown |
WheelLeft |
WheelRight | Supported terminal only.

Definition at line 12 of file mouse.hpp.

## ◆ Motion

enum Motion

Enumerator
Released |
Pressed |
Moved |

Definition at line 23 of file mouse.hpp.

#### Member Data Documentation

## ◆ button

Button button = Button::None

Definition at line 30 of file mouse.hpp.

## ◆ motion

Motion motion = Motion::Pressed

Definition at line 33 of file mouse.hpp.

## ◆ shift

bool shift = false

Definition at line 36 of file mouse.hpp.

## ◆ meta

bool meta = false

Definition at line 37 of file mouse.hpp.

## ◆ control

bool control = false

Definition at line 38 of file mouse.hpp.

## ◆ x

int x = 0

Definition at line 41 of file mouse.hpp.

## ◆ y

int y = 0

Definition at line 42 of file mouse.hpp.

## ◆ ftxui::ScreenInteractive

class ftxui::ScreenInteractive

ScreenInteractive is a `Screen` that can handle events, run a main loop, and manage components.

Definition at line 33 of file screen_interactive.hpp.

Inheritance diagram for ScreenInteractive:
[legend]

### Public Types
using | SelectionStyle = std::function<void(Pixel&)>
### Public Member Functions
void | TrackMouse (bool enable=true)
| Set whether mouse is tracked and events reported. called outside of the main loop. E.g `ScreenInteractive::Loop(...)`.
void | Loop (Component)
| Execute the main loop.
void | Exit ()
| Exit the main loop.
Closure | ExitLoopClosure ()
| Return a function to exit the main loop.
void | Post (Task task)
| Add a task to the main loop. It will be executed later, after every other scheduled tasks.
void | PostEvent (Event event)
| Add an event to the main loop. It will be executed later, after every other scheduled events.
void | RequestAnimationFrame ()
| Add a task to draw the screen one more time, until all the animations are done.
CapturedMouse | CaptureMouse ()
| Try to get the unique lock about behing able to capture the mouse.
Closure | WithRestoredIO (Closure)
| Decorate a function. It executes the same way, but with the currently active screen terminal hooks temporarilly uninstalled during its execution.
void | ForceHandleCtrlC (bool force)
| Force FTXUI to handle or not handle Ctrl-C, even if the component catches the Event::CtrlC.
void | ForceHandleCtrlZ (bool force)
| Force FTXUI to handle or not handle Ctrl-Z, even if the component catches the Event::CtrlZ.
std::string | GetSelection ()
| Returns the content of the current selection.
void | SelectionChange (std::function< void()> callback)
std::string | ToString () const
void | Print () const
void | Clear ()
| Clear all the pixel from the screen.
std::string | ResetPosition (bool clear=false) const
| Return a string to be printed in order to reset the cursor position to the beginning of the screen.
void | ApplyShader ()
Cursor | cursor () const
void | SetCursor (Cursor cursor)
uint8_t | RegisterHyperlink (const std::string &link)
const std::string & | Hyperlink (uint8_t id) const
const SelectionStyle & | GetSelectionStyle () const
| Return the current selection style.
void | SetSelectionStyle (SelectionStyle decorator)
| Set the current selection style.
std::string & | at (int x, int y)
| Access a character in a cell at a given position.
const std::string & | at (int x, int y) const
| Access a character in a cell at a given position.
Pixel & | PixelAt (int x, int y)
| Access a cell (Pixel) at a given position.
const Pixel & | PixelAt (int x, int y) const
| Access a cell (Pixel) at a given position.
int | dimx () const
int | dimy () const
### Static Public Member Functions
static ScreenInteractive | FixedSize (int dimx, int dimy)
static ScreenInteractive | Fullscreen ()
static ScreenInteractive | FullscreenPrimaryScreen ()
static ScreenInteractive | FullscreenAlternateScreen ()
static ScreenInteractive | FitComponent ()
static ScreenInteractive | TerminalOutput ()
static ScreenInteractive * | Active ()
| Return the currently active screen, or null if none.
static Screen | Create (Dimensions dimension)
| Create a screen with the given dimension.
static Screen | Create (Dimensions width, Dimensions height)
| Create a screen with the given dimension along the x-axis and y-axis.
### Public Attributes
friend | Private
Box | stencil
### Protected Attributes
Cursor | cursor_
std::vector< std::string > | hyperlinks_ = {""}
SelectionStyle | selection_style_
int | dimx_
int | dimy_
std::vector< std::vector< Pixel > > | pixels_

#### Member Typedef Documentation

## ◆ SelectionStyle

using SelectionStyle = std::function<void(Pixel&)>
| inherited

Definition at line 72 of file screen.hpp.

#### Member Function Documentation

## ◆ FixedSize()

ScreenInteractive FixedSize | ( | int | dimx,
|  | int | dimy )
| static

Definition at line 363 of file screen_interactive.cpp.

## ◆ Fullscreen()

ScreenInteractive Fullscreen | ( |  | ) |
| static

Create a ScreenInteractive taking the full terminal size. This is using the alternate screen buffer to avoid messing with the terminal content.

Note
  This is the same as `ScreenInteractive::FullscreenAlternateScreen()`

Definition at line 376 of file screen_interactive.cpp.

## ◆ FullscreenPrimaryScreen()

ScreenInteractive FullscreenPrimaryScreen | ( |  | ) |
| static

Create a ScreenInteractive taking the full terminal size. The primary screen buffer is being used. It means if the terminal is resized, the previous content might mess up with the terminal content.

Definition at line 384 of file screen_interactive.cpp.

## ◆ FullscreenAlternateScreen()

ScreenInteractive FullscreenAlternateScreen | ( |  | ) |
| static

Create a ScreenInteractive taking the full terminal size. This is using the alternate screen buffer to avoid messing with the terminal content.

Definition at line 397 of file screen_interactive.cpp.

## ◆ FitComponent()

ScreenInteractive FitComponent | ( |  | ) |
| static

Create a ScreenInteractive whose width and height match the component being drawn.

Definition at line 423 of file screen_interactive.cpp.

## ◆ TerminalOutput()

ScreenInteractive TerminalOutput | ( |  | ) |
| static

Create a ScreenInteractive whose width match the terminal output width and the height matches the component being drawn.

Definition at line 410 of file screen_interactive.cpp.

## ◆ TrackMouse()

void TrackMouse | ( | bool | enable = true | ) |

Set whether mouse is tracked and events reported. called outside of the main loop. E.g `ScreenInteractive::Loop(...)`.

Parameters

  enable | Whether to enable mouse event tracking.

Note
  This muse be called outside of the main loop. E.g. before calling `ScreenInteractive::Loop`.
  Mouse tracking is enabled by default.
  Mouse tracking is only supported on terminals that supports it.

### Example

auto screen = ScreenInteractive::TerminalOutput();
screen.TrackMouse(false);
screen.Loop(component);

Definition at line 448 of file screen_interactive.cpp.

## ◆ Active()

ScreenInteractive * Active | ( |  | ) |
| static

Return the currently active screen, or null if none.

Definition at line 596 of file screen_interactive.cpp.

## ◆ Loop()

void Loop | ( | Component | component | ) |

Execute the main loop.

Parameters

  component | The component to draw.

Definition at line 498 of file screen_interactive.cpp.

## ◆ Exit()

void Exit | ( |  | ) |

Exit the main loop.

Definition at line 1033 of file screen_interactive.cpp.

## ◆ ExitLoopClosure()

Closure ExitLoopClosure | ( |  | ) |

Return a function to exit the main loop.

Definition at line 1028 of file screen_interactive.cpp.

## ◆ Post()

void Post | ( | Task | task | ) |

Add a task to the main loop. It will be executed later, after every other scheduled tasks.

Definition at line 454 of file screen_interactive.cpp.

## ◆ PostEvent()

void PostEvent | ( | Event | event | ) |

Add an event to the main loop. It will be executed later, after every other scheduled events.

Definition at line 466 of file screen_interactive.cpp.

## ◆ RequestAnimationFrame()

void RequestAnimationFrame | ( |  | ) |

Add a task to draw the screen one more time, until all the animations are done.

Definition at line 472 of file screen_interactive.cpp.

## ◆ CaptureMouse()

CapturedMouse CaptureMouse | ( |  | ) |

Try to get the unique lock about behing able to capture the mouse.

Returns
  A unique lock if the mouse is not already captured, otherwise a null.

Definition at line 487 of file screen_interactive.cpp.

## ◆ WithRestoredIO()

Closure WithRestoredIO | ( | Closure | fn | ) |

Decorate a function. It executes the same way, but with the currently active screen terminal hooks temporarilly uninstalled during its execution.

Parameters

  fn | The function to decorate.

Definition at line 562 of file screen_interactive.cpp.

## ◆ ForceHandleCtrlC()

void ForceHandleCtrlC | ( | bool | force | ) |

Force FTXUI to handle or not handle Ctrl-C, even if the component catches the Event::CtrlC.

Definition at line 572 of file screen_interactive.cpp.

## ◆ ForceHandleCtrlZ()

void ForceHandleCtrlZ | ( | bool | force | ) |

Force FTXUI to handle or not handle Ctrl-Z, even if the component catches the Event::CtrlZ.

Definition at line 578 of file screen_interactive.cpp.

## ◆ GetSelection()

std::string GetSelection | ( |  | ) |

Returns the content of the current selection.

Definition at line 583 of file screen_interactive.cpp.

## ◆ SelectionChange()

void SelectionChange | ( | std::function< void()> | callback | ) |

Definition at line 590 of file screen_interactive.cpp.

## ◆ Create() [1/2]

Screen Create | ( | Dimensions | dimension | ) |
| static inherited

Create a screen with the given dimension.

Definition at line 394 of file screen.cpp.

## ◆ Create() [2/2]

Screen Create | ( | Dimensions | width,
|  | Dimensions | height )
| static inherited

Create a screen with the given dimension along the x-axis and y-axis.

Definition at line 388 of file screen.cpp.

## ◆ ToString()

std::string ToString | ( |  | ) | const
| inherited

Produce a std::string that can be used to print the Screen on the terminal.

Note
  Don't forget to flush stdout. Alternatively, you can use Screen::Print();

Definition at line 415 of file screen.cpp.

## ◆ Print()

void Print | ( |  | ) | const
| inherited

Definition at line 452 of file screen.cpp.

## ◆ Clear()

void Clear | ( |  | ) |
| inherited

Clear all the pixel from the screen.

Definition at line 494 of file screen.cpp.

## ◆ ResetPosition()

std::string ResetPosition | ( | bool | clear = false | ) | const
| inherited

Return a string to be printed in order to reset the cursor position to the beginning of the screen.

std::string reset_position;
while(true) {
auto document = render();
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << reset_position << screen.ToString() << std::flush;
reset_position = screen.ResetPosition();
using namespace std::chrono_literals;
std::this_thread::sleep_for(0.01s);
}
ftxui::Render
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Definition node.cpp:84
ftxui::Screen::Create
static Screen Create(Dimensions dimension)
Create a screen with the given dimension.
Definition screen.cpp:394

Returns
  The string to print in order to reset the cursor position to the beginning.

Definition at line 475 of file screen.cpp.

## ◆ ApplyShader()

void ApplyShader | ( |  | ) |
| inherited

Definition at line 506 of file screen.cpp.

## ◆ cursor()

Cursor cursor | ( |  | ) | const
| inline inherited

Definition at line 64 of file screen.hpp.

## ◆ SetCursor()

void SetCursor | ( | Cursor | cursor | ) |
| inline inherited

Definition at line 65 of file screen.hpp.

## ◆ RegisterHyperlink()

std::uint8_t RegisterHyperlink | ( | const std::string & | link | ) |
| inherited

Definition at line 533 of file screen.cpp.

## ◆ Hyperlink()

const std::string & Hyperlink | ( | uint8_t | id | ) | const
| inherited

Definition at line 546 of file screen.cpp.

## ◆ GetSelectionStyle()

const Screen::SelectionStyle & GetSelectionStyle | ( |  | ) | const
| inherited

Return the current selection style.

See also
  SetSelectionStyle

Definition at line 555 of file screen.cpp.

## ◆ SetSelectionStyle()

void SetSelectionStyle | ( | SelectionStyle | decorator | ) |
| inherited

Set the current selection style.

See also
  GetSelectionStyle

Definition at line 561 of file screen.cpp.

## ◆ at() [1/2]

std::string & at | ( | int | x,
|  | int | y )
| inherited

Access a character in a cell at a given position.

Parameters

  x | The cell position along the x-axis.
  y | The cell position along the y-axis.

Definition at line 29 of file image.cpp.

## ◆ at() [2/2]

const std::string & at | ( | int | x,
|  | int | y ) const
| inherited

Access a character in a cell at a given position.

Parameters

  x | The cell position along the x-axis.
  y | The cell position along the y-axis.

Definition at line 36 of file image.cpp.

## ◆ PixelAt() [1/2]

Pixel & PixelAt | ( | int | x,
|  | int | y )
| inherited

Access a cell (Pixel) at a given position.

Parameters

  x | The cell position along the x-axis.
  y | The cell position along the y-axis.

Definition at line 43 of file image.cpp.

## ◆ PixelAt() [2/2]

const Pixel & PixelAt | ( | int | x,
|  | int | y ) const
| inherited

Access a cell (Pixel) at a given position.

Parameters

  x | The cell position along the x-axis.
  y | The cell position along the y-axis.

Definition at line 50 of file image.cpp.

## ◆ dimx()

int dimx | ( |  | ) | const
| inline inherited

Definition at line 32 of file image.hpp.

## ◆ dimy()

int dimy | ( |  | ) | const
| inline inherited

Definition at line 33 of file image.hpp.

#### Member Data Documentation

## ◆ Private

friend Private

Definition at line 166 of file screen_interactive.hpp.

## ◆ cursor_

Cursor cursor_
| protected inherited

Definition at line 77 of file screen.hpp.

## ◆ hyperlinks_

std::vector<std::string> hyperlinks_ = {""}
| protected inherited

Definition at line 78 of file screen.hpp.

## ◆ selection_style_

SelectionStyle selection_style_
| protected inherited

Initial value:
= [](Pixel& pixel) {
pixel.inverted ^= true;
}

Definition at line 81 of file screen.hpp.

## ◆ stencil

Box stencil
| inherited

Definition at line 38 of file image.hpp.

## ◆ dimx_

int dimx_
| protected inherited

Definition at line 41 of file image.hpp.

## ◆ dimy_

int dimy_
| protected inherited

Definition at line 42 of file image.hpp.

## ◆ pixels_

std::vector<std::vector<Pixel> > pixels_
| protected inherited

Definition at line 43 of file image.hpp.

## Function Documentation

## ◆ RequestAnimationFrame()

void RequestAnimationFrame | ( |  | ) |

RequestAnimationFrame is a function that requests a new frame to be drawn in the next animation cycle.

Note
  This function is typically called by components that need to update their state or appearance over time, such as animations or transitions. This is useful when the change doesn't depend depend on the events seen by the terminal, but rather on the passage of time.

Components who haven't completed their animation can call this function to request a new frame to be drawn later.

When there is no new events and no animations to complete, no new frame is drawn.

Definition at line 63 of file screen_interactive.cpp.

## ◆ Button() [1/2]

Component Button | ( | ButtonOption | option | ) |

Draw a button. Execute a function when clicked.

Parameters

  option | Additional optional parameters.

See also
  ButtonBase

### Example

auto screen = ScreenInteractive::FitComponent();
Component button = Button({
.label = "Click to quit",
.on_click = screen.ExitLoopClosure(),
});
screen.Loop(button)
ftxui::ScreenInteractive::FitComponent
static ScreenInteractive FitComponent()
Definition screen_interactive.cpp:423
ftxui::Component
std::shared_ptr< ComponentBase > Component
Definition component_base.hpp:24

### Output

┌─────────────┐
│Click to quit│
└─────────────┘

Definition at line 175 of file src/ftxui/component/button.cpp.

## ◆ Button() [2/2]

Component Button | ( | ConstStringRef | label,
|  | std::function< void()> | on_click,
|  | ButtonOption | option )

Draw a button. Execute a function when clicked.

Parameters

  label | The label of the button.
  on_click | The action to execute when clicked.
  option | Additional optional parameters.

See also
  ButtonBase

### Example

auto screen = ScreenInteractive::FitComponent();
std::string label = "Click to quit";
Component button = Button(&label, screen.ExitLoopClosure());
screen.Loop(button)

### Output

┌─────────────┐
│Click to quit│
└─────────────┘

Definition at line 203 of file src/ftxui/component/button.cpp.

## ◆ CatchEvent() [1/2]

Component CatchEvent | ( | Component | child,
|  | std::function< bool(Event event)> | on_event )

Return a component, using |on_event| to catch events. This function must returns true when the event has been handled, false otherwise.

Parameters

  child | The wrapped component.
  on_event | The function drawing the interface.

### Example

auto screen = ScreenInteractive::TerminalOutput();
auto renderer = Renderer([] {
return text("My interface");
});
auto component = CatchEvent(renderer, [&](Event event) {
if (event == Event::Character('q')) {
screen.ExitLoopClosure()();
return true;
}
return false;
});
screen.Loop(component);
ftxui::Renderer
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Definition src/ftxui/component/renderer.cpp:61
ftxui::text
Element text(std::wstring text)
Display a piece of unicode text.
Definition text.cpp:160
ftxui::CatchEvent
Component CatchEvent(Component child, std::function< bool(Event)>)

Definition at line 54 of file catch_event.cpp.

## ◆ CatchEvent() [2/2]

ComponentDecorator CatchEvent | ( | std::function< bool(Event)> | on_event | ) |

Decorate a component, using |on_event| to catch events. This function must returns true when the event has been handled, false otherwise.

Parameters

  on_event | The function drawing the interface.

### Example

auto screen = ScreenInteractive::TerminalOutput();
auto renderer = Renderer([] { return text("Hello world"); });
renderer |= CatchEvent([&](Event event) {
if (event == Event::Character('q')) {
screen.ExitLoopClosure()();
return true;
}
return false;
});
screen.Loop(renderer);

Definition at line 80 of file catch_event.cpp.

## ◆ Checkbox() [1/2]

Component Checkbox | ( | CheckboxOption | option | ) |

Draw checkable element.

Parameters

  option | Additional optional parameters.

See also
  CheckboxBase

### Example

auto screen = ScreenInteractive::FitComponent();
CheckboxOption option;
option.label = "Make a sandwidth";
option.checked = false;
Component checkbox = Checkbox(option);
screen.Loop(checkbox)
ftxui::CheckboxOption::label
ConstStringRef label
Definition component_options.hpp:140
ftxui::CheckboxOption::checked
Ref< bool > checked
Definition component_options.hpp:142
ftxui::Checkbox
Component Checkbox(CheckboxOption options)
Draw checkable element.
Definition src/ftxui/component/checkbox.cpp:108
ftxui::CheckboxOption
Option for the Checkbox component.
Definition component_options.hpp:136

### Output

☐ Make a sandwitch

Definition at line 108 of file src/ftxui/component/checkbox.cpp.

## ◆ Checkbox() [2/2]

Component Checkbox | ( | ConstStringRef | label,
|  | bool * | checked,
|  | CheckboxOption | option )

Draw checkable element.

Parameters

  label | The label of the checkbox.
  checked | Whether the checkbox is checked or not.
  option | Additional optional parameters.

See also
  CheckboxBase

### Example

auto screen = ScreenInteractive::FitComponent();
std::string label = "Make a sandwidth";
bool checked = false;
Component checkbox = Checkbox(&label, &checked);
screen.Loop(checkbox)

### Output

☐ Make a sandwitch

Definition at line 135 of file src/ftxui/component/checkbox.cpp.

## ◆ Vertical() [1/2]

Component Vertical | ( | Components | children | ) |

A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or 'j'/'k' keys.

Parameters

  children | the list of components.

See also
  ContainerBase

### Example

auto container = Container::Vertical({
children_1,
children_2,
children_3,
children_4,
});
ftxui::Container::Vertical
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Definition container.cpp:317

Definition at line 317 of file container.cpp.

## ◆ Vertical() [2/2]

Component Vertical | ( | Components | children,
|  | int * | selector )

A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or 'j'/'k' keys. This is useful for implementing a Menu for instance.

Parameters

  children | the list of components.
  selector | A reference to the index of the selected children.

See also
  ContainerBase

### Example

auto container = Container::Vertical({
children_1,
children_2,
children_3,
children_4,
}, &selected_children);

Definition at line 339 of file container.cpp.

## ◆ Horizontal() [1/2]

Component Horizontal | ( | Components | children | ) |

A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow key or 'h'/'l' keys.

Parameters

  children | the list of components.

See also
  ContainerBase

### Example

int selected_children = 2;
auto container = Container::Horizontal({
children_1,
children_2,
children_3,
children_4,
});
ftxui::Container::Horizontal
Component Horizontal(Components children)
A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow...
Definition container.cpp:360

Definition at line 360 of file container.cpp.

## ◆ Horizontal() [2/2]

Component Horizontal | ( | Components | children,
|  | int * | selector )

A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow key or 'h'/'l' keys.

Parameters

  children | the list of components.
  selector | A reference to the index of the selected children.

See also
  ContainerBase

### Example

int selected_children = 2;
auto container = Container::Horizontal({
children_1,
children_2,
children_3,
children_4,
}, selected_children);

Definition at line 382 of file container.cpp.

## ◆ Tab()

Component Tab | ( | Components | children,
|  | int * | selector )

A list of components, where only one is drawn and interacted with at a time. The |selector| gives the index of the selected component. This is useful to implement tabs.

Parameters

  children | The list of components.
  selector | The index of the drawn children.

See also
  ContainerBase

### Example

int tab_drawn = 0;
auto container = Container::Tab({
children_1,
children_2,
children_3,
children_4,
}, &tab_drawn);
ftxui::Container::Tab
Component Tab(Components children, int *selector)
A list of components, where only one is drawn and interacted with at a time. The |selector| gives the...
Definition container.cpp:405

Definition at line 405 of file container.cpp.

## ◆ Stacked()

Component Stacked | ( | Components | children | ) |

A list of components to be stacked on top of each other. Events are propagated to the first component, then the second if not handled, etc. The components are drawn in the reverse order they are given. When a component take focus, it is put at the front, without changing the relative order of the other elements.

This should be used with the `Window` component.

Parameters

  children | The list of components.

See also
  Window

### Example

auto container = Container::Stacked({
children_1,
children_2,
children_3,
children_4,
});
ftxui::Container::Stacked
Component Stacked(Components children)
A list of components to be stacked on top of each other. Events are propagated to the first component...
Definition container.cpp:432

Definition at line 432 of file container.cpp.

## ◆ Dropdown() [1/2]

Component Dropdown | ( | ConstStringListRef | entries,
|  | int * | selected )

A dropdown menu.

Parameters

  entries | The list of entries to display.
  selected | The index of the selected entry.

Definition at line 22 of file src/ftxui/component/dropdown.cpp.

## ◆ Dropdown() [2/2]

Component Dropdown | ( | DropdownOption | option | ) |

A dropdown menu.

Parameters

  option | The options for the dropdown.

Definition at line 33 of file src/ftxui/component/dropdown.cpp.

## ◆ Hoverable() [1/6]

Component Hoverable | ( | Component | component,
|  | bool * | hover )

Wrap a component. Gives the ability to know if it is hovered by the mouse.

Parameters

  component | The wrapped component.
  hover | The value to reflect whether the component is hovered or not.

### Example

auto button = Button("exit", screen.ExitLoopClosure());
bool hover = false;
auto button_hover = Hoverable(button, &hover);
ftxui::Hoverable
Component Hoverable(Component component, bool *hover)
Wrap a component. Gives the ability to know if it is hovered by the mouse.
Definition hoverable.cpp:43

Definition at line 43 of file hoverable.cpp.

## ◆ Hoverable() [2/6]

Component Hoverable | ( | Component | component,
|  | std::function< void()> | on_enter,
|  | std::function< void()> | on_leave )

Wrap a component. Uses callbacks.

Parameters

  component | The wrapped component.
  on_enter | Callback OnEnter
  on_leave | Callback OnLeave

### Example

auto button = Button("exit", screen.ExitLoopClosure());
bool hover = false;
auto button_hover = Hoverable(button, &hover);

Definition at line 86 of file hoverable.cpp.

## ◆ Hoverable() [3/6]

ComponentDecorator Hoverable | ( | bool * | hover | ) |

Wrap a component. Gives the ability to know if it is hovered by the mouse.

Parameters

  hover | The value to reflect whether the component is hovered or not.

### Example

bool hover = false;
auto button = Button("exit", screen.ExitLoopClosure());
button |= Hoverable(&hover);

Definition at line 141 of file hoverable.cpp.

## ◆ Hoverable() [4/6]

ComponentDecorator Hoverable | ( | std::function< void()> | on_enter,
|  | std::function< void()> | on_leave )

Wrap a component. Gives the ability to know if it is hovered by the mouse.

Parameters

  on_enter | is called when the mouse hover the component.
  on_leave | is called when the mouse leave the component.

### Example

auto button = Button("exit", screen.ExitLoopClosure());
int on_enter_cnt = 0;
int on_leave_cnt = 0;
button |= Hoverable(
[&]{ on_enter_cnt++; },
[&]{ on_leave_cnt++; }
);

Definition at line 165 of file hoverable.cpp.

## ◆ Hoverable() [5/6]

Component Hoverable | ( | Component | component,
|  | std::function< void(bool)> | on_change )

Wrap a component. Gives the ability to know if it is hovered by the mouse.

Parameters

  component | the wrapped component.
  on_change | is called when the mouse enter or leave the component.

### Example

auto button = Button("exit", screen.ExitLoopClosure());
bool hovered = false;
auto button_hoverable = Hoverable(button,
[&](bool hover) { hovered = hover;});

Definition at line 188 of file hoverable.cpp.

## ◆ Hoverable() [6/6]

ComponentDecorator Hoverable | ( | std::function< void(bool)> | on_change | ) |

Wrap a component. Gives the ability to know if it is hovered by the mouse.

Parameters

  on_change | is called when the mouse enter or leave the component.

### Example

auto button = Button("exit", screen.ExitLoopClosure());
bool hovered = false;
button |= Hoverable([&](bool hover) { hovered = hover;});

Definition at line 209 of file hoverable.cpp.

## ◆ Input() [1/3]

Component Input | ( | InputOption | option | ) |

An input box for editing text.

Parameters

  option | Additional optional parameters.

See also
  InputBase

### Example

auto screen = ScreenInteractive::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input({
.content = &content,
.placeholder = &placeholder,
})
screen.Loop(input);
ftxui::Input
Component Input(InputOption options={})
An input box for editing text.
Definition src/ftxui/component/input.cpp:571

### Output

placeholder

Definition at line 571 of file src/ftxui/component/input.cpp.

## ◆ Input() [2/3]

Component Input | ( | StringRef | content,
|  | InputOption | option )

An input box for editing text.

Parameters

  content | The editable content.
  option | Additional optional parameters.

See also
  InputBase

### Example

auto screen = ScreenInteractive::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input(content, {
.placeholder = &placeholder,
.password = true,
})
screen.Loop(input);

### Output

placeholder

Definition at line 599 of file src/ftxui/component/input.cpp.

## ◆ Input() [3/3]

Component Input | ( | StringRef | content,
|  | StringRef | placeholder,
|  | InputOption | option )

An input box for editing text.

Parameters

  content | The editable content.
  placeholder | The placeholder text.
  option | Additional optional parameters.

See also
  InputBase

### Example

auto screen = ScreenInteractive::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input(content, placeholder);
screen.Loop(input);

### Output

placeholder

Definition at line 626 of file src/ftxui/component/input.cpp.

## ◆ Maybe() [1/4]

Component Maybe | ( | Component | child,
|  | std::function< bool()> | show )

Decorate a component |child|. It is shown only when |show| returns true.

Parameters

  child | the component to decorate.
  show | a function returning whether |child| should shown.

Definition at line 21 of file src/ftxui/component/maybe.cpp.

## ◆ Maybe() [2/4]

ComponentDecorator Maybe | ( | std::function< bool()> | show | ) |

Decorate a component. It is shown only when the |show| function returns true.

Parameters

  show | a function returning whether the decorated component should be shown.

### Example

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = component | Maybe([&]{ return counter == 42; });
ftxui::Maybe
Component Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true.
Definition src/ftxui/component/maybe.cpp:74

Definition at line 57 of file src/ftxui/component/maybe.cpp.

## ◆ Maybe() [3/4]

Component Maybe | ( | Component | child,
|  | const bool * | show )

Decorate a component |child|. It is shown only when |show| is true.

Parameters

  child | the component to decorate.
  show | a boolean. |child| is shown when |show| is true.

### Example

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = Maybe(component, &show);

Definition at line 74 of file src/ftxui/component/maybe.cpp.

## ◆ Maybe() [4/4]

ComponentDecorator Maybe | ( | const bool * | show | ) |

Decorate a component. It is shown only when |show| is true.

Parameters

  show | a boolean. |child| is shown when |show| is true.

### Example

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = component | Maybe(&show);

Definition at line 88 of file src/ftxui/component/maybe.cpp.

## ◆ Menu() [1/2]

Component Menu | ( | MenuOption | option | ) |

A list of text. The focused element is selected.

Parameters

  option | a structure containing all the paramters.

### Example

auto screen = ScreenInteractive::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Menu({
.entries = &entries,
.selected = &selected,
});
screen.Loop(menu);
ftxui::Menu
Component Menu(MenuOption options)
A list of text. The focused element is selected.
Definition src/ftxui/component/menu.cpp:512

### Output

> entry 1
entry 2
entry 3

Definition at line 512 of file src/ftxui/component/menu.cpp.

## ◆ Menu() [2/2]

Component Menu | ( | ConstStringListRef | entries,
|  | int * | selected,
|  | MenuOption | option )

A list of text. The focused element is selected.

Parameters

  entries | The list of entries in the menu.
  selected | The index of the currently selected element.
  option | Additional optional parameters.

### Example

auto screen = ScreenInteractive::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Menu(&entries, &selected);
screen.Loop(menu);

### Output

> entry 1
entry 2
entry 3

Definition at line 543 of file src/ftxui/component/menu.cpp.

## ◆ Toggle()

Component Toggle | ( | ConstStringListRef | entries,
|  | int * | selected )

An horizontal list of elements. The user can navigate through them.

Parameters

  entries | The list of selectable entries to display.
  selected | Reference the selected entry. See also |Menu|.

Definition at line 554 of file src/ftxui/component/menu.cpp.

## ◆ MenuEntry() [1/2]

Component MenuEntry | ( | ConstStringRef | label,
|  | MenuEntryOption | option )

A specific menu entry. They can be put into a Container::Vertical to form a menu.

Parameters

  label | The text drawn representing this element.
  option | Additional optional parameters.

### Example

auto screen = ScreenInteractive::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical({
MenuEntry("entry 1"),
MenuEntry("entry 2"),
MenuEntry("entry 3"),
}, &selected);
screen.Loop(menu);
ftxui::MenuEntry
Component MenuEntry(MenuEntryOption options)
A specific menu entry. They can be put into a Container::Vertical to form a menu.
Definition src/ftxui/component/menu.cpp:614

### Output

> entry 1
entry 2
entry 3

Definition at line 584 of file src/ftxui/component/menu.cpp.

## ◆ MenuEntry() [2/2]

Component MenuEntry | ( | MenuEntryOption | option | ) |

A specific menu entry. They can be put into a Container::Vertical to form a menu.

Parameters

  option | The parameters.

### Example

auto screen = ScreenInteractive::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical({
MenuEntry({.label = "entry 1"}),
MenuEntry({.label = "entry 2"}),
MenuEntry({.label = "entry 3"}),
}, &selected);
screen.Loop(menu);

### Output

> entry 1
entry 2
entry 3

Definition at line 614 of file src/ftxui/component/menu.cpp.

## ◆ Modal() [1/2]

Component Modal | ( | Component | main,
|  | Component | modal,
|  | const bool * | show_modal )

Definition at line 18 of file modal.cpp.

## ◆ Modal() [2/2]

ComponentDecorator Modal | ( | Component | modal,
|  | const bool * | show_modal )

Definition at line 58 of file modal.cpp.

## ◆ Radiobox() [1/2]

Component Radiobox | ( | RadioboxOption | option | ) |

A list of element, where only one can be selected.

Parameters

  option | The parameters

See also
  RadioboxBase

### Example

auto screen = ScreenInteractive::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Radiobox({
.entries = entries,
.selected = &selected,
});
screen.Loop(menu);
ftxui::Radiobox
Component Radiobox(RadioboxOption options)
A list of element, where only one can be selected.
Definition src/ftxui/component/radiobox.cpp:204

### Output

◉ entry 1
○ entry 2
○ entry 3

NOLINTNEXTLINE

Definition at line 204 of file src/ftxui/component/radiobox.cpp.

## ◆ Radiobox() [2/2]

Component Radiobox | ( | ConstStringListRef | entries,
|  | int * | selected,
|  | RadioboxOption | option )

A list of element, where only one can be selected.

Parameters

  entries | The list of entries in the list.
  selected | The index of the currently selected element.
  option | Additional optional parameters.

See also
  RadioboxBase

### Example

auto screen = ScreenInteractive::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Radiobox(&entries, &selected);
screen.Loop(menu);

### Output

◉ entry 1
○ entry 2
○ entry 3

Definition at line 236 of file src/ftxui/component/radiobox.cpp.

## ◆ Renderer() [1/4]

Component Renderer | ( | std::function< Element()> | render | ) |

Return a component, using |render| to render its interface.

Parameters

  render | The function drawing the interface.

### Example

auto screen = ScreenInteractive::TerminalOutput();
auto renderer = Renderer([] {
return text("My interface");
});
screen.Loop(renderer);

Definition at line 29 of file src/ftxui/component/renderer.cpp.

## ◆ Renderer() [2/4]

Component Renderer | ( | Component | child,
|  | std::function< Element()> | render )

Return a new Component, similar to |child|, but using |render| as the Component::Render() event.

Parameters

  child | The component to forward events to.
  render | The function drawing the interface.

### Example

auto screen = ScreenInteractive::TerminalOutput();
std::string label = "Click to quit";
auto button = Button(&label, screen.ExitLoopClosure());
auto renderer = Renderer(button, [&] {
return hbox({
text("A button:"),
button->Render(),
});
});
screen.Loop(renderer);
ftxui::Node::Render
virtual void Render(Screen &screen)
Display an element on a ftxui::Screen.
Definition node.cpp:59
ftxui::hbox
Element hbox(Elements)
A container displaying elements horizontally one by one.
Definition hbox.cpp:94

Definition at line 61 of file src/ftxui/component/renderer.cpp.

## ◆ Renderer() [3/4]

Component Renderer | ( | std::function< Element(bool)> | render | ) |

Return a focusable component, using |render| to render its interface.

Parameters

  render | The function drawing the interface, taking a boolean telling whether the component is focused or not.

### Example

auto screen = ScreenInteractive::TerminalOutput();
auto renderer = Renderer([] (bool focused) {
if (focused)
return text("My interface") | inverted;
else
return text("My interface");
});
screen.Loop(renderer);
ftxui::inverted
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
Definition inverted.cpp:34

Definition at line 84 of file src/ftxui/component/renderer.cpp.

## ◆ Renderer() [4/4]

ComponentDecorator Renderer | ( | ElementDecorator | decorator | ) |

Decorate a component, by decorating what it renders.

Parameters

  decorator | the function modifying the element it renders.

### Example

auto screen = ScreenInteractive::TerminalOutput();
auto renderer = */
// Renderer([] { return text("Hello");)
/** | Renderer(bold)
| Renderer(inverted);
screen.Loop(renderer);

Definition at line 125 of file src/ftxui/component/renderer.cpp.

## ◆ ResizableSplitLeft()

Component ResizableSplitLeft | ( | Component | main,
|  | Component | back,
|  | int * | main_size )

An horizontal split in between two components, configurable using the mouse.

Parameters

  main | The main component of size |main_size|, on the left.
  back | The back component taking the remaining size, on the right.
  main_size | The size of the |main| component.

### Example

auto screen = ScreenInteractive::Fullscreen();
int left_size = 10;
auto left = Renderer([] { return text("Left") | center;});
auto right = Renderer([] { return text("right") | center;});
auto split = ResizableSplitLeft(left, right, &left_size);
screen.Loop(split);
ftxui::ScreenInteractive::Fullscreen
static ScreenInteractive Fullscreen()
Definition screen_interactive.cpp:376
ftxui::ResizableSplitLeft
Component ResizableSplitLeft(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:215
ftxui::center
Element center(Element)
Center an element horizontally and vertically.
Definition composite_decorator.cpp:31
left
std::uint8_t left
Definition screen.cpp:129
right
std::uint8_t right
Definition screen.cpp:131

### Output

│
left │ right
│

Definition at line 215 of file src/ftxui/component/resizable_split.cpp.

## ◆ ResizableSplitRight()

Component ResizableSplitRight | ( | Component | main,
|  | Component | back,
|  | int * | main_size )

An horizontal split in between two components, configurable using the mouse.

Parameters

  main | The main component of size |main_size|, on the right.
  back | The back component taking the remaining size, on the left.
  main_size | The size of the |main| component.

### Example

auto screen = ScreenInteractive::Fullscreen();
int right_size = 10;
auto left = Renderer([] { return text("Left") | center;});
auto right = Renderer([] { return text("right") | center;});
auto split = ResizableSplitRight(right, left, &right_size)
screen.Loop(split);
ftxui::ResizableSplitRight
Component ResizableSplitRight(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:249

### Output

│
left │ right
│

Definition at line 249 of file src/ftxui/component/resizable_split.cpp.

## ◆ ResizableSplitTop()

Component ResizableSplitTop | ( | Component | main,
|  | Component | back,
|  | int * | main_size )

An vertical split in between two components, configurable using the mouse.

Parameters

  main | The main component of size |main_size|, on the top.
  back | The back component taking the remaining size, on the bottom.
  main_size | The size of the |main| component.

### Example

auto screen = ScreenInteractive::Fullscreen();
int top_size = 1;
auto top = Renderer([] { return text("Top") | center;});
auto bottom = Renderer([] { return text("Bottom") | center;});
auto split = ResizableSplitTop(top, bottom, &top_size)
screen.Loop(split);
ftxui::ResizableSplitTop
Component ResizableSplitTop(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:283
top
std::uint8_t top
Definition screen.cpp:130

### Output

top
────────────
bottom

Definition at line 283 of file src/ftxui/component/resizable_split.cpp.

## ◆ ResizableSplitBottom()

Component ResizableSplitBottom | ( | Component | main,
|  | Component | back,
|  | int * | main_size )

An vertical split in between two components, configurable using the mouse.

Parameters

  main | The main component of size |main_size|, on the bottom.
  back | The back component taking the remaining size, on the top.
  main_size | The size of the |main| component.

### Example

auto screen = ScreenInteractive::Fullscreen();
int bottom_size = 1;
auto top = Renderer([] { return text("Top") | center;});
auto bottom = Renderer([] { return text("Bottom") | center;});
auto split = ResizableSplit::Bottom(bottom, top, &bottom_size)
screen.Loop(split);

### Output

top
────────────
bottom

Definition at line 317 of file src/ftxui/component/resizable_split.cpp.

## ◆ Slider()

Component Slider | ( | ConstStringRef | label,
|  | Ref< int > | value,
|  | ConstRef< int > | min,
|  | ConstRef< int > | max,
|  | ConstRef< int > | increment )

An horizontal slider.

Parameters

  label | The name of the slider.
  value | The current value of the slider.
  min | The minimum value.
  max | The maximum value.
  increment | The increment when used by the cursor.

### Example

auto screen = ScreenInteractive::TerminalOutput();
int value = 50;
auto slider = Slider("Value:", &value, 0, 100, 1);
screen.Loop(slider);
ftxui::Slider
Component Slider(SliderOption< T > options)
A slider in any direction.
Definition src/ftxui/component/slider.cpp:346

### Output

Value:[██████████████████████████ ]

Definition at line 289 of file src/ftxui/component/slider.cpp.

## ◆ Window()

Component Window | ( | WindowOptions | option | ) |

A draggeable / resizeable window. To use multiple of them, they must be stacked using `Container::Stacked({...})` component;.

Parameters

  option | A struct holding every parameters.

See also
  Window

### Example

auto window_1= Window({
.inner = DummyWindowContent(),
.title = "First window",
});
auto window_2= Window({
.inner = DummyWindowContent(),
.title = "Second window",
});
auto container = Container::Stacked({
window_1,
window_2,
});
ftxui::Window
Component Window(WindowOptions option)
A draggeable / resizeable window. To use multiple of them, they must be stacked using Container::Stac...
Definition src/ftxui/component/window.cpp:312
DummyWindowContent
Component DummyWindowContent()
Definition scrollbar.cpp:10

Definition at line 312 of file src/ftxui/component/window.cpp.