FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
radiobox_in_frame.cpp
Go to the documentation of this file.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// 本原始碼的使用受 MIT 授權條款約束,該條款可在 LICENSE 檔案中找到。
3
#include <memory>
// for shared_ptr, __shared_ptr_access
4
#include <string>
// for string, basic_string, operator+, to_string
5
#include <vector>
// for vector
6
7
#include "
ftxui/component/captured_mouse.hpp
"
// for ftxui
8
#include "
ftxui/component/component.hpp
"
// for Radiobox, Renderer
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, HEIGHT, LESS_THAN
12
13
using namespace
ftxui
;
14
15
int
main
() {
16
std::vector<std::string> entries;
17
int
selected = 0;
18
19
for
(
int
i = 0; i < 30; ++i) {
20
entries.push_back(
"RadioBox "
+ std::to_string(i));
21
}
22
auto
radiobox
=
Radiobox
(&entries, &selected);
23
auto
renderer =
Renderer
(
radiobox
, [&] {
24
return
radiobox
->Render() | vscroll_indicator | frame |
25
size
(
HEIGHT
,
LESS_THAN
, 10) |
border
;
26
});
27
28
auto
screen =
ScreenInteractive::FitComponent
();
29
screen.Loop(renderer);
30
31
return
0;
32
}
captured_mouse.hpp
component.hpp
component_base.hpp
elements.hpp
radiobox
auto radiobox
Definition
gallery.cpp:73
ftxui::ScreenInteractive::FitComponent
static ScreenInteractive FitComponent()
Definition
screen_interactive.cpp:346
ftxui::Radiobox
Component Radiobox(RadioboxOption options)
元素清單,只能選擇一個。
Definition
src/ftxui/component/radiobox.cpp:203
ftxui::Renderer
Component Renderer(Component child, std::function< Element()>)
回傳一個新的元件,類似於 |child|,但使用 |render| 作為 Component::Render() 事件。
Definition
src/ftxui/component/renderer.cpp:59
ftxui::size
Decorator size(WidthOrHeight, Constraint, int value)
限制元素的大小。
Definition
src/ftxui/dom/size.cpp:88
ftxui::border
Element border(Element)
在元素周圍繪製邊框。
Definition
src/ftxui/dom/border.cpp:227
ftxui
FTXUI 的 ftxui:: 命名空間
Definition
animation.hpp:10
ftxui::HEIGHT
@ HEIGHT
Definition
elements.hpp:158
ftxui::LESS_THAN
@ LESS_THAN
Definition
elements.hpp:159
main
int main()
Definition
radiobox_in_frame.cpp:15
screen_interactive.hpp