16 auto screen = App::FitComponent();
17 auto back_button =
Button(
"Back", screen.ExitLoopClosure());
18 auto goto_1 =
Button(
"Goto /1", [path] {
Nested(path +
"/1"); });
19 auto goto_2 =
Button(
"Goto /2", [path] {
Nested(path +
"/2"); });
20 auto goto_3 =
Button(
"Goto /3", [path] {
Nested(path +
"/3"); });
21 auto layout = Container::Vertical({
27 auto renderer =
Renderer(layout, [&] {
29 text(
"path: " + path),
31 back_button->Render(),
38 screen.Loop(renderer);
42 auto screen = App::FitComponent();
43 auto button_quit =
Button(
"Quit", screen.ExitLoopClosure());
44 auto button_nested =
Button(
"Nested", [] {
Nested(
""); });
45 screen.Loop(Container::Vertical({
Component Button(ConstStringRef label, std::function< void()> on_click, ButtonOption options=ButtonOption::Simple())
繪製一個按鈕。點擊時執行一個函式。
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
void Nested(std::string path)