FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
examples/component/dropdown.cpp
Go to the documentation of this file.
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 <string> // for basic_string, string, allocator
5#include <vector> // for vector
6
7#include "ftxui/component/captured_mouse.hpp" // for ftxui
8#include "ftxui/component/component.hpp" // for Dropdown, Horizontal, Vertical
9#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
10
11 int main() {
12 using namespace ftxui;
13
14 std::vector<std::string> entries = {
15 "tribute", "clearance", "ally", "bend", "electronics",
16 "module", "era", "cultural", "sniff", "nationalism",
17 "negotiation", "deliver", "figure", "east", "tribute",
18 "clearance", "ally", "bend", "electronics", "module",
19 "era", "cultural", "sniff", "nationalism", "negotiation",
20 "deliver", "figure", "east", "tribute", "clearance",
21 "ally", "bend", "electronics", "module", "era",
22 "cultural", "sniff", "nationalism", "negotiation", "deliver",
23 "figure", "east",
24 };
25
26 int selected_1 = 0;
27 int selected_2 = 0;
28 int selected_3 = 0;
29 int selected_4 = 0;
30
31 auto layout = Container::Vertical({
32 Container::Horizontal({
33 Dropdown(&entries, &selected_1),
34 Dropdown(&entries, &selected_2),
35 }),
36 Container::Horizontal({
37 Dropdown(&entries, &selected_3),
38 Dropdown(&entries, &selected_4),
39 }),
40 });
41
42 auto screen = ScreenInteractive::FitComponent();
43 screen.Loop(layout);
44}
captured_mouse.hpp
component.hpp
main
int main()
Definition examples/component/dropdown.cpp:11
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
screen_interactive.hpp