18 auto on_click = [&] { counter++; };
23 auto container = Container::Vertical({});
24 for (
int i = 0; i < 30; ++i) {
25 auto button =
Button(
"Button " + std::to_string(i), on_click, style);
29 auto renderer =
Renderer(container, [&] {
33 text(std::to_string(counter)),
36 container->
Render() | vscroll_indicator | frame |
43 screen.Loop(renderer);
static ButtonOption Animated()
創建一個 ButtonOption,使用動畫顏色。
static ScreenInteractive FitComponent()
Component Button(ButtonOption options)
繪製一個按鈕。點擊時執行一個函數。
Component Renderer(Component child, std::function< Element()>)
回傳一個新的元件,類似於 |child|,但使用 |render| 作為 Component::Render() 事件。
virtual void Render(Screen &screen)
Decorator size(WidthOrHeight, Constraint, int value)
限制元素的大小。
Element text(std::wstring text)
顯示一段 Unicode 文字。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements)
一個垂直一個接一個顯示元素的容器。
Element hbox(Elements)
一個逐一水平顯示元素的容器。