menu_in_frame
#include <memory>
#include <string>
#include <vector>
std::vector<std::string> entries;
int selected = 0;
for (int i = 0; i < 30; ++i)
entries.push_back("Entry " + std::to_string(i));
auto radiobox = Menu(&entries, &selected);
auto renderer = Renderer(radiobox, [&] {
return radiobox->Render() | vscroll_indicator | frame |
size(HEIGHT, LESS_THAN, 10) | border;
});
auto screen = ScreenInteractive::FitComponent();
screen.Loop(renderer);
return 0;
}
#include <iostream>
#include <memory>
#include <string>
return option;
}
auto screen = ScreenInteractive::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical(
{
MenuEntry(
" 1. rear",
Colored(Color::Red)),
MenuEntry(
" 2. drown",
Colored(Color::Yellow)),
MenuEntry(
" 3. nail",
Colored(Color::Green)),
MenuEntry(
" 4. quit",
Colored(Color::Cyan)),
MenuEntry(
" 5. decorative",
Colored(Color::Blue)),
MenuEntry(" 7. costume"),
MenuEntry(" 8. pick"),
MenuEntry(" 9. oral"),
MenuEntry("11. minister"),
MenuEntry("12. football"),
MenuEntry("13. welcome"),
MenuEntry("14. copper"),
MenuEntry("15. inhabitant"),
},
&selected);
}) |
});
screen.Loop(renderer);
std::cout << "Selected element = " << selected << std::endl;
}
A class representing terminal colors.
Decorator bgcolor(Color)
Decorate using a background color.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element hbox(Elements)
A container displaying elements horizontally one by one.
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 frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Element vbox(Elements)
A container displaying elements vertically one by one.
AnimatedColorOption foreground
AnimatedColorOption background