#include <chrono>
#include <memory>
#include <string>
#include <vector>
if (focused)
return t;
});
}
}
int main() {
using namespace std::literals;
std::vector<std::string> tab_values{
"Tab 1", "Tab 2", "Tab 3", "A very very long tab", "탭",
};
int tab_selected = 0;
int frame_count = 0;
{
container->Add(Text("This demonstrate the Menu component"));
container->Add(
Menu(&tab_values, &tab_selected, option));
}
{
container->Add(Text("Set underline color to blue"));
container->Add(
Menu(&tab_values, &tab_selected, option));
}
{
container->Add(Text("Set underline active color to red"));
container->Add(
Menu(&tab_values, &tab_selected, option));
}
{
container->Add(Text("Set animation duration to 0ms"));
option.underline.SetAnimationDuration(0ms);
container->Add(
Menu(&tab_values, &tab_selected, option));
}
{
container->Add(Text("Set animation easing function to back-out"));
option.underline.SetAnimationDuration(350ms);
container->Add(
Menu(&tab_values, &tab_selected, option));
}
{
container->Add(Text("Add delay to desynchronize animation"));
option.underline.follower_delay = 250ms;
container->Add(
Menu(&tab_values, &tab_selected, option));
}
container->SetActiveChild(container->ChildAt(2));
screen.Loop(container);
}
static ScreenInteractive TerminalOutput()
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Component Menu(MenuOption options)
A list of text. The focused element is selected.
std::shared_ptr< ComponentBase > Component
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
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 borderEmpty(Element)
Draw an empty border around the element.