FTXUI
6.1.9
C++ functional terminal UI.
Chargement...
Recherche...
Aucune correspondance
examples/component/menu.cpp
Aller à la documentation de ce fichier.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
#include <functional>
// for function
5
#include <iostream>
// for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
6
#include <string>
// for string, basic_string, allocator
7
#include <vector>
// for vector
8
9
#include "
ftxui/component/captured_mouse.hpp
"
// for ftxui
10
#include "
ftxui/component/component.hpp
"
// for Menu
11
#include "
ftxui/component/component_options.hpp
"
// for MenuOption
12
#include "
ftxui/component/screen_interactive.hpp
"
// for ScreenInteractive
13
14
int
main
() {
15
using namespace
ftxui
;
16
auto
screen
= ScreenInteractive::TerminalOutput();
17
18
std::vector<std::string> entries = {
19
"entry 1"
,
20
"entry 2"
,
21
"entry 3"
,
22
};
23
int
selected = 0;
24
25
MenuOption
option;
26
option.
on_enter
=
screen
.ExitLoopClosure();
27
auto
menu = Menu(&entries, &selected, option);
28
29
screen
.Loop(menu);
30
31
std::cout <<
"Selected element = "
<< selected << std::endl;
32
}
captured_mouse.hpp
component.hpp
component_options.hpp
screen
auto screen
Definition
composition.cpp:56
main
int main()
Definition
examples/component/button.cpp:33
ftxui::MenuOption::on_enter
std::function< void()> on_enter
Definition
component_options.hpp:109
ftxui::MenuOption
Option pour le composant Menu.
Definition
component_options.hpp:88
ftxui
L'espace de noms FTXUI ftxui::
Definition
animation.hpp:10
screen_interactive.hpp