#include <functional>
#include <iostream>
#include <memory>
#include <string>
state.label = (state.active ? "> " : " ") + state.label;
Element e = text(state.label) | color(c);
if (state.focused) {
e = e | inverted;
}
if (state.active) {
e = e | bold;
}
return e;
};
return option;
}
auto screen = ScreenInteractive::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical(
{
MenuEntry(" 1. improve"),
MenuEntry(" 2. tolerant"),
MenuEntry(" 3. career"),
MenuEntry(" 4. cast"),
MenuEntry(" 5. question"),
Renderer([] { return separator(); }),
MenuEntry(
" 6. rear",
Colored(Color::Red)),
MenuEntry(
" 7. drown",
Colored(Color::Yellow)),
MenuEntry(
" 8. nail",
Colored(Color::Green)),
MenuEntry(
" 9. quit",
Colored(Color::Cyan)),
MenuEntry(
"10. decorative",
Colored(Color::Blue)),
Renderer([] { return separator(); }),
MenuEntry("11. costume"),
MenuEntry("12. pick"),
MenuEntry("13. oral"),
MenuEntry("14. minister"),
MenuEntry("15. football"),
MenuEntry("16. welcome"),
MenuEntry("17. copper"),
MenuEntry("18. inhabitant"),
MenuEntry("19. fortune"),
},
&selected);
auto renderer = Renderer(menu, [&] {
hbox(text(
"selected = "), text(std::to_string(selected))),
separator(),
menu->Render() | frame |
size(HEIGHT, LESS_THAN, 10),
}) |
border;
});
std::cout << "Selected element = " << selected << std::endl;
}
std::function< Element(const EntryState &state)> transform
Element vbox(Elements children)
Un contenedor que muestra elementos verticalmente uno por uno.
Color es una clase que representa un color en la interfaz de usuario de la terminal.
return dimx size(HEIGHT, EQUAL, dimy)
return hbox({ text(std::to_string(int(progress *100))+"% ")|size(WIDTH, EQUAL, 5), gauge(progress), })
El espacio de nombres ftxui:: de FTXUI.
std::shared_ptr< Node > Element
Argumentos para la transformación de |ButtonOption|, |CheckboxOption|, |RadioboxOption|,...