14 auto screen = App::Fullscreen();
31 auto renderer =
Renderer(split, [&] {
32 return window(
text(
"Drag the separator with the mouse"),
34 text(
"Min: " + std::to_string(size_min)),
35 text(
"Max: " + std::to_string(size_max)),
36 text(
"Size: " + std::to_string(size)),
38 split->Render() |
flex,
42 screen.Loop(renderer);
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element window(Element title, Element content, BorderStyle border=ROUNDED)
繪製帶有標題和邊框的視窗。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Element flex(Element child)
讓子元素依比例擴展以填滿容器中剩餘的空間。
Element center(Element child)
水平與垂直置中一個元素。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
Component ResizableSplit(ResizableSplitOption options)
兩個元件之間的分隔。