19 auto on_click = [&] { counter++; };
24 auto container = Container::Vertical({});
25 for (
int i = 0; i < 30; ++i) {
26 auto button =
Button(
"Button " + std::to_string(i), on_click, style);
27 container->Add(button);
34 text(std::to_string(counter)),
37 container->
Render() | vscroll_indicator | frame |
static ButtonOption Animated()
创建一个使用动画颜色的ButtonOption。
static ScreenInteractive FitComponent()
创建一个 ScreenInteractive,其宽度和高度与正在绘制的组件匹配。
Component Button(ButtonOption options)
绘制一个按钮。点击时执行一个函数。
Component Renderer(Component child, std::function< Element()>)
返回一个新组件,类似于 |child|,但使用 |render| 作为 Component::Render() 事件。
virtual void Render(Screen &screen)
在 ftxui::Screen 上显示元素。
Decorator size(WidthOrHeight, Constraint, int value)
对元素大小应用约束。
Element text(std::wstring text)
显示一段Unicode文本。
Element separator()
在两个其他元素之间绘制垂直或水平分隔线。
Element vbox(Elements)
垂直一个接一个显示元素的容器。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
Element hbox(Elements)
一个按水平顺序逐一显示元素的容器。