#include <memory>
#include <string>
#include <vector>
std::vector<std::string> toggle_1_entries = {
"On",
"Off",
};
std::vector<std::string> toggle_2_entries = {
"Enabled",
"Disabled",
};
std::vector<std::string> toggle_3_entries = {
"10€",
"0€",
};
std::vector<std::string> toggle_4_entries = {
"Nothing",
"One element",
"Several elements",
};
int toggle_1_selected = 0;
int toggle_2_selected = 0;
int toggle_3_selected = 0;
int toggle_4_selected = 0;
Component toggle_1 = Toggle(&toggle_1_entries, &toggle_1_selected);
Component toggle_2 = Toggle(&toggle_2_entries, &toggle_2_selected);
Component toggle_3 = Toggle(&toggle_3_entries, &toggle_3_selected);
Component toggle_4 = Toggle(&toggle_4_entries, &toggle_4_selected);
auto container = Container::Vertical({
toggle_1,
toggle_2,
toggle_3,
toggle_4,
});
auto renderer = Renderer(container, [&] {
text("Elige tus opciones:"),
text(""),
hbox(text(
" * Apagar al inicio : "), toggle_1->Render()),
hbox(text(
" * Fuera de proceso : "), toggle_2->Render()),
hbox(text(
" * Precio de la información : "), toggle_3->Render()),
hbox(text(
" * Número de elementos : "), toggle_4->Render()),
});
});
auto screen = ScreenInteractive::TerminalOutput();
}
Element vbox(Elements children)
Un contenedor que muestra elementos verticalmente uno por uno.
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< ComponentBase > Component