FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
menu_in_frame_horizontal.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. 全著作権所有。
2// このソースコードの使用は、LICENSEファイルに記載されているMITライセンスに準拠します。
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
13using namespace ftxui;
14
15int main() {
16 std::vector<std::string> entries;
17 int selected = 0;
18
19 for (int i = 0; i < 100; ++i) {
20 entries.push_back(std::to_string(i));
21 }
22 auto radiobox = Menu(&entries, &selected, MenuOption::Horizontal());
23 auto renderer = Renderer(
24 radiobox, [&] { return radiobox->Render() | hscroll_indicator | frame; });
25
26 auto screen = ScreenInteractive::FitComponent();
27 screen.Loop(renderer);
28
29 return 0;
30}
static ScreenInteractive FitComponent()
描画されるコンポーネントの幅と高さに一致するScreenInteractiveを作成します。
static MenuOption Horizontal()
水平メニューの標準オプション。 これはタブバーの実装に役立ちます。
Component Menu(MenuOption options)
テキストのリスト。フォーカスされた要素が選択されます。
Component Renderer(Component child, std::function< Element()>)
|child|に似ていますが、|render|をComponentRender()イベントとして使用する新しいコンポーネントを返します。
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
Element frame(Element)
要素を「仮想」領域内に表示できるようにします。そのサイズはコンテナよりも大きくすることができます。 この場合、より小さい部分のみが表示されます。フォーカスされた要素を表示するためにビューはスクロール可能...
Definition frame.cpp:117