2020-03-22 22:32:44 +01:00
|
|
|
#include "ftxui/component/menu.hpp"
|
|
|
|
|
|
2018-10-09 19:06:03 +02:00
|
|
|
#include <chrono>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
2019-01-06 17:10:35 +01:00
|
|
|
#include "ftxui/component/screen_interactive.hpp"
|
2018-10-09 19:06:03 +02:00
|
|
|
|
2019-01-06 17:10:35 +01:00
|
|
|
int main(int argc, const char* argv[]) {
|
2019-01-12 15:00:08 +01:00
|
|
|
using namespace ftxui;
|
2019-02-02 16:28:44 +01:00
|
|
|
auto screen = ScreenInteractive::TerminalOutput();
|
2019-01-12 18:24:46 +01:00
|
|
|
|
|
|
|
|
Menu menu;
|
2019-01-06 17:10:35 +01:00
|
|
|
menu.entries = {L"entry 1", L"entry 2", L"entry 3"};
|
2018-10-09 19:06:03 +02:00
|
|
|
menu.selected = 0;
|
|
|
|
|
menu.on_enter = screen.ExitLoopClosure();
|
|
|
|
|
|
2019-01-12 18:24:46 +01:00
|
|
|
screen.Loop(&menu);
|
|
|
|
|
|
|
|
|
|
std::cout << "Selected element = " << menu.selected << std::endl;
|
2018-10-09 19:06:03 +02:00
|
|
|
}
|
2020-09-06 13:46:56 +02: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.
|