FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
menu_in_frame.cpp
Go to the documentation of this file.
1
// Copyright 2020 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 <memory>
// for shared_ptr, __shared_ptr_access
5
#include <string>
// for string, basic_string, operator+, to_string
6
#include <vector>
// for vector
7
8
#include "
ftxui/component/captured_mouse.hpp
"
// for ftxui
9
#include "
ftxui/component/component.hpp
"
// for Radiobox, Renderer
10
#include "
ftxui/component/component_base.hpp
"
// for ComponentBase
11
#include "
ftxui/component/screen_interactive.hpp
"
// for ScreenInteractive
12
#include "
ftxui/dom/elements.hpp
"
// for operator|, Element, size, border, frame, HEIGHT, LESS_THAN
13
14
using namespace
ftxui
;
15
16
int
main
() {
17
std::vector<std::string> entries;
18
int
selected = 0;
19
20
for
(
int
i = 0; i < 30; ++i) {
21
entries.push_back(
"Entry "
+ std::to_string(i));
22
}
23
auto
radiobox
=
Menu
(&entries, &selected);
24
auto
renderer =
Renderer
(
radiobox
, [&] {
25
return
radiobox
->Render() | vscroll_indicator | frame |
26
size
(
HEIGHT
,
LESS_THAN
, 10) |
border
;
27
});
28
29
auto
screen =
ScreenInteractive::FitComponent
();
30
screen.Loop(renderer);
31
32
return
0;
33
}
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::Menu
Component Menu(MenuOption options)
文字列表。選定的元素會被聚焦。
Definition
src/ftxui/component/menu.cpp:512
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
main
int main()
Definition
menu_in_frame.cpp:16
ftxui
FTXUI 的 ftxui:: 命名空間
Definition
animation.hpp:10
ftxui::HEIGHT
@ HEIGHT
Definition
elements.hpp:158
ftxui::LESS_THAN
@ LESS_THAN
Definition
elements.hpp:159
screen_interactive.hpp