载入中...
搜索中...
未找到
Widget.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "ui/Icons.h"
5#include "ui/UIHost.h"
6
7#include <functional>
8#include <string>
9#include <utility>
10#include <vector>
11
12namespace eve::ui {
13
15struct WidgetDesc {
17 std::string id;
19 std::string key;
20 std::string text;
21 std::string valueText;
22 std::string tooltip;
24 std::string helpText;
26 std::string disabledReason;
28 std::string placeholder;
30 bool multiline = false;
32 bool readOnly = false;
33 bool visible = true;
34 bool enabled = true;
35 bool checked = false;
36 bool open = true;
40 std::string styleClass;
41 int tabIndex = 0;
42 std::string focusNext;
43 std::string focusPrevious;
44 std::string focusLeft;
45 std::string focusRight;
46 std::string focusUp;
47 std::string focusDown;
49 std::string accessibilityName;
51 bool dragSource = false;
52 bool dropTarget = false;
53 std::string dragPayloadType;
54 std::string dragPayloadText;
55 std::string acceptedDropType;
56 float value = 0.f;
57 float minValue = 0.f;
58 float maxValue = 1.f;
59 float sizeX = 0.f;
60 float sizeY = 0.f;
61 // --- Layout box model (mirrors UINode) ---
62 float marginL = 0.f;
63 float marginT = 0.f;
64 float marginR = 0.f;
65 float marginB = 0.f;
66 float paddingL = 0.f;
67 float paddingT = 0.f;
68 float paddingR = 0.f;
69 float paddingB = 0.f;
70 float minSizeX = 0.f;
71 float minSizeY = 0.f;
72 float maxSizeX = 0.f;
73 float maxSizeY = 0.f;
74 float percentW = 0.f;
75 float percentH = 0.f;
76 float aspectRatio = 0.f;
77 float anchorX = 0.f;
78 float anchorY = 0.f;
79 float posX = 0.f;
80 float posY = 0.f;
81 bool absolute = false;
82 // --- Image / ImageButton props ---
83 uint64_t textureId = 0;
84 float tintR = 1.f;
85 float tintG = 1.f;
86 float tintB = 1.f;
87 float tintA = 1.f;
88 float uv0x = 0.f;
89 float uv0y = 0.f;
90 float uv1x = 1.f;
91 float uv1y = 1.f;
92 float borderL = 0.f;
93 float borderT = 0.f;
94 float borderR = 0.f;
95 float borderB = 0.f;
97 bool fillStretch = false;
98 float fillStartDegrees = -90.f;
99 bool fillClockwise = true;
100 float fillInnerRadius = 0.f; // fraction of outer radius, [0,1]
101 float cornerRadius = 0.f;
102 float fontSize = 0.f; // zero inherits host font; positive values are logical UI units
103 float textR = 1.f, textG = 1.f, textB = 1.f, textA = 1.f;
104 float textAlignX = 0.f, textAlignY = 0.f;
105 float wrapWidth = 0.f;
106 float itemHeight = 0.f; // ScrollList uniform row height
110 float gap = -1.f;
111 float flexGrow = 0.f;
112 float flexShrink = 1.f;
113 float flexBasis = -1.f;
114 int alignSelf = -1;
115 float columnGap = -1.f;
116 float rowGap = -1.f;
119 int gridColumns = 1;
122 std::function<void()> onClick;
124 std::function<void(bool)> onToggle;
126 std::function<void(float)> onValue;
128 std::function<void(const std::string &)> onTextChange;
129 std::vector<WidgetDesc> children;
130
132 WidgetDesc &withId(std::string v) {
133 id = std::move(v);
134 return *this;
135 }
137 WidgetDesc &withKey(std::string v) {
138 key = std::move(v);
139 return *this;
140 }
142 WidgetDesc &withText(std::string v) {
143 text = std::move(v);
144 return *this;
145 }
147 WidgetDesc &withValueText(std::string v) {
148 valueText = std::move(v);
149 return *this;
150 }
152 WidgetDesc &withTooltip(std::string v) {
153 tooltip = std::move(v);
154 return *this;
155 }
157 WidgetDesc &withTextInput(bool multi, bool locked = false, std::string hint = {}) {
158 multiline = multi;
160 placeholder = std::move(hint);
161 return *this;
162 }
164 WidgetDesc &withHelp(std::string help, std::string reason = {}) {
165 helpText = std::move(help);
166 disabledReason = std::move(reason);
167 return *this;
168 }
171 visible = v;
172 return *this;
173 }
176 enabled = v;
177 return *this;
178 }
181 focusMode = v;
182 return *this;
183 }
186 mouseFilter = v;
187 return *this;
188 }
191 themePreset = v;
192 return *this;
193 }
196 tabIndex = v;
197 return *this;
198 }
200 WidgetDesc &withFocusOrder(std::string previous, std::string next) {
201 focusPrevious = std::move(previous);
202 focusNext = std::move(next);
203 return *this;
204 }
206 WidgetDesc &withFocusNeighbors(std::string left, std::string right, std::string up,
207 std::string down) {
208 focusLeft = std::move(left);
209 focusRight = std::move(right);
210 focusUp = std::move(up);
211 focusDown = std::move(down);
212 return *this;
213 }
216 std::string description = {}) {
217 accessibilityRole = role;
218 accessibilityName = std::move(name);
220 return *this;
221 }
224 dragSource = true;
225 dragPayloadType = std::move(payloadType);
226 dragPayloadText = std::move(payloadText);
227 return *this;
228 }
230 WidgetDesc &withDropTarget(std::string acceptedType) {
231 dropTarget = true;
232 acceptedDropType = std::move(acceptedType);
233 return *this;
234 }
237 checked = v;
238 return *this;
239 }
242 open = v;
243 return *this;
244 }
247 value = v;
248 return *this;
249 }
251 WidgetDesc &withRange(float lo, float hi) {
252 minValue = lo;
253 maxValue = hi;
254 return *this;
255 }
257 WidgetDesc &withSize(float w, float h) {
258 sizeX = w;
259 sizeY = h;
260 return *this;
261 }
263 WidgetDesc &withMargin(float l, float t, float r, float b) {
264 marginL = l;
265 marginT = t;
266 marginR = r;
267 marginB = b;
268 return *this;
269 }
271 WidgetDesc &withPadding(float l, float t, float r, float b) {
272 paddingL = l;
273 paddingT = t;
274 paddingR = r;
275 paddingB = b;
276 return *this;
277 }
279 WidgetDesc &withMinSize(float w, float h) {
280 minSizeX = w;
281 minSizeY = h;
282 return *this;
283 }
285 WidgetDesc &withMaxSize(float w, float h) {
286 maxSizeX = w;
287 maxSizeY = h;
288 return *this;
289 }
291 WidgetDesc &withPercent(float w, float h) {
292 percentW = w;
293 percentH = h;
294 return *this;
295 }
298 styleClass = std::move(v);
299 return *this;
300 }
304 return *this;
305 }
308 WidgetDesc &withAbsolute(float ax, float ay, float x = 0.f, float y = 0.f) {
309 absolute = true;
310 anchorX = ax;
311 anchorY = ay;
312 posX = x;
313 posY = y;
314 return *this;
315 }
317 WidgetDesc &withTint(float r, float g, float b, float a = 1.f) {
318 tintR = r;
319 tintG = g;
320 tintB = b;
321 tintA = a;
322 return *this;
323 }
325 WidgetDesc &withUv(float u0, float v0, float u1, float v1) {
326 uv0x = u0;
327 uv0y = v0;
328 uv1x = u1;
329 uv1y = v1;
330 return *this;
331 }
334 WidgetDesc &withNinePatch(float l, float t, float r, float b) {
335 borderL = l;
336 borderT = t;
337 borderR = r;
338 borderB = b;
339 return *this;
340 }
344 return *this;
345 }
349 return *this;
350 }
354 return *this;
355 }
358 gap = g;
359 return *this;
360 }
364 rowGap = rows;
365 return *this;
366 }
369 flexWrap = wrap;
370 return *this;
371 }
374 overflow = mode;
375 return *this;
376 }
379 gridColumnSpan = span;
380 return *this;
381 }
385 return *this;
386 }
389 alignItems = a;
390 return *this;
391 }
394 justifyContent = j;
395 return *this;
396 }
399 flexGrow = g;
400 return *this;
401 }
403 WidgetDesc &withFlexShrink(float shrink) {
404 flexShrink = shrink;
405 return *this;
406 }
408 WidgetDesc &withFlexBasis(float basis) {
409 flexBasis = basis;
410 return *this;
411 }
414 alignSelf = int(align);
415 return *this;
416 }
418 WidgetDesc &withClick(std::function<void()> fn) {
419 onClick = std::move(fn);
420 return *this;
421 }
423 WidgetDesc &withToggle(std::function<void(bool)> fn) {
424 onToggle = std::move(fn);
425 return *this;
426 }
428 WidgetDesc &withValueFn(std::function<void(float)> fn) {
429 onValue = std::move(fn);
430 return *this;
431 }
433 WidgetDesc &withTextChange(std::function<void(const std::string &)> fn) {
434 onTextChange = std::move(fn);
435 return *this;
436 }
439 children.push_back(std::move(c));
440 return *this;
441 }
442
444 const std::string &reconcileKey() const { return key.empty() ? id : key; }
445};
446
448EVENGINE_API_WORLD WidgetDesc window(std::string title, std::vector<WidgetDesc> children = {}, std::string id = "root");
450EVENGINE_API_WORLD WidgetDesc text(std::string content, std::string id = "");
452EVENGINE_API_WORLD WidgetDesc button(std::string label, std::string id = "", std::function<void()> onClick = {});
454EVENGINE_API_WORLD WidgetDesc icon(Icon value, std::string id = "");
456EVENGINE_API_WORLD WidgetDesc iconButton(Icon value, std::string label = "", std::string id = "",
458 std::function<void()> onClick = {});
460EVENGINE_API_WORLD WidgetDesc group(std::vector<WidgetDesc> children = {}, std::string id = "");
462EVENGINE_API_WORLD WidgetDesc sameLine(std::string id = "");
464EVENGINE_API_WORLD WidgetDesc separator(std::string id = "");
466EVENGINE_API_WORLD WidgetDesc checkbox(std::string label, bool checked = false, std::string id = "",
468 std::function<void(bool)> onToggle = {});
470EVENGINE_API_WORLD WidgetDesc slider(std::string label, float value, float minV, float maxV, std::string id = "",
472 std::function<void(float)> onValue = {});
474EVENGINE_API_WORLD WidgetDesc progress(float fraction, std::string id = "", std::string overlay = "");
477EVENGINE_API_WORLD WidgetDesc combo(std::string label, std::vector<std::string> options, int selected,
478 std::string id = "", std::function<void(float)> onValue = {});
481EVENGINE_API_WORLD WidgetDesc image(std::string id = "", float width = 0.f, float height = 0.f,
483 std::function<void()> onClick = {});
485WidgetDesc ninePatchPanel(std::vector<WidgetDesc> children = {}, std::string id = "",
486 uint64_t textureId = 0);
491EVENGINE_API_WORLD WidgetDesc filledImage(std::string id, float width, float height, float fraction);
496EVENGINE_API_WORLD WidgetDesc radialFill(std::string id, float width, float height, float fraction);
499EVENGINE_API_WORLD WidgetDesc resourceBar(std::string id, float width, float height, float fraction);
503EVENGINE_API_WORLD WidgetDesc skillSlot(std::string id, float size, uint64_t iconTexture, float cooldown,
504 std::string key);
507EVENGINE_API_WORLD WidgetDesc imageButton(std::string id, float width, float height,
509 std::function<void()> onClick = {});
512EVENGINE_API_WORLD WidgetDesc viewport(std::string id = "", float width = 0.f, float height = 0.f);
514EVENGINE_API_WORLD WidgetDesc inputText(std::string label, std::string value, std::string id = "",
516 std::function<void(const std::string &)> onChange = {});
520EVENGINE_API_WORLD WidgetDesc link(std::string label, std::string target, std::string id = "",
521 std::function<void()> onClick = {});
522
524EVENGINE_API_WORLD WidgetDesc searchField(std::string hint, std::string value = {}, std::string id = "",
526 std::function<void(const std::string &)> onChange = {});
528EVENGINE_API_WORLD WidgetDesc toggleSwitch(std::string label, bool checked = false, std::string id = "",
530 std::function<void(bool)> onToggle = {});
532EVENGINE_API_WORLD WidgetDesc badge(std::string label, std::string id = "");
539EVENGINE_API_WORLD WidgetDesc colorPalette(std::string label, float r, float g, float b, float a = 1.f,
540 std::string id = "", std::function<void(float)> onValue = {});
542EVENGINE_API_WORLD WidgetDesc card(std::vector<WidgetDesc> children = {}, std::string id = "");
544EVENGINE_API_WORLD WidgetDesc sectionHeader(std::string label, std::string id = "");
546EVENGINE_API_WORLD WidgetDesc menuBar(std::vector<WidgetDesc> children = {}, std::string id = "");
548EVENGINE_API_WORLD WidgetDesc menu(std::string label, std::vector<WidgetDesc> children = {}, std::string id = "");
550EVENGINE_API_WORLD WidgetDesc menuItem(std::string label, std::string shortcut = {}, std::string id = "",
552 std::function<void()> onClick = {}, bool selected = false);
554EVENGINE_API_WORLD WidgetDesc toolbar(std::vector<WidgetDesc> children = {}, std::string id = "");
556EVENGINE_API_WORLD WidgetDesc toolbox(std::vector<WidgetDesc> children = {}, std::string id = "", float cellSize = 0.f,
557 int columns = 0);
559EVENGINE_API_WORLD WidgetDesc sidebar(std::vector<WidgetDesc> children = {}, std::string id = "", float width = 0.f);
561EVENGINE_API_WORLD WidgetDesc statusBar(std::vector<WidgetDesc> children = {}, std::string id = "");
567EVENGINE_API_WORLD WidgetDesc splitPane(FlexDirection direction, WidgetDesc first, WidgetDesc second,
568 float ratio = 0.25f, std::string id = "",
570 std::function<void(float)> onResize = {});
577EVENGINE_API_WORLD WidgetDesc tab(std::string label, std::string pageId, bool selected = false, std::string id = "",
578 std::function<void()> onClick = {});
580EVENGINE_API_WORLD WidgetDesc tabBar(std::vector<WidgetDesc> children = {}, std::string id = "");
586EVENGINE_API_WORLD WidgetDesc tabContainer(std::vector<WidgetDesc> pages, std::string activePageId, std::string id = "",
587 std::function<void(const std::string &)> onSelect = {});
592EVENGINE_API_WORLD WidgetDesc panelFrame(std::string title, std::vector<WidgetDesc> children = {}, std::string id = "");
597EVENGINE_API_WORLD WidgetDesc dockArea(std::string region, std::vector<WidgetDesc> children = {}, std::string id = "");
602EVENGINE_API_WORLD WidgetDesc appFrame(WidgetDesc body, WidgetDesc toolbar = {}, WidgetDesc statusBarWidget = {},
603 std::string id = "");
605EVENGINE_API_WORLD WidgetDesc collapsingHeader(std::string label, std::vector<WidgetDesc> children = {},
606 std::string id = "", bool defaultOpen = true);
608EVENGINE_API_WORLD WidgetDesc child(std::string id, std::vector<WidgetDesc> children = {}, float width = 0.f,
609 float height = 120.f);
616EVENGINE_API_WORLD WidgetDesc scrollList(std::string id, std::vector<WidgetDesc> children = {}, float height = 0.f,
617 float itemHeight = 0.f);
620EVENGINE_API_WORLD WidgetDesc virtualList(std::string listId, const std::vector<std::string> &items,
621 float height = 200.f, float itemHeight = 0.f);
622
624EVENGINE_API_WORLD WidgetDesc flex(FlexDirection direction, std::vector<WidgetDesc> children = {}, std::string id = "");
626EVENGINE_API_WORLD WidgetDesc row(std::vector<WidgetDesc> children = {}, std::string id = "");
628EVENGINE_API_WORLD WidgetDesc column(std::vector<WidgetDesc> children = {}, std::string id = "");
630EVENGINE_API_WORLD WidgetDesc grid(int columns, std::vector<WidgetDesc> children = {}, std::string id = "");
632EVENGINE_API_WORLD WidgetDesc spacer(std::string id = "", float grow = 1.f);
633
635EVENGINE_API_WORLD WidgetDesc when(bool cond, WidgetDesc child);
637WidgetDesc whenElse(bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse);
638
643WidgetDesc list(std::string listId, const std::vector<std::string> &items,
645 const std::function<WidgetDesc(const std::string &, int)> &itemFn);
646
648EVENGINE_API_WORLD WidgetDesc listButtons(std::string listId, const std::vector<std::string> &items);
649
651EVENGINE_API_WORLD void applyTree(UIHost *host, WidgetDesc root);
652
657bool applyTreeReconcile(UIHost *host, WidgetDesc root);
658
659} // namespace eve::ui
double y
double x
LogicalId target
bool locked
float w
Definition AnimClip.cpp:738
int root
Definition AnimSmr.cpp:119
std::string selected
std::string title
SQObjectPtr key
Definition ECS.cpp:155
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_WORLD
Definition Export.h:109
int rows
ScriptFieldRegion region
tensor::Graph g
Definition GpuGraph.cpp:7
vk::UniqueImage image
double r
float v
HexVec3 up
HexVec3 left
HexVec3 right
std::int32_t second
std::int32_t c
std::int32_t first
Icon icon
Definition Icons.cpp:11
int h
std::uint32_t height
std::uint32_t width
float ratio
PhysicsJointLink link
std::string label
const char * description
MeleePoint3 b
Definition MeleeHit.cpp:41
double radius
Definition MeleeHit.cpp:42
MeleePoint3 a
Definition MeleeHit.cpp:40
std::shared_ptr< const OceanSprayFrame > previous
std::string body
Object::Ptr value
float d
float t
RoadLaneDirection direction
std::string text
unsigned column
const SquirrelValueOptions & options
AbilityActivationGroup group
int columns
int children
Definition TreeMesh.cpp:432
float size
Definition TreeMesh.cpp:158
UIHostHandle host
std::string payloadType
Definition UISystem.cpp:154
std::string payloadText
Definition UISystem.cpp:155
float fraction
WidgetDesc collapsingHeader(std::string label, std::vector< WidgetDesc > children, std::string id, bool defaultOpen)
Collapsible header containing child widgets.
Definition Widget.cpp:814
WidgetDesc menuItem(std::string label, std::string shortcut, std::string id, std::function< void()> onClick, bool selected)
Selectable menu command with an optional shortcut hint.
Definition Widget.cpp:642
WidgetDesc badge(std::string label, std::string id)
Compact status/category pill. Tint controls its background color.
Definition Widget.cpp:581
WidgetDesc filledImage(std::string id, float width, float height, float fraction)
Linear filled image; value is a fraction, layout retains width/height at zero fill....
Definition Widget.cpp:466
WidgetDesc checkbox(std::string label, bool checked, std::string id, std::function< void(bool)> onToggle)
Checkbox with a label; fires onToggle.
Definition Widget.cpp:387
Icon
Semantic editor icons backed by the bundled Font Awesome 4.7 font.
Definition Icons.h:11
WidgetDesc tabBar(std::vector< WidgetDesc > children, std::string id)
Horizontal strip of Tab children.
Definition Widget.cpp:728
WidgetDesc combo(std::string label, std::vector< std::string > options, int selected, std::string id, std::function< void(float)> onValue)
Combo.
Definition Widget.cpp:439
WidgetDesc statusBar(std::vector< WidgetDesc > children, std::string id)
Compact horizontal status strip; Spacer children absorb free width.
Definition Widget.cpp:688
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:399
WidgetDesc panelFrame(std::string title, std::vector< WidgetDesc > children, std::string id)
Fixed titled panel chrome for dock regions (not a free-floating Window host).
Definition Widget.cpp:767
FlexWrap
Whether Flex children remain on one line or wrap onto additional lines.
Definition UIHost.h:83
void applyTree(UIHost *host, WidgetDesc root)
Full replace flatten.
Definition Widget.cpp:926
FlexDirection
Main-axis direction for Flex containers.
Definition UIHost.h:80
MouseFilter
Pointer event participation and propagation policy.
Definition UIHost.h:107
WidgetDesc whenElse(bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse)
When else.
Definition Widget.cpp:902
WidgetDesc imageButton(std::string id, float width, float height, std::function< void()> onClick)
Image button.
Definition Widget.cpp:512
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:533
WidgetDesc tabContainer(std::vector< WidgetDesc > pages, std::string activePageId, std::string id, std::function< void(const std::string &)> onSelect)
Tab strip plus page bodies; only the active page is visible.
Definition Widget.cpp:739
WidgetDesc resourceBar(std::string id, float width, float height, float fraction)
Composes a display-only resource bar; child IDs are /background, /trail, /value and /label....
Definition Widget.cpp:481
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:888
WidgetDesc child(std::string id, std::vector< WidgetDesc > children, float width, float height)
Scrollable child region with an explicit size.
Definition Widget.cpp:826
NodeType
Widget node kinds understood by the UI renderer.
Definition UIHost.h:32
WidgetDesc when(bool cond, WidgetDesc child)
Conditional: include child only when cond is true (empty group otherwise).
Definition Widget.cpp:897
WidgetDesc appFrame(WidgetDesc body, WidgetDesc toolbarWidget, WidgetDesc statusBarWidget, std::string id)
Fixed editor frame: optional toolbar, growing body, optional status bar. Place as a Window child (Men...
Definition Widget.cpp:793
WidgetDesc toolbar(std::vector< WidgetDesc > children, std::string id)
Horizontal editor command strip; Spacer children absorb free width.
Definition Widget.cpp:655
WidgetDesc menu(std::string label, std::vector< WidgetDesc > children, std::string id)
Popup menu container used inside a MenuBar or another Menu.
Definition Widget.cpp:632
FocusMode
Keyboard/gamepad focus policy for an interactive control.
Definition UIHost.h:101
WidgetDesc skillSlot(std::string id, float size, uint64_t iconTexture, float cooldown, std::string key)
Composes an interactive skill slot; /activate emits clicks, /cooldown is a solid radial overlay....
Definition Widget.cpp:497
FlexJustify
Main-axis distribution of free space in a Flex container.
Definition UIHost.h:92
WidgetDesc colorPalette(std::string label, float r, float g, float b, float a, std::string id, std::function< void(float)> onValue)
Color editor with a swatch grid (调色板). RGBA is stored in tint channels. valueText may list extra swat...
Definition Widget.cpp:413
WidgetDesc ninePatchPanel(std::vector< WidgetDesc > children, std::string id, uint64_t textureId)
Stretchable textured container with asset-defined content padding.
Definition Widget.cpp:603
WidgetDesc iconButton(Icon value, std::string label, std::string id, std::function< void()> onClick)
Button containing a semantic icon and optional visible label.
Definition Widget.cpp:357
WidgetDesc grid(int columns, std::vector< WidgetDesc > children, std::string id)
Fixed-column grid; children are placed in source order.
Definition Widget.cpp:878
ThemePreset
Built-in theme override inherited by a retained UI subtree.
Definition UIHost.h:110
WidgetDesc listButtons(std::string listId, const std::vector< std::string > &items)
Default list: one Button per item, id = listId + "/" + index.
Definition Widget.cpp:919
WidgetDesc viewport(std::string id, float width, float height)
Viewport.
Definition Widget.cpp:523
WidgetDesc searchField(std::string hint, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Compact search field with placeholder text and a bundled search icon.
Definition Widget.cpp:557
WidgetDesc button(std::string label, std::string id, std::function< void()> onClick)
Clickable button; fires onClick.
Definition Widget.cpp:345
WidgetDesc flex(FlexDirection direction, std::vector< WidgetDesc > children, std::string id)
Elastic layout container (row/column). Prefer row / column shorthands.
Definition Widget.cpp:860
WidgetDesc toggleSwitch(std::string label, bool checked, std::string id, std::function< void(bool)> onToggle)
Modern boolean toggle; fires onToggle when changed.
Definition Widget.cpp:569
WidgetDesc sidebar(std::vector< WidgetDesc > children, std::string id, float width)
Vertical editor side panel. Width defaults to 240 logical pixels.
Definition Widget.cpp:678
WidgetDesc card(std::vector< WidgetDesc > children, std::string id)
Bordered surface container with editor-friendly padding.
Definition Widget.cpp:594
OverflowMode
Behavior when arranged children exceed the retained layout box.
Definition UIHost.h:86
bool applyTreeReconcile(UIHost *host, WidgetDesc root)
Patch by key/id when structure (type + child keys) matches; otherwise full replace....
Definition Widget.cpp:940
FillDirection
Direction of a linear image fill; geometry stays inside the original layout box.
Definition HudGeometry.h:11
WidgetDesc row(std::vector< WidgetDesc > children, std::string id)
Horizontal elastic layout row.
Definition Widget.cpp:870
FlexAlign
Cross-axis alignment of Flex children.
Definition UIHost.h:89
WidgetDesc virtualList(std::string listId, const std::vector< std::string > &items, float height, float itemHeight)
Virtual list.
Definition Widget.cpp:849
WidgetDesc toolbox(std::vector< WidgetDesc > children, std::string id, float cellSize, int columns)
Wrapping grid of editor tools with uniform square cells.
Definition Widget.cpp:666
WidgetDesc tab(std::string label, std::string pageId, bool selected, std::string id, std::function< void()> onClick)
Selectable tab label.
Definition Widget.cpp:715
WidgetDesc scrollList(std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
Scroll list.
Definition Widget.cpp:837
WidgetDesc splitPane(FlexDirection direction, WidgetDesc first, WidgetDesc second, float ratio, std::string id, std::function< void(float)> onResize)
Two resizable panes separated by a drag handle.
Definition Widget.cpp:699
WidgetDesc sectionHeader(std::string label, std::string id)
Non-collapsible editor section heading with an accent marker.
Definition Widget.cpp:614
WidgetDesc separator(std::string id)
Horizontal separator line.
Definition Widget.cpp:379
AccessibilityRole
Platform-neutral accessibility role exposed by controls.
Definition UIHost.h:129
WidgetDesc sameLine(std::string id)
Holds the next widget on the same line as the previous one.
Definition Widget.cpp:371
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:906
WidgetDesc dockArea(std::string region, std::vector< WidgetDesc > children, std::string id)
Named dock fill slot; region name is stored in valueText (left/right/top/bottom/center)....
Definition Widget.cpp:780
WidgetDesc radialFill(std::string id, float width, float height, float fraction)
Solid radial cooldown overlay; supports sectors and rings (no texture sampling). @thread UI thread....
Definition Widget.cpp:475
WidgetDesc menuBar(std::vector< WidgetDesc > children, std::string id)
Window menu bar container. Must be a direct child of a Window.
Definition Widget.cpp:623
SettlementPipeline::Stage fn
Declarative widget description (build once / on dirty → flatten into UIHost::Tree).
Definition Widget.h:15
std::vector< WidgetDesc > children
Definition Widget.h:129
uint64_t textureId
Definition Widget.h:83
WidgetDesc & withHelp(std::string help, std::string reason={})
Set always-visible help and an optional disabled explanation.
Definition Widget.h:164
WidgetDesc & withNinePatch(float l, float t, float r, float b)
With nine patch.
Definition Widget.h:334
std::string disabledReason
Explanation shown when interaction is disabled.
Definition Widget.h:26
NodeType type
Definition Widget.h:16
FlexWrap flexWrap
Definition Widget.h:117
bool readOnly
Allow selection and copying while preventing text edits.
Definition Widget.h:32
WidgetDesc & withFlexGrow(float g)
With flex grow.
Definition Widget.h:398
std::string key
Reconciliation key; defaults to id when empty.
Definition Widget.h:19
std::string dragPayloadType
Definition Widget.h:53
std::string placeholder
Empty-input hint; applies to single-line text inputs.
Definition Widget.h:28
WidgetDesc & withVisible(bool v)
With visible.
Definition Widget.h:170
std::string valueText
Definition Widget.h:21
WidgetDesc & withItemHeight(float height)
With item height.
Definition Widget.h:352
WidgetDesc & withFlexShrink(float shrink)
With flex shrink.
Definition Widget.h:403
WidgetDesc & withText(std::string v)
With text.
Definition Widget.h:142
WidgetDesc & withOpen(bool v)
With open.
Definition Widget.h:241
std::string focusDown
Definition Widget.h:47
WidgetDesc & withTooltip(std::string v)
With tooltip.
Definition Widget.h:152
WidgetDesc & withPercent(float w, float h)
With percent.
Definition Widget.h:291
FocusMode focusMode
Definition Widget.h:37
WidgetDesc & withAbsolute(float ax, float ay, float x=0.f, float y=0.f)
With absolute.
Definition Widget.h:308
std::string focusNext
Definition Widget.h:42
WidgetDesc & withJustify(FlexJustify j)
With justify.
Definition Widget.h:393
WidgetDesc & withChecked(bool v)
With checked.
Definition Widget.h:236
WidgetDesc & withTextChange(std::function< void(const std::string &)> fn)
With text change.
Definition Widget.h:433
WidgetDesc & withRange(float lo, float hi)
With range.
Definition Widget.h:251
WidgetDesc & withMouseFilter(MouseFilter v)
Selects whether pointer input stops, passes through, or ignores this widget.
Definition Widget.h:185
std::string accessibilityName
Definition Widget.h:49
WidgetDesc & withCornerRadius(float radius)
With corner radius.
Definition Widget.h:342
WidgetDesc & withPadding(float l, float t, float r, float b)
With padding.
Definition Widget.h:271
WidgetDesc & withMaxSize(float w, float h)
With max size.
Definition Widget.h:285
WidgetDesc & withAccessibility(AccessibilityRole role, std::string name, std::string description={})
Supplies the semantic role and labels exposed to accessibility clients.
Definition Widget.h:215
std::string tooltip
Definition Widget.h:22
WidgetDesc & withTint(float r, float g, float b, float a=1.f)
With tint.
Definition Widget.h:317
WidgetDesc & child(WidgetDesc c)
Child.
Definition Widget.h:438
WidgetDesc & withFocusOrder(std::string previous, std::string next)
Assigns explicit previous and next focus-neighbor widget identifiers.
Definition Widget.h:200
std::string focusPrevious
Definition Widget.h:43
std::string focusRight
Definition Widget.h:45
WidgetDesc & withFlexWrap(FlexWrap wrap)
With flex wrap.
Definition Widget.h:368
MouseFilter mouseFilter
Definition Widget.h:38
std::string accessibilityDescription
Definition Widget.h:50
WidgetDesc & withDropTarget(std::string acceptedType)
Marks this widget as a desktop drop target for one type or "*".
Definition Widget.h:230
WidgetDesc & withMargin(float l, float t, float r, float b)
With margin.
Definition Widget.h:263
WidgetDesc & withMinSize(float w, float h)
With min size.
Definition Widget.h:279
std::function< void()> onClick
Void.
Definition Widget.h:122
WidgetDesc & withSize(float w, float h)
With size.
Definition Widget.h:257
std::string text
Definition Widget.h:20
WidgetDesc & withFlexDirection(FlexDirection d)
With flex direction.
Definition Widget.h:383
std::function< void(const std::string &)> onTextChange
Void.
Definition Widget.h:128
WidgetDesc & withTextInput(bool multi, bool locked=false, std::string hint={})
Configure plain text input and its empty-input hint.
Definition Widget.h:157
WidgetDesc & withAlign(FlexAlign a)
With align.
Definition Widget.h:388
std::function< void(bool)> onToggle
Void.
Definition Widget.h:124
WidgetDesc & withFocusNeighbors(std::string left, std::string right, std::string up, std::string down)
Assigns explicit directional focus-neighbor widget identifiers.
Definition Widget.h:206
WidgetDesc & withUv(float u0, float v0, float u1, float v1)
With uv.
Definition Widget.h:325
WidgetDesc & withKey(std::string v)
With key.
Definition Widget.h:137
WidgetDesc & withGaps(float columns, float rows)
With gaps.
Definition Widget.h:362
WidgetDesc & withToggle(std::function< void(bool)> fn)
With toggle.
Definition Widget.h:423
WidgetDesc & withGap(float g)
With gap.
Definition Widget.h:357
std::string focusLeft
Definition Widget.h:44
WidgetDesc & withValueText(std::string v)
With value text.
Definition Widget.h:147
WidgetDesc & withValue(float v)
With value.
Definition Widget.h:246
WidgetDesc & withClick(std::function< void()> fn)
With click.
Definition Widget.h:418
FlexDirection flexDirection
Definition Widget.h:107
FlexJustify justifyContent
Definition Widget.h:109
WidgetDesc & withWrap(float width)
With wrap.
Definition Widget.h:347
WidgetDesc & withAspectRatio(float ratio)
With aspect ratio.
Definition Widget.h:302
std::string acceptedDropType
Definition Widget.h:55
WidgetDesc & withId(std::string v)
With id.
Definition Widget.h:132
WidgetDesc & withDragSource(std::string payloadType, std::string payloadText)
Marks this widget as a desktop drag source with an owning text payload.
Definition Widget.h:223
std::string styleClass
Definition Widget.h:40
std::string id
Definition Widget.h:17
bool multiline
Use a multiline plain-text editor.
Definition Widget.h:30
WidgetDesc & withStyleClass(std::string v)
Applies a named sparse style class resolved when the tree is built.
Definition Widget.h:297
WidgetDesc & withValueFn(std::function< void(float)> fn)
With value fn.
Definition Widget.h:428
float fillInnerRadius
Definition Widget.h:100
AccessibilityRole accessibilityRole
Definition Widget.h:48
WidgetDesc & withTheme(ThemePreset v)
Overrides the built-in theme for this widget subtree.
Definition Widget.h:190
WidgetDesc & withFocusMode(FocusMode v)
Selects how the widget participates in keyboard focus navigation.
Definition Widget.h:180
WidgetDesc & withTabIndex(int v)
Sets the stable ordering hint used by sequential focus traversal.
Definition Widget.h:195
WidgetDesc & withFlexBasis(float basis)
With flex basis.
Definition Widget.h:408
FlexAlign alignItems
Definition Widget.h:108
const std::string & reconcileKey() const
Reconcile key.
Definition Widget.h:444
std::string focusUp
Definition Widget.h:46
WidgetDesc & withOverflow(OverflowMode mode)
With overflow.
Definition Widget.h:373
std::function< void(float)> onValue
Void.
Definition Widget.h:126
float fillStartDegrees
Definition Widget.h:98
OverflowMode overflow
Definition Widget.h:118
WidgetDesc & withEnabled(bool v)
Sets whether the widget accepts interaction.
Definition Widget.h:175
WidgetDesc & withGridColumnSpan(int span)
With grid column span.
Definition Widget.h:378
WidgetDesc & withAlignSelf(FlexAlign align)
With align self.
Definition Widget.h:413
ThemePreset themePreset
Definition Widget.h:39
std::string dragPayloadText
Definition Widget.h:54
std::string helpText
Plain help shown beneath the control.
Definition Widget.h:24
FillDirection fillDirection
Definition Widget.h:96