21 MenuEntryOption option;
22 option.transform = [c](EntryState state) {
23 state.label = (state.active ?
"> " :
" ") + state.label;
37 auto screen = App::TerminalOutput();
40 auto menu = Container::Vertical(
73 hbox(
text(
"selected = "),
text(std::to_string(selected))),
80 screen.Loop(renderer);
82 std::cout <<
"Selected element = " << selected << std::endl;
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Component MenuEntry(ConstStringRef label, MenuEntryOption options={})
一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
對元素的大小套用限制。
Element bold(Element child)
使用粗體字型,用於需要更多強調的元素。
Element inverted(Element child)
添加一個濾鏡,它將反轉前景和背景 顏色。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element color(Color color, Element child)
設定元素的前景顏色。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
std::shared_ptr< Node > Element
Element hbox(Elements children)
一個逐一水平顯示元素的容器。