FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
ftxui/component

Detailed Description

ftxui/componentモジュールのチュートリアルを確認してください。

Functions

 FTXUI_EXPORT (COMPONENT) void RequestAnimationFrame()
 RequestAnimationFrameは、次のアニメーションサイクルで新しいフレームが描画されるよう要求する関数です。
 
class FTXUI_EXPORT (COMPONENT) ComponentBase = {})
 ftxui::Elementとして自身のレンダリングを実装します。ftxui::Eventに応答してキーボードナビゲーションを実装します。
 
Component Button (ButtonOption option)
 クリックすると関数を実行するボタンを描画します。
 
Component Button (ConstStringRef label, std::function< void()> on_click, ButtonOption option)
 クリックすると関数を実行するボタンを描画します。
 
Component CatchEvent (Component child, std::function< bool(Event event)> on_event)
 |on_event| を使ってイベントをキャッチするコンポーネントを返します。この 関数は、イベントが処理された場合はtrueを、そうでない場合はfalseを返す 必要があります。
 
ComponentDecorator CatchEvent (std::function< bool(Event)> on_event)
 |on_event| を使ってイベントをキャッチするコンポーネントを装飾します。この 関数は、イベントが処理された場合はtrueを、そうでない場合はfalseを返す 必要があります。
 
Component Checkbox (CheckboxOption option)
 チェック可能な要素を描画します。
 
Component Checkbox (ConstStringRef label, bool *checked, CheckboxOption option)
 チェック可能な要素を描画します。
 
Component Vertical (Components children)
 コンポーネントのリスト。垂直方向に1つずつ描画され、上下の矢印キーまたは'j'/'k'キーを使用して垂直方向にナビゲートされます。
 
Component Vertical (Components children, int *selector)
 上下矢印キーまたは 'j'/'k' キーを使って垂直方向に ナビゲートされる、垂直に一つずつ描画されるコンポーネントのリスト。 これは例えばメニューの実装に便利です。
 
Component Horizontal (Components children)
 左右矢印キーまたは 'h'/'l' キーを使って水平方向に ナビゲートされる、水平に一つずつ描画されるコンポーネントのリスト。
 
Component Horizontal (Components children, int *selector)
 水平方向に左右矢印キーまたは 'h'/'l' キーで操作される、1つずつ 水平に描画されるコンポーネントのリスト。
 
Component Tab (Components children, int *selector)
 一度に1つだけ描画され、操作されるコンポーネントのリスト。 |selector| は選択されたコンポーネントのインデックスを示します。これは タブを実装するのに便利です。
 
Component Stacked (Components children)
 互いに重ねて配置されるコンポーネントのリスト。 イベントは最初のコンポーネントに伝播され、処理されなければ次に、 というように伝播していきます。 コンポーネントは、与えられた順序の逆順で描画されます。 コンポーネントがフォーカスを取得すると、他の要素の相対的な順序を変えずに 最前面に配置されます。
 
Component Dropdown (ConstStringListRef entries, int *selected)
 ドロップダウンメニュー。
 
Component Dropdown (DropdownOption option)
 ドロップダウンメニュー。
 
Component Hoverable (Component component, bool *hover)
 コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
 
Component Hoverable (Component component, std::function< void()> on_enter, std::function< void()> on_leave)
 コンポーネントをラップします。コールバックを使用します。
 
ComponentDecorator Hoverable (bool *hover)
 コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
 
ComponentDecorator Hoverable (std::function< void()> on_enter, std::function< void()> on_leave)
 コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
 
Component Hoverable (Component component, std::function< void(bool)> on_change)
 コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
 
ComponentDecorator Hoverable (std::function< void(bool)> on_change)
 コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
 
Component Input (InputOption option)
 テキストを編集するための入力ボックス。
 
Component Input (StringRef content, InputOption option)
 テキストを編集するための入力ボックス。
 
Component Input (StringRef content, StringRef placeholder, InputOption option)
 テキストを編集するための入力ボックス。
 
Component Maybe (Component child, std::function< bool()> show)
 コンポーネント|child|を装飾します。|show|がtrueを返す場合にのみ表示されます。
 
ComponentDecorator Maybe (std::function< bool()> show)
 コンポーネントを装飾します。|show|関数がtrueを返す場合にのみ表示されます。
 
Component Maybe (Component child, const bool *show)
 コンポーネント|child|を装飾します。|show|がtrueの場合にのみ表示されます。
 
ComponentDecorator Maybe (const bool *show)
 コンポーネントを装飾します。|show|がtrueの場合にのみ表示されます。
 
Component Menu (MenuOption option)
 テキストのリスト。フォーカスされた要素が選択されます。
 
Component Menu (ConstStringListRef entries, int *selected, MenuOption option)
 テキストのリスト。フォーカスされた要素が選択されます。
 
Component Toggle (ConstStringListRef entries, int *selected)
 要素の水平リスト。ユーザーはこれらを操作できます。
 
Component MenuEntry (ConstStringRef label, MenuEntryOption option)
 特定のメニューエントリ。Container::Verticalに入れることで メニューを形成できます。
 
Component MenuEntry (MenuEntryOption option)
 特定のメニューエントリ。Container::Verticalに入れることで メニューを形成できます。
 
FTXUI_EXPORT(COMPONENT) ComponentDecorator Maybe(std Component Modal (Component main, Component modal, const bool *show_modal)
 
ComponentDecorator Modal (Component modal, const bool *show_modal)
 
Component Radiobox (RadioboxOption option)
 一つだけ選択できる要素のリスト。
 
Component Radiobox (ConstStringListRef entries, int *selected, RadioboxOption option)
 一つだけ選択できる要素のリスト。
 
Component Renderer (std::function< Element()> render)
 |render| を使ってインターフェースを描画するコンポーネントを返します。
 
Component Renderer (Component child, std::function< Element()> render)
 |child| に似た、|render| をComponent::Render()イベントとして 使用する新しいComponentを返します。
 
FTXUI_EXPORT(COMPONENT) Component Renderer(std Component Renderer (std::function< Element(bool)> render)
 |render| を使ってインターフェースを描画するフォーカス可能な コンポーネントを返します。
 
ComponentDecorator Renderer (ElementDecorator decorator)
 コンポーネントが描画するものを装飾することで、コンポーネントを 装飾します。
 
Component ResizableSplitLeft (Component main, Component back, int *main_size)
 マウスで設定可能な、2つのコンポーネント間の水平分割。
 
Component ResizableSplitRight (Component main, Component back, int *main_size)
 マウスで設定可能な、2つのコンポーネント間の水平分割。
 
Component ResizableSplitTop (Component main, Component back, int *main_size)
 マウスで設定可能な、2つのコンポーネント間の垂直分割。
 
Component ResizableSplitBottom (Component main, Component back, int *main_size)
 マウスで設定可能な、2つのコンポーネント間の垂直分割。
 
Component Slider (ConstStringRef label, Ref< int > value, ConstRef< int > min, ConstRef< int > max, ConstRef< int > increment)
 水平方向のスライダー。
 
Component Window (WindowOptions option)
 ドラッグ可能/サイズ変更可能なウィンドウ。複数のウィンドウを使用するには、それらを Container::Stacked({...})コンポーネントを使用してスタックする必要があります。
 

Function Documentation

◆ FTXUI_EXPORT() [1/2]

class FTXUI_EXPORT ( COMPONENT )

RequestAnimationFrameは、次のアニメーションサイクルで新しいフレームが描画されるよう要求する関数です。

Note
この関数は、アニメーションやトランジションなど、時間とともに状態や外観を更新する必要があるコンポーネントによって通常呼び出されます。 これは、変更が端末によって検出されるイベントに依存せず、時間の経過に依存する場合に役立ちます。

アニメーションが完了していないコンポーネントは、この関数を呼び出して、後で新しいフレームが描画されるよう要求できます。

新しいイベントがなく、完了するアニメーションがない場合、新しいフレームは描画されません。

このアニメーションステップが表す長さ。

このアニメーションステップが表す長さ。

Definition at line 22 of file animation.hpp.

◆ FTXUI_EXPORT() [2/2]

template FTXUI_EXPORT ( COMPONENT ) = {})

ftxui::Elementとして自身のレンダリングを実装します。ftxui::Eventに応答してキーボードナビゲーションを実装します。

マウスイベント。マウスの座標、押されたボタン、 および修飾子(shift, ctrl, meta)が含まれます。

Loopは、コンポーネントのイベントループを管理するクラスです。

イベントを表します。キープレスイベント、ターミナルのリサイズなど、さまざまなイベントがあります。

ドロップダウンコンポーネントのオプション。

ドロップダウンメニューは、ラジオボックスを開閉するチェックボックスです。

Windowコンポーネントのレンダー関数に渡される状態。

Radioboxコンポーネントのオプション。

Inputコンポーネントのオプション。

Inputコンポーネントのスタイルを定義するために使用されます。

Checkboxコンポーネントのオプション。

AnimatedButtonコンポーネントのオプション。

Menuコンポーネントのオプション。

MenuEntryコンポーネントのオプション。

アニメーション化された可能性のある色に関するオプション。

下線効果のオプション。

|ButtonOption|、|CheckboxOption|、|RadioboxOption|、|MenuEntryOption|、|MenuOption|からの変換の引数。

例:

  • 表示可能な文字はEvent::Character('a')を使用して作成できます。
  • Event::ArrowLeftのような特殊なイベントは事前に定義されています。
  • 特別なイベントの任意のコードは、以下を使用して見つけることができます。 ./example/util/print_key_press 例えば、CTLR+AはEvent::Special({1})にマップされます。

xtermの仕様に関する役立つドキュメント: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

コンポーネントの実行、イベントの処理、画面の更新を担当します。

Loopクラスは、ターミナル画面を表すAppオブジェクトと 一緒に使用するように設計されています。

例

int main() {
auto screen = ftxui::App::TerminalOutput();
auto component = ftxui::Button("Click me", [] { ... });
ftxui::Loop loop(screen.get(), component);
// または
loop.Run(); // コンポーネントが終了するまでブロックします。
// または
loop.RunOnce(); // ノンブロッキングで、即座に戻ります。
// または
loop.RunOnceBlocking(); // 1つのイベントを処理するまでブロックします。
// またはループ内で:
while (!loop.HasQuitted()) {
loop.RunOnce();
// 別のライブラリのループ関数を実行するなど、他の処理を行います。
}
}
Component Button(ConstStringRef label, std::function< void()> on_click, ButtonOption options=ButtonOption::Simple())
クリックすると関数を実行するボタンを描画します。

< 表示するラベル。

< ボタン/チェックボックス/ラジオボックスの状態

< エントリがアクティブなものかどうか。

< エントリがユーザーによってフォーカスされているものかどうか。

< 該当する場合のエントリのインデックス、または-1。

‍エントリのリスト。

‍選択されたエントリのインデックス。

‍選択されたエントリが変更されたときに呼び出されます。

‍ユーザーがEnterを押したときに呼び出されます。

ユーザーが状態を変更したときに呼び出されます。

< 入力がマウスでホバーされているかどうか。

< 入力がユーザーによってフォーカスされているかどうか。

< 入力が空でプレースホルダーを 表示しているかどうか。

デフォルトの入力スタイルを作成します:

余白の広い、白地に黒のスタイル:

入力の内容。

空のときの入力の内容。

< 入力内容を'*'を使って隠す。

< 入力が複数行かどうか。

< 挿入モードまたは上書きモードの文字入力。

内容が変更されたときに呼び出されます。

ユーザーがEnterを押したときに呼び出されます。

選択されたエントリが変更されたときに呼び出されます。

< このウィンドウにラップされた要素。

< ウィンドウのタイトル。

< ウィンドウがアクティブなものかどうか。

< ウィンドウがドラッグされているかどうか。

< ウィンドウがリサイズされているかどうか。

< リサイズ可能な左側がホバーされているかどうか。

< リサイズ可能な右側がホバーされているかどうか。

< リサイズ可能な上側がホバーされているかどうか。

< リサイズ可能な下側がホバーされているかどうか。

< このウィンドウにラップされたコンポーネント。

< このウィンドウによって表示されるタイトル。

< ウィンドウの左側の位置。

< ウィンドウの上側の位置。

< ウィンドウの幅。

< ウィンドウの高さ。

< 左側をリサイズできるか?

< 右側をリサイズできるか?

< 上側をリサイズできるか?

< 下側をリサイズできるか?

ウィンドウの見た目をカスタマイズするためのオプションの関数:

ドロップダウンが開いているか閉じているか:

サポートされているターミナルのみ。

サポートされているターミナルのみ。

< 表示するラベル。

< ボタン/チェックボックス/ラジオボックスの状態

< エントリがアクティブなものかどうか。

< エントリがユーザーによってフォーカスされているものかどうか。

< 該当する場合のエントリのインデックス、または-1。

‍エントリのリスト。

‍選択されたエントリのインデックス。

‍選択されたエントリが変更されたときに呼び出されます。

‍ユーザーがEnterを押したときに呼び出されます。

ユーザーが状態を変更したときに呼び出されます。

< 入力がマウスでホバーされているかどうか。

< 入力がユーザーによってフォーカスされているかどうか。

< 入力が空でプレースホルダーを 表示しているかどうか。

デフォルトの入力スタイルを作成します:

余白の広い、白地に黒のスタイル:

入力の内容。

空のときの入力の内容。

< 入力内容を'*'を使って隠す。

< 入力が複数行かどうか。

< 挿入モードまたは上書きモードの文字入力。

内容が変更されたときに呼び出されます。

ユーザーがEnterを押したときに呼び出されます。

選択されたエントリが変更されたときに呼び出されます。

< このウィンドウにラップされた要素。

< ウィンドウのタイトル。

< ウィンドウがアクティブなものかどうか。

< ウィンドウがドラッグされているかどうか。

< ウィンドウがリサイズされているかどうか。

< リサイズ可能な左側がホバーされているかどうか。

< リサイズ可能な右側がホバーされているかどうか。

< リサイズ可能な上側がホバーされているかどうか。

< リサイズ可能な下側がホバーされているかどうか。

< このウィンドウにラップされたコンポーネント。

< このウィンドウによって表示されるタイトル。

< ウィンドウの左側の位置。

< ウィンドウの上側の位置。

< ウィンドウの幅。

< ウィンドウの高さ。

< 左側をリサイズできるか?

< 右側をリサイズできるか?

< 上側をリサイズできるか?

< 下側をリサイズできるか?

ウィンドウの見た目をカスタマイズするためのオプションの関数:

ドロップダウンが開いているか閉じているか:

サポートされているターミナルのみ。

サポートされているターミナルのみ。

Definition at line 1 of file captured_mouse.hpp.

◆ Button() [1/2]

Component Button ( ButtonOption option)

クリックすると関数を実行するボタンを描画します。

Parameters
option追加のオプションパラメータ。
See also
ButtonBase

Example

auto screen = App::FitComponent();
Component button = Button({
.label = "Click to quit",
.on_click = screen.ExitLoopClosure(),
});
screen.Loop(button)
std::shared_ptr< ComponentBase > Component
Definition app.hpp:23

Output

┌─────────────┐
│Click to quit│
└─────────────┘

Definition at line 174 of file src/ftxui/component/button.cpp.

◆ Button() [2/2]

Component Button ( ConstStringRef label,
std::function< void()> on_click,
ButtonOption option )

クリックすると関数を実行するボタンを描画します。

Parameters
labelボタンのラベル。
on_clickクリック時に実行するアクション。
option追加のオプションパラメータ。
See also
ButtonBase

Example

auto screen = App::FitComponent();
std::string label = "Click to quit";
Component button = Button(&label, screen.ExitLoopClosure());
screen.Loop(button)

Output

┌─────────────┐
│Click to quit│
└─────────────┘

Definition at line 202 of file src/ftxui/component/button.cpp.

◆ CatchEvent() [1/2]

Component CatchEvent ( Component child,
std::function< bool(Event event)> on_event )

|on_event| を使ってイベントをキャッチするコンポーネントを返します。この 関数は、イベントが処理された場合はtrueを、そうでない場合はfalseを返す 必要があります。

Parameters
childラップされるコンポーネント。
on_eventインターフェースを描画する関数。

Example

auto screen = App::TerminalOutput();
auto renderer = Renderer([] {
return text("My interface");
});
auto component = CatchEvent(renderer, [&](Event event) {
if (event == Event::Character('q')) {
screen.ExitLoopClosure()();
return true;
}
return false;
});
screen.Loop(component);
Component Renderer(Component child, std::function< Element()>)
|child| に似た、|render| をComponent::Render()イベントとして 使用する新しいComponentを返します。
Element text(std::string_view text)
UTF8エンコードされたユニコードテキストを表示します。
Component CatchEvent(Component child, std::function< bool(Event)>)

Definition at line 59 of file catch_event.cpp.

◆ CatchEvent() [2/2]

ComponentDecorator CatchEvent ( std::function< bool(Event)> on_event)

|on_event| を使ってイベントをキャッチするコンポーネントを装飾します。この 関数は、イベントが処理された場合はtrueを、そうでない場合はfalseを返す 必要があります。

Parameters
on_eventインターフェースを描画する関数。

Example

auto screen = App::TerminalOutput();
auto renderer = Renderer([] { return text("Hello world"); });
renderer |= CatchEvent([&](Event event) {
if (event == Event::Character('q')) {
screen.ExitLoopClosure()();
return true;
}
return false;
});
screen.Loop(renderer);

Definition at line 86 of file catch_event.cpp.

◆ Checkbox() [1/2]

Component Checkbox ( CheckboxOption option)

チェック可能な要素を描画します。

Parameters
option追加のオプションパラメータ。
See also
CheckboxBase

Example

auto screen = App::FitComponent();
CheckboxOption option;
option.label = "Make a sandwidth";
option.checked = false;
Component checkbox = Checkbox(option);
screen.Loop(checkbox)
Component Checkbox(ConstStringRef label, bool *checked, CheckboxOption options=CheckboxOption::Simple())
チェック可能な要素を描画します。

Output

☐ Make a sandwich

Definition at line 111 of file src/ftxui/component/checkbox.cpp.

◆ Checkbox() [2/2]

Component Checkbox ( ConstStringRef label,
bool * checked,
CheckboxOption option )

チェック可能な要素を描画します。

Parameters
labelチェックボックスのラベル。
checkedチェックボックスがチェックされているかどうか。
option追加のオプションパラメータ。
See also
CheckboxBase

Example

auto screen = App::FitComponent();
std::string label = "Make a sandwidth";
bool checked = false;
Component checkbox = Checkbox(&label, &checked);
screen.Loop(checkbox)

Output

☐ Make a sandwich

Definition at line 138 of file src/ftxui/component/checkbox.cpp.

◆ Vertical() [1/2]

Component Vertical ( Components children)

コンポーネントのリスト。垂直方向に1つずつ描画され、上下の矢印キーまたは'j'/'k'キーを使用して垂直方向にナビゲートされます。

Parameters
childrenコンポーネントのリスト。
See also
ContainerBase

Example

auto container = Container::Vertical({
children_1,
children_2,
children_3,
children_4,
});
Component Vertical(Components children)
コンポーネントのリスト。垂直方向に1つずつ描画され、上下の矢印キーまたは'j'/'k'キーを使用して垂直方向にナビゲートされます。

Definition at line 329 of file container.cpp.

◆ Vertical() [2/2]

Component Vertical ( Components children,
int * selector )

上下矢印キーまたは 'j'/'k' キーを使って垂直方向に ナビゲートされる、垂直に一つずつ描画されるコンポーネントのリスト。 これは例えばメニューの実装に便利です。

Parameters
childrenコンポーネントのリスト。
selector選択された子への参照。
See also
ContainerBase

Example

int selected_children = 2;
auto container = Container::Vertical({
children_1,
children_2,
children_3,
children_4,
}, &selected_children);

Definition at line 352 of file container.cpp.

◆ Horizontal() [1/2]

Component Horizontal ( Components children)

左右矢印キーまたは 'h'/'l' キーを使って水平方向に ナビゲートされる、水平に一つずつ描画されるコンポーネントのリスト。

Parameters
childrenコンポーネントのリスト。
See also
ContainerBase

Example

auto container = Container::Horizontal({
children_1,
children_2,
children_3,
children_4,
});
Component Horizontal(Components children, int *selector)
水平方向に左右矢印キーまたは 'h'/'l' キーで操作される、1つずつ 水平に描画されるコンポーネントのリスト。

Definition at line 372 of file container.cpp.

◆ Horizontal() [2/2]

Component Horizontal ( Components children,
int * selector )

水平方向に左右矢印キーまたは 'h'/'l' キーで操作される、1つずつ 水平に描画されるコンポーネントのリスト。

Parameters
childrenコンポーネントのリスト。
selector選択された子要素のインデックスへの参照。
See also
ContainerBase

例

int selected_children = 2;
auto container = Container::Horizontal({
children_1,
children_2,
children_3,
children_4,
}, selected_children);

Definition at line 394 of file container.cpp.

◆ Tab()

Component Tab ( Components children,
int * selector )

一度に1つだけ描画され、操作されるコンポーネントのリスト。 |selector| は選択されたコンポーネントのインデックスを示します。これは タブを実装するのに便利です。

Parameters
childrenコンポーネントのリスト。
selector描画される子要素のインデックス。
See also
ContainerBase

例

int tab_drawn = 0;
auto container = Container::Tab({
children_1,
children_2,
children_3,
children_4,
}, &tab_drawn);
Component Tab(Components children, int *selector)
一度に1つだけ描画され、操作されるコンポーネントのリスト。 |selector| は選択されたコンポーネントのインデックスを示します。これは タブを実装するのに便利です。

Definition at line 417 of file container.cpp.

◆ Stacked()

Component Stacked ( Components children)

互いに重ねて配置されるコンポーネントのリスト。 イベントは最初のコンポーネントに伝播され、処理されなければ次に、 というように伝播していきます。 コンポーネントは、与えられた順序の逆順で描画されます。 コンポーネントがフォーカスを取得すると、他の要素の相対的な順序を変えずに 最前面に配置されます。

これは Window コンポーネントと一緒に使用する必要があります。

Parameters
childrenコンポーネントのリスト。
See also
Window

例

auto container = Container::Stacked({
children_1,
children_2,
children_3,
children_4,
});
Component Stacked(Components children)
互いに重ねて配置されるコンポーネントのリスト。 イベントは最初のコンポーネントに伝播され、処理されなければ次に、 というように伝播していきます。 コンポーネントは、与えられた順序の逆順で描画されます。 ...

Definition at line 444 of file container.cpp.

◆ Dropdown() [1/2]

Component Dropdown ( ConstStringListRef entries,
int * selected )

ドロップダウンメニュー。

Parameters
entries表示するエントリのリスト。
selected選択されたエントリのインデックス。

Definition at line 22 of file src/ftxui/component/dropdown.cpp.

◆ Dropdown() [2/2]

Component Dropdown ( DropdownOption option)

ドロップダウンメニュー。

Parameters
optionドロップダウンのオプション。

Definition at line 33 of file src/ftxui/component/dropdown.cpp.

◆ Hoverable() [1/6]

Component Hoverable ( Component component,
bool * hover )

コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。

Parameters
componentラップされたコンポーネント。
hoverコンポーネントがホバーされているかどうかを反映する値。

例

auto button = Button("exit", screen.ExitLoopClosure());
bool hover = false;
auto button_hover = Hoverable(button, &hover);
Component Hoverable(Component component, bool *hover)
コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。
Definition hoverable.cpp:32

Definition at line 32 of file hoverable.cpp.

◆ Hoverable() [2/6]

Component Hoverable ( Component component,
std::function< void()> on_enter,
std::function< void()> on_leave )

コンポーネントをラップします。コールバックを使用します。

Parameters
componentラップされたコンポーネント。
on_enterOnEnterコールバック
on_leaveOnLeaveコールバック

例

auto button = Button("exit", screen.ExitLoopClosure());
bool hover = false;
auto button_hover = Hoverable(button, &hover);

Definition at line 75 of file hoverable.cpp.

◆ Hoverable() [3/6]

ComponentDecorator Hoverable ( bool * hover)

コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。

Parameters
hoverコンポーネントがホバーされているかどうかを反映する値。

例

bool hover = false;
auto button = Button("exit", screen.ExitLoopClosure());
button |= Hoverable(&hover);

Definition at line 129 of file hoverable.cpp.

◆ Hoverable() [4/6]

ComponentDecorator Hoverable ( std::function< void()> on_enter,
std::function< void()> on_leave )

コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。

Parameters
on_enterマウスがコンポーネントをホバーしたときに呼び出されます。
on_leaveマウスがコンポーネントから離れたときに呼び出されます。

例

auto button = Button("exit", screen.ExitLoopClosure());
int on_enter_cnt = 0;
int on_leave_cnt = 0;
button |= Hoverable(
[&]{ on_enter_cnt++; },
[&]{ on_leave_cnt++; }
);

Definition at line 152 of file hoverable.cpp.

◆ Hoverable() [5/6]

Component Hoverable ( Component component,
std::function< void(bool)> on_change )

コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。

Parameters
componentラップされたコンポーネント。
on_changeマウスがコンポーネントに入ったとき、または離れたときに呼び出されます。

例

auto button = Button("exit", screen.ExitLoopClosure());
bool hovered = false;
auto button_hoverable = Hoverable(button,
[&](bool hover) { hovered = hover;});

Definition at line 174 of file hoverable.cpp.

◆ Hoverable() [6/6]

ComponentDecorator Hoverable ( std::function< void(bool)> on_change)

コンポーネントをラップします。マウスでホバーされているかどうかを知る機能を提供します。

Parameters
on_changeマウスがコンポーネントに入ったとき、または離れたときに呼び出されます。

例

auto button = Button("exit", screen.ExitLoopClosure());
bool hovered = false;
button |= Hoverable([&](bool hover) { hovered = hover;});

Definition at line 194 of file hoverable.cpp.

◆ Input() [1/3]

Component Input ( InputOption option)

テキストを編集するための入力ボックス。

Parameters
option追加のオプションパラメータ。
See also
InputBase

Example

auto screen = App::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input({
.content = &content,
.placeholder = &placeholder,
})
screen.Loop(input);
Component Input(StringRef content, InputOption options={})
テキストを編集するための入力ボックス。

Output

placeholder

Definition at line 590 of file src/ftxui/component/input.cpp.

◆ Input() [2/3]

Component Input ( StringRef content,
InputOption option )

テキストを編集するための入力ボックス。

Parameters
content編集可能なコンテンツ。
option追加のオプションパラメータ。
See also
InputBase

Example

auto screen = App::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input(content, {
.placeholder = &placeholder,
.password = true,
})
screen.Loop(input);

Output

placeholder

Definition at line 618 of file src/ftxui/component/input.cpp.

◆ Input() [3/3]

Component Input ( StringRef content,
StringRef placeholder,
InputOption option )

テキストを編集するための入力ボックス。

Parameters
content編集可能なコンテンツ。
placeholderプレースホルダーテキスト。
option追加のオプションパラメータ。
See also
InputBase

Example

auto screen = App::FitComponent();
std::string content= "";
std::string placeholder = "placeholder";
Component input = Input(content, placeholder);
screen.Loop(input);

Output

placeholder

Definition at line 645 of file src/ftxui/component/input.cpp.

◆ Maybe() [1/4]

Component Maybe ( Component child,
std::function< bool()> show )

コンポーネント|child|を装飾します。|show|がtrueを返す場合にのみ表示されます。

Parameters
child装飾するコンポーネント。
show|child|を表示するかどうかを返す関数。

Definition at line 20 of file src/ftxui/component/maybe.cpp.

◆ Maybe() [2/4]

ComponentDecorator Maybe ( std::function< bool()> show)

コンポーネントを装飾します。|show|関数がtrueを返す場合にのみ表示されます。

Parameters
show装飾されたコンポーネントを表示するかどうかを返す関数。

例

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = component | Maybe([&]{ return counter == 42; });
Component Maybe(Component child, std::function< bool()> show)
コンポーネント|child|を装飾します。|show|がtrueを返す場合にのみ表示されます。

Definition at line 54 of file src/ftxui/component/maybe.cpp.

◆ Maybe() [3/4]

Component Maybe ( Component child,
const bool * show )

コンポーネント|child|を装飾します。|show|がtrueの場合にのみ表示されます。

Parameters
child装飾するコンポーネント。
show論理値。|show|がtrueの場合に|child|が表示されます。

例

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = Maybe(component, &show);
const bool * show

Definition at line 71 of file src/ftxui/component/maybe.cpp.

◆ Maybe() [4/4]

ComponentDecorator Maybe ( const bool * show)

コンポーネントを装飾します。|show|がtrueの場合にのみ表示されます。

Parameters
show論理値。|show|がtrueの場合に|child|が表示されます。

例

auto component = Renderer([]{ return text("Hello World!"); });
auto maybe_component = component | Maybe(&show);

Definition at line 85 of file src/ftxui/component/maybe.cpp.

◆ Menu() [1/2]

Component Menu ( MenuOption option)

テキストのリスト。フォーカスされた要素が選択されます。

Parameters
optionすべてのパラメータを含む構造体。

Example

auto screen = App::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Menu({
.entries = &entries,
.selected = &selected,
});
screen.Loop(menu);
Component Menu(ConstStringListRef entries, int *selected_, MenuOption options=MenuOption::Vertical())
テキストのリスト。フォーカスされた要素が選択されます。

Output

> entry 1
entry 2
entry 3

Definition at line 505 of file src/ftxui/component/menu.cpp.

◆ Menu() [2/2]

Component Menu ( ConstStringListRef entries,
int * selected,
MenuOption option )

テキストのリスト。フォーカスされた要素が選択されます。

Parameters
entriesメニュー内のエントリのリスト。
selected現在選択されている要素のインデックス。
option追加のオプションパラメータ。

Example

auto screen = App::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Menu(&entries, &selected);
screen.Loop(menu);

Output

> entry 1
entry 2
entry 3

Definition at line 536 of file src/ftxui/component/menu.cpp.

◆ Toggle()

Component Toggle ( ConstStringListRef entries,
int * selected )

要素の水平リスト。ユーザーはこれらを操作できます。

Parameters
entries表示する選択可能なエントリのリスト。
selected選択されたエントリを参照します。 関連項目 |Menu|。

Definition at line 547 of file src/ftxui/component/menu.cpp.

◆ MenuEntry() [1/2]

Component MenuEntry ( ConstStringRef label,
MenuEntryOption option )

特定のメニューエントリ。Container::Verticalに入れることで メニューを形成できます。

Parameters
labelこの要素を表す描画されるテキスト。
option追加のオプションパラメータ。

Example

auto screen = App::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical({
MenuEntry("entry 1"),
MenuEntry("entry 2"),
MenuEntry("entry 3"),
}, &selected);
screen.Loop(menu);
Component MenuEntry(ConstStringRef label, MenuEntryOption options={})
特定のメニューエントリ。Container::Verticalに入れることで メニューを形成できます。

Output

> entry 1
entry 2
entry 3

Definition at line 577 of file src/ftxui/component/menu.cpp.

◆ MenuEntry() [2/2]

Component MenuEntry ( MenuEntryOption option)

特定のメニューエントリ。Container::Verticalに入れることで メニューを形成できます。

Parameters
optionパラメータ。

Example

auto screen = App::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical({
MenuEntry({.label = "entry 1"}),
MenuEntry({.label = "entry 2"}),
MenuEntry({.label = "entry 3"}),
}, &selected);
screen.Loop(menu);

Output

> entry 1
entry 2
entry 3

Definition at line 607 of file src/ftxui/component/menu.cpp.

◆ Modal() [1/2]

Component Modal ( Component main,
Component modal,
const bool * show_modal )

Definition at line 18 of file modal.cpp.

◆ Modal() [2/2]

ComponentDecorator Modal ( Component modal,
const bool * show_modal )

Definition at line 58 of file modal.cpp.

◆ Radiobox() [1/2]

Component Radiobox ( RadioboxOption option)

一つだけ選択できる要素のリスト。

Parameters
optionパラメータ
See also
RadioboxBase

Example

auto screen = App::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Radiobox({
.entries = entries,
.selected = &selected,
});
screen.Loop(menu);
Component Radiobox(ConstStringListRef entries, int *selected_, RadioboxOption options={})
一つだけ選択できる要素のリスト。

Output

◉ entry 1
○ entry 2
○ entry 3

NOLINTNEXTLINE

Definition at line 204 of file src/ftxui/component/radiobox.cpp.

◆ Radiobox() [2/2]

Component Radiobox ( ConstStringListRef entries,
int * selected,
RadioboxOption option )

一つだけ選択できる要素のリスト。

Parameters
entriesリスト内のエントリのリスト。
selected現在選択されている要素のインデックス。
option追加のオプションパラメータ。
See also
RadioboxBase

Example

auto screen = App::TerminalOutput();
std::vector<std::string> entries = {
"entry 1",
"entry 2",
"entry 3",
};
int selected = 0;
auto menu = Radiobox(&entries, &selected);
screen.Loop(menu);

Output

◉ entry 1
○ entry 2
○ entry 3

Definition at line 236 of file src/ftxui/component/radiobox.cpp.

◆ Renderer() [1/4]

Component Renderer ( std::function< Element()> render)

|render| を使ってインターフェースを描画するコンポーネントを返します。

Parameters
renderインターフェースを描画する関数。

Example

auto screen = App::TerminalOutput();
auto renderer = Renderer([] {
return text("My interface");
});
screen.Loop(renderer);

Definition at line 29 of file src/ftxui/component/renderer.cpp.

◆ Renderer() [2/4]

Component Renderer ( Component child,
std::function< Element()> render )

|child| に似た、|render| をComponent::Render()イベントとして 使用する新しいComponentを返します。

Parameters
childイベントを転送するコンポーネント。
renderインターフェースを描画する関数。

Example

auto screen = App::TerminalOutput();
std::string label = "Click to quit";
auto button = Button(&label, screen.ExitLoopClosure());
auto renderer = Renderer(button, [&] {
return hbox({
text("A button:"),
button->Render(),
});
});
screen.Loop(renderer);
Element hbox(Elements children)
要素を水平方向に1つずつ表示するコンテナ。
Definition hbox.cpp:93

Definition at line 61 of file src/ftxui/component/renderer.cpp.

◆ Renderer() [3/4]

Component Renderer ( std::function< Element(bool)> render)

|render| を使ってインターフェースを描画するフォーカス可能な コンポーネントを返します。

Parameters
renderインターフェースを描画する関数で、コンポーネントが フォーカスされているかどうかを示すブール値を受け取ります。

Example

auto screen = App::TerminalOutput();
auto renderer = Renderer([] (bool focused) {
if (focused)
return text("My interface") | inverted;
else
return text("My interface");
});
screen.Loop(renderer);
Element inverted(Element child)
前景色と背景色を反転させるフィルターを追加します。
Definition inverted.cpp:33

Definition at line 85 of file src/ftxui/component/renderer.cpp.

◆ Renderer() [4/4]

ComponentDecorator Renderer ( ElementDecorator decorator)

コンポーネントが描画するものを装飾することで、コンポーネントを 装飾します。

Parameters
decoratorコンポーネントが描画する要素を変更する関数。

Example

auto screen = App::TerminalOutput();
auto renderer =
Renderer([] { return text("Hello"); })
| Renderer(bold)
| Renderer(inverted);
screen.Loop(renderer);

Definition at line 127 of file src/ftxui/component/renderer.cpp.

◆ ResizableSplitLeft()

Component ResizableSplitLeft ( Component main,
Component back,
int * main_size )

マウスで設定可能な、2つのコンポーネント間の水平分割。

Parameters
mainサイズが |main_size| のメインコンポーネント。左側。
back残りのサイズを占めるバックコンポーネント。右側。
main_size|main| コンポーネントのサイズ。

Example

auto screen = App::Fullscreen();
int left_size = 10;
auto left = Renderer([] { return text("Left") | center;});
auto right = Renderer([] { return text("right") | center;});
auto split = ResizableSplitLeft(left, right, &left_size);
screen.Loop(split);
Component ResizableSplitLeft(Component main, Component back, int *main_size)
マウスで設定可能な、2つのコンポーネント間の水平分割。
Element center(Element child)
要素を水平方向および垂直方向に中央揃えします。
std::uint8_t left
Definition screen.cpp:147
std::uint8_t right
Definition screen.cpp:149

Output

│
left │ right
│

Definition at line 198 of file src/ftxui/component/resizable_split.cpp.

◆ ResizableSplitRight()

Component ResizableSplitRight ( Component main,
Component back,
int * main_size )

マウスで設定可能な、2つのコンポーネント間の水平分割。

Parameters
mainサイズが |main_size| のメインコンポーネント。右側。
back残りのサイズを占めるバックコンポーネント。左側。
main_size|main| コンポーネントのサイズ。

Example

auto screen = App::Fullscreen();
int right_size = 10;
auto left = Renderer([] { return text("Left") | center;});
auto right = Renderer([] { return text("right") | center;});
auto split = ResizableSplitRight(right, left, &right_size)
screen.Loop(split);
Component ResizableSplitRight(Component main, Component back, int *main_size)
マウスで設定可能な、2つのコンポーネント間の水平分割。

Output

│
left │ right
│

Definition at line 231 of file src/ftxui/component/resizable_split.cpp.

◆ ResizableSplitTop()

Component ResizableSplitTop ( Component main,
Component back,
int * main_size )

マウスで設定可能な、2つのコンポーネント間の垂直分割。

Parameters
mainサイズ|main_size|のメインコンポーネント。上側。
back残りのサイズを取るバックコンポーネント。下側。
main_size|main|コンポーネントのサイズ。

Example

auto screen = App::Fullscreen();
int top_size = 1;
auto top = Renderer([] { return text("Top") | center;});
auto bottom = Renderer([] { return text("Bottom") | center;});
auto split = ResizableSplitTop(top, bottom, &top_size)
screen.Loop(split);
Component ResizableSplitTop(Component main, Component back, int *main_size)
マウスで設定可能な、2つのコンポーネント間の垂直分割。
std::uint8_t top
Definition screen.cpp:148

Output

top
────────────
bottom

Definition at line 264 of file src/ftxui/component/resizable_split.cpp.

◆ ResizableSplitBottom()

Component ResizableSplitBottom ( Component main,
Component back,
int * main_size )

マウスで設定可能な、2つのコンポーネント間の垂直分割。

Parameters
mainサイズ|main_size|のメインコンポーネント。下側。
back残りのサイズを取るバックコンポーネント。上側。
main_size|main|コンポーネントのサイズ。

Example

auto screen = App::Fullscreen();
int bottom_size = 1;
auto top = Renderer([] { return text("Top") | center;});
auto bottom = Renderer([] { return text("Bottom") | center;});
auto split = ResizableSplit::Bottom(bottom, top, &bottom_size)
screen.Loop(split);

Output

top
────────────
bottom

Definition at line 297 of file src/ftxui/component/resizable_split.cpp.

◆ Slider()

Component Slider ( ConstStringRef label,
Ref< int > value,
ConstRef< int > min,
ConstRef< int > max,
ConstRef< int > increment )

水平方向のスライダー。

Parameters
labelスライダーの名前。
valueスライダーの現在の値。
min最小値。
max最大値。
incrementカーソルで使用する際の増分。

Example

auto screen = App::TerminalOutput();
int value = 50;
auto slider = Slider("Value:", &value, 0, 100, 1);
screen.Loop(slider);
Component Slider(SliderOption< T > options)
任意の方向のスライダー。
int value
Definition elements.hpp:192

Output

Value:[██████████████████████████ ]

Definition at line 258 of file src/ftxui/component/slider.cpp.

◆ Window()

Component Window ( WindowOptions option)

ドラッグ可能/サイズ変更可能なウィンドウ。複数のウィンドウを使用するには、それらを Container::Stacked({...})コンポーネントを使用してスタックする必要があります。

Parameters
optionすべてのパラメータを保持する構造体。
See also
Window

例

auto window_1= Window({
.inner = DummyWindowContent(),
.title = "First window",
});
auto window_2= Window({
.inner = DummyWindowContent(),
.title = "Second window",
});
auto container = Container::Stacked({
window_1,
window_2,
});
Component Window(WindowOptions option)
ドラッグ可能/サイズ変更可能なウィンドウ。複数のウィンドウを使用するには、それらを Container::Stacked({...})コンポーネントを使用してスタックする必要があります。
Component DummyWindowContent()
Definition scrollbar.cpp:10

Definition at line 312 of file src/ftxui/component/window.cpp.