mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-17 00:18:11 +08:00
Fix format. Try compile on Windows.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ftxui/component/checkbox.hpp"
|
||||
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
@@ -6,25 +7,26 @@
|
||||
using namespace ftxui;
|
||||
|
||||
class MyComponent : public Component {
|
||||
private:
|
||||
CheckBox box_1_;
|
||||
CheckBox box_2_;
|
||||
CheckBox box_3_;
|
||||
Container container_ = Container::Vertical();
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container_);
|
||||
container_.Add(&box_1_);
|
||||
container_.Add(&box_2_);
|
||||
container_.Add(&box_3_);
|
||||
box_1_.label = L"Build examples";
|
||||
box_2_.label = L"Build tests";
|
||||
box_3_.label = L"Use WebAssembly";
|
||||
box_3_.state = true;
|
||||
}
|
||||
private:
|
||||
CheckBox box_1_;
|
||||
CheckBox box_2_;
|
||||
CheckBox box_3_;
|
||||
Container container_ = Container::Vertical();
|
||||
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container_);
|
||||
container_.Add(&box_1_);
|
||||
container_.Add(&box_2_);
|
||||
container_.Add(&box_3_);
|
||||
box_1_.label = L"Build examples";
|
||||
box_2_.label = L"Build tests";
|
||||
box_3_.label = L"Use WebAssembly";
|
||||
box_3_.state = true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
MyComponent component;
|
||||
screen.Loop(&component);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/input.hpp"
|
||||
#include "ftxui/component/menu.hpp"
|
||||
#include "ftxui/component/checkbox.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/component/toggle.hpp"
|
||||
#include "ftxui/screen/string.hpp"
|
||||
@@ -14,15 +13,16 @@ class MyComponent : public Component {
|
||||
MyComponent() {
|
||||
Add(&container);
|
||||
checkbox.resize(30);
|
||||
for(int i = 0; i<checkbox.size(); ++i) {
|
||||
for (int i = 0; i < checkbox.size(); ++i) {
|
||||
checkbox[i].label = (L"CheckBox " + to_wstring(i));
|
||||
container.Add(&checkbox[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
Elements content;
|
||||
for(auto& it : checkbox) {
|
||||
for (auto& it : checkbox) {
|
||||
content.push_back(it.Render());
|
||||
}
|
||||
return vbox(std::move(content))
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "ftxui/component/checkbox.hpp"
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/input.hpp"
|
||||
#include "ftxui/component/menu.hpp"
|
||||
#include "ftxui/component/radiobox.hpp"
|
||||
#include "ftxui/component/checkbox.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/component/toggle.hpp"
|
||||
|
||||
@@ -53,6 +53,7 @@ class MyComponent : public Component {
|
||||
container.Add(&input);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
Element Render(std::wstring name, Component& component) {
|
||||
return
|
||||
hbox(
|
||||
@@ -72,6 +73,7 @@ class MyComponent : public Component {
|
||||
Render(L"input", input) | size(WIDTH, LESS_THAN, 30)
|
||||
) | border;
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include <cmath>
|
||||
#include <thread>
|
||||
|
||||
#include "ftxui/component/checkbox.hpp"
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/input.hpp"
|
||||
@@ -19,7 +20,7 @@ class Graph {
|
||||
for (int i = 0; i < width; ++i) {
|
||||
float v = 0;
|
||||
v += 0.1 * sin((i + shift) * 0.1);
|
||||
v += 0.2 * sin((i + shift+10) * 0.15);
|
||||
v += 0.2 * sin((i + shift + 10) * 0.15);
|
||||
v += 0.1 * sin((i + shift) * 0.03);
|
||||
v *= height;
|
||||
v += 0.5 * height;
|
||||
@@ -36,6 +37,7 @@ class HTopComponent : public Component {
|
||||
HTopComponent() {}
|
||||
~HTopComponent() override {}
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
hbox(
|
||||
@@ -77,18 +79,19 @@ class HTopComponent : public Component {
|
||||
) | flex
|
||||
) | flex | border;
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
class CompilerComponent : public Component {
|
||||
Container container = Container::Horizontal();
|
||||
RadioBox compiler;
|
||||
Container flag = Container::Vertical();
|
||||
CheckBox flag_checkbox[4];
|
||||
Container subcontainer = Container::Vertical();
|
||||
Container input_container = Container::Horizontal();
|
||||
Input input_add;
|
||||
Menu input;
|
||||
Input executable;
|
||||
RadioBox compiler;
|
||||
Container flag = Container::Vertical();
|
||||
CheckBox flag_checkbox[4];
|
||||
Container subcontainer = Container::Vertical();
|
||||
Container input_container = Container::Horizontal();
|
||||
Input input_add;
|
||||
Menu input;
|
||||
Input executable;
|
||||
|
||||
public:
|
||||
~CompilerComponent() override {}
|
||||
@@ -97,45 +100,45 @@ class CompilerComponent : public Component {
|
||||
|
||||
// Compiler ----------------------------------------------------------------
|
||||
compiler.entries = {
|
||||
L"gcc",
|
||||
L"clang",
|
||||
L"emcc",
|
||||
L"game_maker"
|
||||
L"Ada compilers",
|
||||
L"ALGOL 60 compilers",
|
||||
L"ALGOL 68 compilers",
|
||||
L"Assemblers (Intel *86)",
|
||||
L"Assemblers (Motorola 68*)",
|
||||
L"Assemblers (Zilog Z80)",
|
||||
L"Assemblers (other)",
|
||||
L"BASIC Compilers",
|
||||
L"BASIC interpreters",
|
||||
L"Batch compilers",
|
||||
L"C compilers",
|
||||
L"Source-to-source compilers",
|
||||
L"C++ compilers",
|
||||
L"C# compilers",
|
||||
L"COBOL compilers",
|
||||
L"Common Lisp compilers",
|
||||
L"D compilers",
|
||||
L"DIBOL/DBL compilers",
|
||||
L"ECMAScript interpreters",
|
||||
L"Eiffel compilers",
|
||||
L"Fortran compilers",
|
||||
L"Go compilers",
|
||||
L"Haskell compilers",
|
||||
L"Java compilers",
|
||||
L"Pascal compilers",
|
||||
L"Perl Interpreters",
|
||||
L"PHP compilers",
|
||||
L"PL/I compilers",
|
||||
L"Python compilers",
|
||||
L"Scheme compilers and interpreters",
|
||||
L"Smalltalk compilers",
|
||||
L"Tcl Interpreters",
|
||||
L"VMS Interpreters",
|
||||
L"Rexx Interpreters",
|
||||
L"CLI compilers",
|
||||
L"gcc",
|
||||
L"clang",
|
||||
L"emcc",
|
||||
L"game_maker"
|
||||
L"Ada compilers",
|
||||
L"ALGOL 60 compilers",
|
||||
L"ALGOL 68 compilers",
|
||||
L"Assemblers (Intel *86)",
|
||||
L"Assemblers (Motorola 68*)",
|
||||
L"Assemblers (Zilog Z80)",
|
||||
L"Assemblers (other)",
|
||||
L"BASIC Compilers",
|
||||
L"BASIC interpreters",
|
||||
L"Batch compilers",
|
||||
L"C compilers",
|
||||
L"Source-to-source compilers",
|
||||
L"C++ compilers",
|
||||
L"C# compilers",
|
||||
L"COBOL compilers",
|
||||
L"Common Lisp compilers",
|
||||
L"D compilers",
|
||||
L"DIBOL/DBL compilers",
|
||||
L"ECMAScript interpreters",
|
||||
L"Eiffel compilers",
|
||||
L"Fortran compilers",
|
||||
L"Go compilers",
|
||||
L"Haskell compilers",
|
||||
L"Java compilers",
|
||||
L"Pascal compilers",
|
||||
L"Perl Interpreters",
|
||||
L"PHP compilers",
|
||||
L"PL/I compilers",
|
||||
L"Python compilers",
|
||||
L"Scheme compilers and interpreters",
|
||||
L"Smalltalk compilers",
|
||||
L"Tcl Interpreters",
|
||||
L"VMS Interpreters",
|
||||
L"Rexx Interpreters",
|
||||
L"CLI compilers",
|
||||
};
|
||||
container.Add(&compiler);
|
||||
|
||||
@@ -145,11 +148,12 @@ class CompilerComponent : public Component {
|
||||
flag_checkbox[1].label = L"-Werror";
|
||||
flag_checkbox[2].label = L"-lpthread";
|
||||
flag_checkbox[3].label = L"-O3";
|
||||
for(auto& c : flag_checkbox)
|
||||
for (auto& c : flag_checkbox)
|
||||
flag.Add(&c);
|
||||
|
||||
container.Add(&subcontainer);
|
||||
// Executable ----------------------------------------------------------------
|
||||
// Executable
|
||||
// ----------------------------------------------------------------
|
||||
executable.placeholder = L"executable";
|
||||
subcontainer.Add(&executable);
|
||||
|
||||
@@ -165,6 +169,7 @@ class CompilerComponent : public Component {
|
||||
input_container.Add(&input);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
vbox(
|
||||
@@ -194,13 +199,14 @@ class CompilerComponent : public Component {
|
||||
hflow(RenderCommandLine())
|
||||
) | border;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
Elements RenderCommandLine() {
|
||||
Elements line;
|
||||
// Compiler
|
||||
line.push_back(text(compiler.entries[compiler.selected]) | bold);
|
||||
// flags
|
||||
for(auto& it : flag_checkbox) {
|
||||
for (auto& it : flag_checkbox) {
|
||||
if (it.state) {
|
||||
line.push_back(text(L" "));
|
||||
line.push_back(text(it.label) | dim);
|
||||
@@ -212,7 +218,7 @@ class CompilerComponent : public Component {
|
||||
line.push_back(text(executable.content) | color(Color::BlueLight) | bold);
|
||||
}
|
||||
// Input
|
||||
for(auto& it : input.entries) {
|
||||
for (auto& it : input.entries) {
|
||||
line.push_back(text(L" " + it) | color(Color::RedLight));
|
||||
}
|
||||
return line;
|
||||
@@ -220,6 +226,7 @@ class CompilerComponent : public Component {
|
||||
};
|
||||
|
||||
class SpinnerComponent : public Component {
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
Elements entries;
|
||||
for(int i = 0; i<22; ++i) {
|
||||
@@ -233,9 +240,11 @@ class SpinnerComponent : public Component {
|
||||
}
|
||||
return hflow(std::move(entries)) | border;
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
class ColorComponent : public Component {
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
hbox(
|
||||
@@ -278,10 +287,12 @@ class ColorComponent : public Component {
|
||||
bgcolor(Color::YellowLight, text(L"YellowLight"))
|
||||
)
|
||||
) | hcenter | border;
|
||||
// clang-format on
|
||||
}
|
||||
};
|
||||
|
||||
class GaugeComponent : public Component {
|
||||
// clang-format off
|
||||
Element RenderGauge(int delta) {
|
||||
float progress = (shift + delta) % 1000 / 1000.f;
|
||||
return hbox(text(std::to_wstring(int(progress * 100)) + L"% ") | size(WIDTH, EQUAL, 5),
|
||||
@@ -308,46 +319,40 @@ class GaugeComponent : public Component {
|
||||
RenderGauge(348) | color(Color::YellowLight)
|
||||
) | border;
|
||||
};
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
class Tab : public Component {
|
||||
public:
|
||||
Container main_container = Container::Vertical();
|
||||
public:
|
||||
Container main_container = Container::Vertical();
|
||||
|
||||
Toggle tab_selection;
|
||||
Container container = Container::Tab(&tab_selection.selected);
|
||||
Toggle tab_selection;
|
||||
Container container = Container::Tab(&tab_selection.selected);
|
||||
|
||||
HTopComponent htop_component;
|
||||
ColorComponent color_component;
|
||||
SpinnerComponent spinner_component;
|
||||
GaugeComponent gauge_component;
|
||||
CompilerComponent compiler_component;
|
||||
HTopComponent htop_component;
|
||||
ColorComponent color_component;
|
||||
SpinnerComponent spinner_component;
|
||||
GaugeComponent gauge_component;
|
||||
CompilerComponent compiler_component;
|
||||
|
||||
Tab() {
|
||||
Add(&main_container);
|
||||
main_container.Add(&tab_selection);
|
||||
tab_selection.entries = {
|
||||
L"htop",
|
||||
L"color",
|
||||
L"spinner",
|
||||
L"gauge",
|
||||
L"compiler",
|
||||
};
|
||||
main_container.Add(&container);
|
||||
container.Add(&htop_component);
|
||||
container.Add(&color_component);
|
||||
container.Add(&spinner_component);
|
||||
container.Add(&gauge_component);
|
||||
container.Add(&compiler_component);
|
||||
}
|
||||
Tab() {
|
||||
Add(&main_container);
|
||||
main_container.Add(&tab_selection);
|
||||
tab_selection.entries = {
|
||||
L"htop", L"color", L"spinner", L"gauge", L"compiler",
|
||||
};
|
||||
main_container.Add(&container);
|
||||
container.Add(&htop_component);
|
||||
container.Add(&color_component);
|
||||
container.Add(&spinner_component);
|
||||
container.Add(&gauge_component);
|
||||
container.Add(&compiler_component);
|
||||
}
|
||||
|
||||
Element Render() override {
|
||||
return vbox(
|
||||
text(L"FTXUI Demo") | bold | hcenter,
|
||||
tab_selection.Render() | hcenter,
|
||||
container.Render()
|
||||
);
|
||||
}
|
||||
Element Render() override {
|
||||
return vbox(text(L"FTXUI Demo") | bold | hcenter,
|
||||
tab_selection.Render() | hcenter, container.Render());
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include "ftxui/component/input.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/input.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/screen/string.hpp"
|
||||
|
||||
@@ -28,6 +29,7 @@ class MyComponent : public Component {
|
||||
Input input_2;
|
||||
Input input_3;
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
border(
|
||||
@@ -38,6 +40,7 @@ class MyComponent : public Component {
|
||||
)
|
||||
);
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
@@ -1,8 +1,9 @@
|
||||
#include "ftxui/component/menu.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "ftxui/component/menu.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
@@ -10,27 +10,33 @@
|
||||
using namespace ftxui;
|
||||
|
||||
class MyComponent : public Component {
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container);
|
||||
container.Add(&left_menu);
|
||||
container.Add(&right_menu);
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container);
|
||||
container.Add(&left_menu);
|
||||
container.Add(&right_menu);
|
||||
|
||||
left_menu.entries = {L"0%", L"10%", L"20%", L"30%", L"40%", L"50%",
|
||||
L"60%", L"70%", L"80%", L"90%"};
|
||||
right_menu.entries = {L"0%", L"1%", L"2%", L"3%", L"4%", L"5%",
|
||||
L"6%", L"7%", L"8%", L"9%", L"10%"};
|
||||
left_menu.entries = {
|
||||
L"0%", L"10%", L"20%", L"30%", L"40%",
|
||||
L"50%", L"60%", L"70%", L"80%", L"90%",
|
||||
};
|
||||
right_menu.entries = {
|
||||
L"0%", L"1%", L"2%", L"3%", L"4%", L"5%",
|
||||
L"6%", L"7%", L"8%", L"9%", L"10%",
|
||||
};
|
||||
|
||||
left_menu.on_enter = [this]() { on_enter(); };
|
||||
right_menu.on_enter = [this]() { on_enter(); };
|
||||
}
|
||||
left_menu.on_enter = [this]() { on_enter(); };
|
||||
right_menu.on_enter = [this]() { on_enter(); };
|
||||
}
|
||||
|
||||
std::function<void()> on_enter = [](){};
|
||||
private:
|
||||
Container container = Container::Horizontal();
|
||||
Menu left_menu;
|
||||
Menu right_menu;
|
||||
std::function<void()> on_enter = []() {};
|
||||
|
||||
private:
|
||||
Container container = Container::Horizontal();
|
||||
Menu left_menu;
|
||||
Menu right_menu;
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
int sum = left_menu.selected * 10 + right_menu.selected;
|
||||
return
|
||||
@@ -61,10 +67,10 @@ class MyComponent : public Component {
|
||||
)
|
||||
);
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
MyComponent component;
|
||||
component.on_enter = screen.ExitLoopClosure();
|
||||
|
@@ -9,50 +9,48 @@
|
||||
using namespace ftxui;
|
||||
|
||||
class MyComponent : public Component {
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container);
|
||||
public:
|
||||
MyComponent() {
|
||||
Add(&container);
|
||||
|
||||
for(Menu* menu : {&menu_1, &menu_2, &menu_3, &menu_4, &menu_5, &menu_6}) {
|
||||
container.Add(menu);
|
||||
menu->entries = {
|
||||
L"Monkey",
|
||||
L"Dog",
|
||||
L"Cat",
|
||||
L"Bird",
|
||||
L"Elephant",
|
||||
};
|
||||
menu->on_enter = [this]() { on_enter(); };
|
||||
}
|
||||
for (Menu* menu : {&menu_1, &menu_2, &menu_3, &menu_4, &menu_5, &menu_6}) {
|
||||
container.Add(menu);
|
||||
menu->entries = {
|
||||
L"Monkey", L"Dog", L"Cat", L"Bird", L"Elephant",
|
||||
};
|
||||
menu->on_enter = [this]() { on_enter(); };
|
||||
}
|
||||
|
||||
menu_2.selected_style = color(Color::Blue);
|
||||
menu_2.focused_style = bold | color(Color::Blue);
|
||||
menu_2.selected_style = color(Color::Blue);
|
||||
menu_2.focused_style = bold | color(Color::Blue);
|
||||
|
||||
menu_3.selected_style = color(Color::Blue);
|
||||
menu_3.focused_style = bgcolor(Color::Blue);
|
||||
menu_3.selected_style = color(Color::Blue);
|
||||
menu_3.focused_style = bgcolor(Color::Blue);
|
||||
|
||||
menu_4.selected_style = bgcolor(Color::Blue);
|
||||
menu_4.focused_style = bgcolor(Color::BlueLight);
|
||||
menu_4.selected_style = bgcolor(Color::Blue);
|
||||
menu_4.focused_style = bgcolor(Color::BlueLight);
|
||||
|
||||
menu_5.normal_style = bgcolor(Color::Blue);
|
||||
menu_5.selected_style = bgcolor(Color::Yellow);
|
||||
menu_5.focused_style = bgcolor(Color::Red);
|
||||
menu_5.normal_style = bgcolor(Color::Blue);
|
||||
menu_5.selected_style = bgcolor(Color::Yellow);
|
||||
menu_5.focused_style = bgcolor(Color::Red);
|
||||
|
||||
menu_6.normal_style = dim | color(Color::Blue);
|
||||
menu_6.selected_style = color(Color::Blue);
|
||||
menu_6.focused_style = bold | color(Color::Blue);
|
||||
}
|
||||
menu_6.normal_style = dim | color(Color::Blue);
|
||||
menu_6.selected_style = color(Color::Blue);
|
||||
menu_6.focused_style = bold | color(Color::Blue);
|
||||
}
|
||||
|
||||
std::function<void()> on_enter = [](){};
|
||||
private:
|
||||
Container container = Container::Horizontal();
|
||||
Menu menu_1;
|
||||
Menu menu_2;
|
||||
Menu menu_3;
|
||||
Menu menu_4;
|
||||
Menu menu_5;
|
||||
Menu menu_6;
|
||||
std::function<void()> on_enter = []() {};
|
||||
|
||||
private:
|
||||
Container container = Container::Horizontal();
|
||||
Menu menu_1;
|
||||
Menu menu_2;
|
||||
Menu menu_3;
|
||||
Menu menu_4;
|
||||
Menu menu_5;
|
||||
Menu menu_6;
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
hbox(
|
||||
@@ -64,10 +62,10 @@ class MyComponent : public Component {
|
||||
menu_6.Render() | flex
|
||||
) | border;
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
MyComponent component;
|
||||
component.on_enter = screen.ExitLoopClosure();
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "ftxui/component/radiobox.hpp"
|
||||
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
|
@@ -14,7 +14,7 @@ class MyComponent : public Component {
|
||||
|
||||
public:
|
||||
MyComponent() {
|
||||
for(int i = 0; i<30; ++i) {
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
radiobox.entries.push_back(L"RadioBox " + to_wstring(i));
|
||||
}
|
||||
Add(&radiobox);
|
||||
|
@@ -44,13 +44,9 @@ class MyComponent : public Component {
|
||||
|
||||
std::function<void()> on_enter = []() {};
|
||||
|
||||
Element Render(){
|
||||
return
|
||||
vbox(
|
||||
toggle_.Render(),
|
||||
separator(),
|
||||
tab_container_.Render()
|
||||
) | border;
|
||||
Element Render() {
|
||||
return vbox(toggle_.Render(), separator(), tab_container_.Render()) |
|
||||
border;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#include "ftxui/component/toggle.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "ftxui/component/container.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/component/toggle.hpp"
|
||||
#include "ftxui/screen/string.hpp"
|
||||
|
||||
using namespace ftxui;
|
||||
@@ -33,6 +34,7 @@ class MyComponent : public Component {
|
||||
Toggle toggle_3_;
|
||||
Toggle toggle_4_;
|
||||
|
||||
// clang-format off
|
||||
Element Render() override {
|
||||
return
|
||||
vbox(
|
||||
@@ -44,6 +46,7 @@ class MyComponent : public Component {
|
||||
hbox(text(L" * Number of elements : "), toggle_4_.Render())
|
||||
);
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
Reference in New Issue
Block a user