19 std::function<
void()> exit) {
27 text(
"Main component"),
41 std::function<
void()> hide_modal) {
49 text(
"Modal component "),
59int main(
int argc,
const char* argv[]) {
63 bool modal_shown =
false;
66 auto show_modal = [&] { modal_shown =
true; };
67 auto hide_modal = [&] { modal_shown =
false; };
68 auto exit = screen.ExitLoopClosure();
69 auto do_nothing = [&] {};
77 main_component |=
Modal(modal_component, &modal_shown);
79 screen.Loop(main_component);
static ButtonOption Animated()
創建一個 ButtonOption,使用動畫顏色。
static ScreenInteractive TerminalOutput()
Component Button(ButtonOption options)
繪製一個按鈕。點擊時執行一個函數。
Component Modal(Component main, Component modal, const bool *show_modal)
Component Renderer(Component child, std::function< Element()>)
回傳一個新的元件,類似於 |child|,但使用 |render| 作為 Component::Render() 事件。
Decorator size(WidthOrHeight, Constraint, int value)
限制元素的大小。
Element center(Element)
水平與垂直置中一個元素。
Element text(std::wstring text)
顯示一段 Unicode 文字。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element border(Element)
在元素周圍繪製邊框。
Element vbox(Elements)
一個垂直一個接一個顯示元素的容器。
Component ModalComponent(std::function< void()> do_nothing, std::function< void()> hide_modal)
Component MainComponent(std::function< void()> show_modal, std::function< void()> exit)
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component