#include <memory>
#include <string>
ButtonOption Style() {
option.transform = [](const EntryState& s) {
auto element =
text(s.label);
if (s.focused) {
}
};
return option;
}
int main() {
int value = 50;
auto btn_dec_01 =
Button(
"-1", [&] { value -= 1; }, Style());
auto btn_inc_01 =
Button(
"+1", [&] { value += 1; }, Style());
auto btn_dec_10 =
Button(
"-10", [&] { value -= 10; }, Style());
auto btn_inc_10 =
Button(
"+10", [&] { value += 10; }, Style());
int row = 0;
});
auto component =
Renderer(buttons, [&] {
buttons->Render() |
flex,
}) |
});
screen.Loop(component);
return 0;
}
static ScreenInteractive FitComponent()
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...
Element flex(Element)
Make a child element to expand proportionally to the space left in a container.
Element bold(Element)
Use a bold font, for elements with more emphasis.
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element center(Element)
Center an element horizontally and vertically.
std::string to_string(const std::wstring &s)
Convert a UTF8 std::string into a std::wstring.
Element text(std::wstring text)
Display a piece of unicode text.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element border(Element)
Draw a border around the element.
Element borderEmpty(Element)
Draw an empty border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.