FTXUI 6.1.9
C++ functional terminal UI.
Chargement...
Recherche...
Aucune correspondance
examples/component/window.cpp
// Copyright 2023 Arthur Sonzogni. Tous droits réservés.
// L'utilisation de ce code source est régie par la licence MIT qui peut être trouvée
// dans le fichier LICENSE.
#include <string>
using namespace ftxui;
class Impl : public ComponentBase {
private:
bool checked[3] = {false, false, false};
float slider = 50;
public:
Impl() {
Add(Container::Vertical({
Checkbox("Cochez-moi", &checked[0]),
Checkbox("Cochez-moi", &checked[1]),
Checkbox("Cochez-moi", &checked[2]),
Slider("Curseur", &slider, 0.f, 100.f),
}));
}
};
return Make<Impl>();
}
int main() {
int window_1_left = 20;
int window_1_top = 10;
int window_1_width = 40;
int window_1_height = 20;
auto window_1 = Window({
.inner = DummyWindowContent(),
.title = "Première fenêtre",
.left = &window_1_left,
.top = &window_1_top,
.width = &window_1_width,
.height = &window_1_height,
});
auto window_2 = Window({
.inner = DummyWindowContent(),
.title = "Ma fenêtre",
.left = 40,
.top = 20,
});
auto window_3 = Window({
.inner = DummyWindowContent(),
.title = "Ma fenêtre",
.left = 60,
.top = 30,
});
auto window_4 = Window({
.inner = DummyWindowContent(),
});
auto window_5 = Window({});
auto window_container = Container::Stacked({
window_1,
window_2,
window_3,
window_4,
window_5,
});
auto display_win_1 = Renderer([&] {
return text("window_1: " + //
std::to_string(window_1_width) + "x" +
std::to_string(window_1_height) + " + " +
std::to_string(window_1_left) + "," +
std::to_string(window_1_top));
});
auto layout = Container::Vertical({
display_win_1,
window_container,
});
auto screen = ScreenInteractive::Fullscreen();
screen.Loop(layout);
return EXIT_SUCCESS;
}
auto screen
Il implémente son propre rendu en tant que ftxui::Element. Il implémente la navigation au clavier en ...
Component Window(std::string title, Component component)
L'espace de noms FTXUI ftxui::
Definition animation.hpp:10
std::shared_ptr< ComponentBase > Component
Component DummyWindowContent()
Definition scrollbar.cpp:10