4 #ifndef FTXUI_COMPONENT_HPP
5 #define FTXUI_COMPONENT_HPP
18 struct CheckboxOption;
22 struct RadioboxOption;
23 struct MenuEntryOption;
25 template <
class T,
class... Args>
26 std::shared_ptr<T>
Make(Args&&... args) {
27 return std::make_shared<T>(std::forward<Args>(args)...);
49 std::function<
void()> on_click,
60 StringRef placeholder,
61 InputOption options = {});
73 RadioboxOption options = {});
87 ConstRef<int> min = 0,
88 ConstRef<int> max = 100,
89 ConstRef<int> increment = 5);
92 ConstRef<float> min = 0.f,
93 ConstRef<float> max = 100.f,
94 ConstRef<float> increment = 5.f);
97 ConstRef<long> min = 0L,
98 ConstRef<long> max = 100L,
99 ConstRef<long> increment = 5L);
129 std::function<
void()> on_enter,
130 std::function<
void()> on_leave);
132 std::function<
void(
bool)> on_change);
135 std::function<
void()> on_leave);
An adapter. Own or reference a constant string. For convenience, this class convert multiple immutabl...
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 Stacked(Components children)
A list of components to be stacked on top of each other. Events are propagated to the first component...
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 Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true.
Component ResizableSplitTop(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
std::shared_ptr< Node > Element
Component Menu(MenuOption options)
A list of text. The focused element is selected.
Component MenuEntry(MenuEntryOption options)
A specific menu entry. They can be put into a Container::Vertical to form a menu.
std::function< Element(Element)> ElementDecorator
std::shared_ptr< ComponentBase > Component
Component Toggle(ConstStringListRef entries, int *selected)
An horizontal list of elements. The user can navigate through them.
std::vector< Component > Components
Component Radiobox(RadioboxOption options)
A list of element, where only one can be selected.
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
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.
std::shared_ptr< T > Make(Args &&... args)
Component ResizableSplit(ResizableSplitOption options)
A split in between two components.
Component Window(WindowOptions option)
A draggeable / resizeable window. To use multiple of them, they must be stacked using Container::Stac...
Component operator|(Component component, ComponentDecorator decorator)
Component Input(InputOption options={})
An input box for editing text.
Component ResizableSplitRight(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Component CatchEvent(Component child, std::function< bool(Event)>)
Component Dropdown(ConstStringListRef entries, int *selected)
A dropdown menu.
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 Checkbox(CheckboxOption options)
Draw checkable element.
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
Option for the Checkbox component.
static CheckboxOption Simple()
Option for standard Checkbox.
Represent an event. It can be key press event, a terminal resize, or more ...