82 if (!state.focused && !state.active) {
97 option.underline.enabled =
true;
107 Element e =
text((state.active ?
"> " :
" ") + state.label);
114 if (!state.focused && !state.active) {
127 option.entries_option.transform = [](
const EntryState& state) {
135 if (!state.focused && !state.active) {
140 option.underline.enabled =
true;
149 option.elements_infix = [] {
return text(
"│") |
automerge; };
158 const std::string t = s.focused ?
"[" + s.label +
"]"
159 :
" " + s.label +
" ";
229 Color background_active,
230 Color foreground_active) {
250 ?
text(s.state ?
"[X] " :
"[ ] ")
251 :
text(s.state ?
"▣ " :
"☐ ");
252 auto t =
text(s.label);
259 return hbox({prefix, t});
270 ?
text(s.state ?
"(*) " :
"( ) ")
271 :
text(s.state ?
"◉ " :
"○ ");
272 auto t =
text(s.label);
279 return hbox({prefix, t});
289 if (state.is_placeholder) {
290 state.element |=
dim;
295 }
else if (state.hovered) {
299 return state.element;
311 if (state.is_placeholder) {
312 state.element |=
dim;
317 }
else if (state.hovered) {
318 state.element |=
bold;
321 return state.element;
static ButtonOption Animated()
Create a ButtonOption, using animated colors.
static MenuOption Toggle()
Standard options for a horizontal menu with some separator. This can be useful to implement a tab bar...
animation::Duration follower_duration
animation::easing::Function leader_function
MenuEntryOption entries_option
static InputOption Default()
Create the default input style:
animation::easing::Function function
static ButtonOption Border()
Create a ButtonOption. The button is shown using a border, inverted when focused. This is the current...
void SetAnimationFunction(animation::easing::Function f)
Set how the underline should animate.
static InputOption Spacious()
A white on black style with high margins:
static CheckboxOption Simple()
Option for standard Checkbox.
static ButtonOption Simple()
Create a ButtonOption, inverted when focused.
std::function< Element(const EntryState &state)> transform
static MenuOption Horizontal()
Standard options for a horizontal menu. This can be useful to implement a tab bar.
static MenuOption VerticalAnimated()
Standard options for an animated vertical menu. This can be useful to implement a list of selectable ...
animation::Duration leader_duration
static MenuOption Vertical()
Standard options for a vertical menu. This can be useful to implement a list of selectable items.
static ButtonOption Ascii()
Create a ButtonOption, highlighted using [] characters.
animation::Duration duration
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.
animation::easing::Function follower_function
std::function< Element(InputState)> transform
std::function< Element()> elements_infix
AnimatedColorsOption animated_colors
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.
static MenuOption HorizontalAnimated()
Standard options for an animated horizontal menu. This can be useful to implement a tab bar.
static RadioboxOption Simple()
Option for standard Radiobox.
std::function< Element(const EntryState &)> transform
Option for the Checkbox component.
Option for the Radiobox component.
Element text(std::wstring_view text)
Display a piece of unicode text.
Element bold(Element)
Use a bold font, for elements with more emphasis.
Element underlined(Element)
Underline the given element.
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
Element borderLight(Element)
Draw a light border around the element.
Element dim(Element)
Use a light font, for elements with less emphasis.
Element automerge(Element child)
Enable character to be automatically merged with others nearby.
Element border(Element)
Draw a border around the element.
Element borderEmpty(Element)
Draw an empty border around the element.
bool component_ascii
Whether the terminal should use ASCII characters for components.
static Color Interpolate(float t, const Color &a, const Color &b)
Color is a class that represents a color in the terminal user interface.
Quirks GetQuirks()
Get the terminal quirks.
std::function< float(float)> Function
std::chrono::duration< float > Duration
The FTXUI ftxui:: namespace.
std::shared_ptr< Node > Element
Element hbox(Elements)
A container displaying elements horizontally one by one.
AnimatedColorOption foreground
AnimatedColorOption background
arguments for transform from |ButtonOption|, |CheckboxOption|, |RadioboxOption|, |MenuEntryOption|,...