1#ifndef FTXUI_COMPONENT_HPP
2#define FTXUI_COMPONENT_HPP
22struct MenuEntryOption;
24template <
class T,
class... Args>
25std::shared_ptr<T>
Make(Args&&... args) {
26 return std::make_shared<T>(std::forward<Args>(args)...);
47 std::function<
void()> on_click,
67 Ref<RadioboxOption> option = {});
77 ConstRef<int> min = 0,
78 ConstRef<int> max = 100,
79 ConstRef<int> increment = 5);
82 ConstRef<float> min = 0.f,
83 ConstRef<float> max = 100.f,
84 ConstRef<float> increment = 5.f);
87 ConstRef<long> min = 0l,
88 ConstRef<long> max = 100l,
89 ConstRef<long> increment = 5l);
118 std::function<
void()> on_enter,
119 std::function<
void()> on_leave);
121 std::function<
void(
bool)> on_change);
124 std::function<
void()> on_leave);
An adapter. Own or reference a constant string. For convenience, this class convert multiple immutabl...
An adapter. Own or reference an mutable object.
An adapter. Own or reference a constant string. For convenience, this class convert multiple mutable ...
Component Horizontal(Components children)
A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow...
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
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...
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.
Component Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true. @params child the compoennt to de...
Component ResizableSplitTop(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< Node > Element
std::function< Element(Element)> ElementDecorator
Component Input(StringRef content, ConstStringRef placeholder, Ref< InputOption > option={})
An input box for editing text.
Component Toggle(ConstStringListRef entries, int *selected)
An horizontal list of elements. The user can navigate through them.
std::vector< Component > Components
Component MenuEntry(ConstStringRef label, Ref< MenuEntryOption >={})
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)
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Component Hoverable(Component component, bool *hover)
Wrap a component. Gives the ability to know if it is hovered by the mouse.
Component operator|(Component component, ComponentDecorator decorator)
Component Button(ConstStringRef label, std::function< void()> on_click, Ref< ButtonOption >=ButtonOption::Simple())
Draw a button. Execute a function when clicked.
Component Menu(ConstStringListRef entries, int *selected_, Ref< MenuOption >=MenuOption::Vertical())
A list of text. The focused element is selected.
Component ResizableSplitRight(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Component Dropdown(ConstStringListRef entries, int *selected)
Component Slider(SliderOption< T > options={})
A slider in any direction.
Component ResizableSplitBottom(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
Component & operator|=(Component &component, ComponentDecorator decorator)
Component ResizableSplitLeft(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
std::function< Component(Component)> ComponentDecorator
std::shared_ptr< ComponentBase > Component
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)
Component CatchEvent(Component child, std::function< bool(Event)>)
static CheckboxOption Simple()
Option for standard Checkbox.
Represent an event. It can be key press event, a terminal resize, or more ...