FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
checkbox_in_frame.cpp
Go to the documentation of this file.
1// 版權所有 2020 Arthur Sonzogni. 保留所有權利。
2// 本原始碼的使用受 MIT 授權條款約束,該條款可在 LICENSE 檔案中找到。
3#include <array> // for array
4#include <memory> // for shared_ptr, __shared_ptr_access
5#include <string> // for operator+, to_string
6
7#include "ftxui/component/captured_mouse.hpp" // for ftxui
8#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical
9#include "ftxui/component/component_base.hpp" // for ComponentBase
10#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
11#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
12
13using namespace ftxui;
14
15int main() {
16 std::array<bool, 30> states;
17
18 auto container = Container::Vertical({});
19 for (int i = 0; i < 30; ++i) {
20 states[i] = false;
21 container->Add(Checkbox("Checkbox" + std::to_string(i), &states[i]));
22 }
23
24 auto renderer = Renderer(container, [&] {
25 return container->Render() | vscroll_indicator | frame |
27 });
28
29 auto screen = ScreenInteractive::FitComponent();
30 screen.Loop(renderer);
31
32 return 0;
33}
int main()
static ScreenInteractive FitComponent()
Component Checkbox(CheckboxOption options)
Component Renderer(Component child, std::function< Element()>)
回傳一個新的元件,類似於 |child|,但使用 |render| 作為 Component::Render() 事件。
Decorator size(WidthOrHeight, Constraint, int value)
限制元素的大小。
Element border(Element)
在元素周圍繪製邊框。
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10
@ LESS_THAN
Definition elements.hpp:159