18 auto action = [&] { value++; };
19 auto action_renderer =
20 Renderer([&] {
return text(
"count = " + std::to_string(value)); });
26 Container::Horizontal({
46 Button(
"Animated 4", action,
48 Button(
"Animated 5", action,
50 Button(
"Animated 6", action,
static ButtonOption Animated()
创建一个使用动画颜色的ButtonOption。
static ScreenInteractive FitComponent()
创建一个 ScreenInteractive,其宽度和高度与正在绘制的组件匹配。
static ButtonOption Simple()
创建一个ButtonOption,聚焦时反转显示。
static ButtonOption Ascii()
创建一个ButtonOption,使用[]字符高亮显示。
Component Button(ButtonOption options)
绘制一个按钮。点击时执行一个函数。
Component Renderer(Component child, std::function< Element()>)
返回一个新组件,类似于 |child|,但使用 |render| 作为 Component::Render() 事件。
Element text(std::wstring text)
显示一段Unicode文本。
Element separator()
在两个其他元素之间绘制垂直或水平分隔线。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase