18 : entries_(entries), selected_(selected) {
21 auto prefix =
text(s.state ?
"↓ " :
"→ ");
22 auto t =
text(s.label);
29 return hbox({prefix, t});
31 checkbox_ =
Checkbox(&title_, &show_, option),
32 radiobox_ =
Radiobox(entries_, selected_);
34 Add(Container::Vertical({
36 Maybe(radiobox_, &show_),
41 *selected_ = std::min((
int)entries_.size() - 1, std::max(0, *selected_));
42 title_ = entries_[*selected_];
44 const int max_height = 12;
55 checkbox_->Render() |
border,
It implement rendering itself as ftxui::Element. It implement keyboard navigation by responding to ft...
An adapter. Reference a list of strings.
Component Checkbox(ConstStringRef label, bool *checked, Ref< CheckboxOption > option=CheckboxOption::Simple())
Draw checkable element.
Component Radiobox(ConstStringListRef entries, int *selected_, Ref< RadioboxOption > option={})
A list of element, where only one can be selected.
Element vscroll_indicator(Element)
Add a filter that will invert the foreground and the background colors.
Component Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true. @params child the compoennt to de...
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< Node > Element
Element bold(Element)
Use a bold font, for elements with more emphasis.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
Element text(std::wstring text)
Display a piece of unicode text.
Component Dropdown(ConstStringListRef entries, int *selected)
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element filler()
An element that will take expand proportionnally to the space left in a container.
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Decorator size(Direction, Constraint, int value)
Apply a constraint on the size of an element.
Element border(Element)
Draw a border around the element.
std::shared_ptr< ComponentBase > Component
Element vbox(Elements)
A container displaying elements vertically one by one.
arguments for |ButtonOption::transform|, |CheckboxOption::transform|, |Radiobox::transform|,...
Option for the Checkbox component.
std::function< Element(const EntryState &)> transform