载入中...
搜索中...
未找到
Widget.h
浏览该文件的文档.
235WidgetDesc window(std::string title, std::vector<WidgetDesc> children = {}, std::string id = "root");
261WidgetDesc imageButton(std::string id, float width, float height, std::function<void()> onClick = {});
Definition Component.cpp:5
WidgetDesc spacer(std::string id, float grow)
Flexible empty space; default flexGrow=1 so it absorbs free space in a Flex parent.
Definition Widget.cpp:439
WidgetDesc slider(std::string label, float value, float minV, float maxV, std::string id, std::function< void(float)> onValue)
Horizontal slider; fires onValue.
Definition Widget.cpp:291
WidgetDesc scrollList(std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
Definition Widget.cpp:398
WidgetDesc progress(float fraction, std::string id, std::string overlay)
Progress bar; fraction is clamped to [0,1].
Definition Widget.cpp:305
WidgetDesc checkbox(std::string label, bool checked, std::string id, std::function< void(bool)> onToggle)
Checkbox with a label; fires onToggle.
Definition Widget.cpp:279
WidgetDesc whenElse(bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse)
Definition Widget.cpp:453
WidgetDesc when(bool cond, WidgetDesc child)
Conditional: include child only when cond is true (empty group otherwise).
Definition Widget.cpp:448
@ Text
WidgetDesc combo(std::string label, std::vector< std::string > options, int selected, std::string id, std::function< void(int)> onValue)
Definition Widget.cpp:315
WidgetDesc inputText(std::string label, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Editable text field; fires onTextChange.
Definition Widget.cpp:363
WidgetDesc listButtons(std::string listId, const std::vector< std::string > &items)
Default list: one Button per item, id = listId + "/" + index.
Definition Widget.cpp:470
@ Start
WidgetDesc flex(FlexDirection direction, std::vector< WidgetDesc > children, std::string id)
Elastic layout container (row/column). Prefer row / column shorthands.
Definition Widget.cpp:421
WidgetDesc imageButton(std::string id, float width, float height, std::function< void()> onClick)
Definition Widget.cpp:342
WidgetDesc virtualList(std::string listId, const std::vector< std::string > &items, float height, float itemHeight)
Definition Widget.cpp:410
WidgetDesc collapsingHeader(std::string label, std::vector< WidgetDesc > children, std::string id, bool defaultOpen)
Collapsible header containing child widgets.
Definition Widget.cpp:375
bool applyTreeReconcile(UIHost *host, WidgetDesc root)
Patch by key/id when structure (type + child keys) matches; otherwise full replace....
Definition Widget.cpp:490
WidgetDesc sameLine(std::string id)
Holds the next widget on the same line as the previous one.
Definition Widget.cpp:263
WidgetDesc button(std::string label, std::string id, std::function< void()> onClick)
Clickable button; fires onClick.
Definition Widget.cpp:244
WidgetDesc column(std::vector< WidgetDesc > children, std::string id)
Vertical elastic layout column.
Definition Widget.cpp:435
@ Start
WidgetDesc viewport(std::string id, float width, float height)
Definition Widget.cpp:353
WidgetDesc child(std::string id, std::vector< WidgetDesc > children, float width, float height)
Scrollable child region with an explicit size.
Definition Widget.cpp:387
WidgetDesc list(std::string listId, const std::vector< std::string > &items, const std::function< WidgetDesc(const std::string &, int)> &itemFn)
Expand a string list into a Group of item widgets. itemFn(label, index) builds each row; keys default...
Definition Widget.cpp:457
WidgetDesc row(std::vector< WidgetDesc > children, std::string id)
Horizontal elastic layout row.
Definition Widget.cpp:431
Declarative widget description (build once / on dirty → flatten into UIHost::Tree).
Definition Widget.h:13
WidgetDesc & withNinePatch(float l, float t, float r, float b)
Definition Widget.h:171
WidgetDesc & withAbsolute(float ax, float ay, float x=0.f, float y=0.f)
Definition Widget.h:148
WidgetDesc & withTextChange(std::function< void(const std::string &)> fn)
Definition Widget.h:222
WidgetDesc & withCornerRadius(float radius)
Definition Widget.h:178
WidgetDesc & withPadding(float l, float t, float r, float b)
Definition Widget.h:125
WidgetDesc & withTint(float r, float g, float b, float a=1.f)
Definition Widget.h:156
WidgetDesc & withMargin(float l, float t, float r, float b)
Definition Widget.h:118
WidgetDesc & withFlexDirection(FlexDirection d)
Definition Widget.h:194
std::function< void(const std::string &)> onTextChange
Definition Widget.h:73
WidgetDesc & withUv(float u0, float v0, float u1, float v1)
Definition Widget.h:163
WidgetDesc & withToggle(std::function< void(bool)> fn)
Definition Widget.h:214
WidgetDesc & withClick(std::function< void()> fn)
Definition Widget.h:210
WidgetDesc & withValueFn(std::function< void(float)> fn)
Definition Widget.h:218