FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
examples/component/checkbox.cpp
Go to the documentation of this file.
1// Copyright 2021 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 <array> // for array
5#include <iostream>
6#include <memory> // for shared_ptr, __shared_ptr_access
7#include <string> // for operator+, to_string
8
9#include "ftxui/component/captured_mouse.hpp" // for ftxui
10#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical
11#include "ftxui/component/component_base.hpp" // for ComponentBase
12#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
13#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
14
15using namespace ftxui;
16
17int main() {
18 bool download = false;
19 bool upload = false;
20 bool ping = false;
21
22 auto container = Container::Vertical({
23 Checkbox("Download", &download),
24 Checkbox("Upload", &upload),
25 Checkbox("Ping", &ping),
26 });
27
28 auto screen = ScreenInteractive::FitComponent();
29 screen.Loop(container);
30
31 std::cout << "---" << std::endl;
32 std::cout << "Download: " << download << std::endl;
33 std::cout << "Upload: " << upload << std::endl;
34 std::cout << "Ping: " << ping << std::endl;
35 std::cout << "---" << std::endl;
36
37 return 0;
38}
static ScreenInteractive FitComponent()
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Component Checkbox(CheckboxOption options)
Draw checkable element.
The FTXUI ftxui:: namespace.
Definition animation.hpp:10