2023-08-19 19:56:36 +08:00
|
|
|
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be found in
|
|
|
|
// the LICENSE file.
|
2021-10-16 05:04:11 +08:00
|
|
|
#include <string> // for basic_string, string, allocator
|
|
|
|
#include <vector> // for vector
|
2021-09-26 21:19:17 +08:00
|
|
|
|
2021-10-16 05:04:11 +08:00
|
|
|
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
|
|
|
#include "ftxui/component/component.hpp" // for Dropdown, Horizontal, Vertical
|
2021-09-26 21:19:17 +08:00
|
|
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
|
|
|
|
2023-06-03 19:59:39 +08:00
|
|
|
int main() {
|
2021-09-26 21:19:17 +08:00
|
|
|
using namespace ftxui;
|
|
|
|
|
|
|
|
std::vector<std::string> entries = {
|
2021-10-16 05:04:11 +08:00
|
|
|
"tribute", "clearance", "ally", "bend", "electronics",
|
|
|
|
"module", "era", "cultural", "sniff", "nationalism",
|
|
|
|
"negotiation", "deliver", "figure", "east", "tribute",
|
|
|
|
"clearance", "ally", "bend", "electronics", "module",
|
|
|
|
"era", "cultural", "sniff", "nationalism", "negotiation",
|
|
|
|
"deliver", "figure", "east", "tribute", "clearance",
|
|
|
|
"ally", "bend", "electronics", "module", "era",
|
|
|
|
"cultural", "sniff", "nationalism", "negotiation", "deliver",
|
|
|
|
"figure", "east",
|
2021-09-26 21:19:17 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
int selected_1 = 0;
|
|
|
|
int selected_2 = 0;
|
|
|
|
int selected_3 = 0;
|
|
|
|
int selected_4 = 0;
|
|
|
|
|
|
|
|
auto layout = Container::Vertical({
|
|
|
|
Container::Horizontal({
|
|
|
|
Dropdown(&entries, &selected_1),
|
|
|
|
Dropdown(&entries, &selected_2),
|
|
|
|
}),
|
|
|
|
Container::Horizontal({
|
|
|
|
Dropdown(&entries, &selected_3),
|
|
|
|
Dropdown(&entries, &selected_4),
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
|
|
|
auto screen = ScreenInteractive::FitComponent();
|
|
|
|
screen.Loop(layout);
|
|
|
|
}
|