载入中...
搜索中...
未找到
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;
23 bool visible = true;
24 bool enabled = true;
25 bool checked = false;
26 bool open = true;
30 std::string styleClass;
31 int tabIndex = 0;
32 std::string focusNext;
33 std::string focusPrevious;
34 std::string focusLeft;
35 std::string focusRight;
36 std::string focusUp;
37 std::string focusDown;
39 std::string accessibilityName;
41 bool dragSource = false;
42 bool dropTarget = false;
43 std::string dragPayloadType;
44 std::string dragPayloadText;
45 std::string acceptedDropType;
46 float value = 0.f;
47 float minValue = 0.f;
48 float maxValue = 1.f;
49 float sizeX = 0.f;
50 float sizeY = 0.f;
51 // --- Layout box model (mirrors UINode) ---
52 float marginL = 0.f;
53 float marginT = 0.f;
54 float marginR = 0.f;
55 float marginB = 0.f;
56 float paddingL = 0.f;
57 float paddingT = 0.f;
58 float paddingR = 0.f;
59 float paddingB = 0.f;
60 float minSizeX = 0.f;
61 float minSizeY = 0.f;
62 float maxSizeX = 0.f;
63 float maxSizeY = 0.f;
64 float percentW = 0.f;
65 float percentH = 0.f;
66 float aspectRatio = 0.f;
67 float anchorX = 0.f;
68 float anchorY = 0.f;
69 float posX = 0.f;
70 float posY = 0.f;
71 bool absolute = false;
72 // --- Image / ImageButton props ---
73 uint64_t textureId = 0;
74 float tintR = 1.f;
75 float tintG = 1.f;
76 float tintB = 1.f;
77 float tintA = 1.f;
78 float uv0x = 0.f;
79 float uv0y = 0.f;
80 float uv1x = 1.f;
81 float uv1y = 1.f;
82 float borderL = 0.f;
83 float borderT = 0.f;
84 float borderR = 0.f;
85 float borderB = 0.f;
86 float cornerRadius = 0.f;
87 float wrapWidth = 0.f;
88 float itemHeight = 0.f; // ScrollList uniform row height
92 float gap = -1.f;
93 float flexGrow = 0.f;
94 float flexShrink = 1.f;
95 float flexBasis = -1.f;
96 int alignSelf = -1;
97 float columnGap = -1.f;
98 float rowGap = -1.f;
101 int gridColumns = 1;
104 std::function<void()> onClick;
106 std::function<void(bool)> onToggle;
108 std::function<void(float)> onValue;
110 std::function<void(const std::string &)> onTextChange;
111 std::vector<WidgetDesc> children;
112
114 WidgetDesc &withId(std::string v) {
115 id = std::move(v);
116 return *this;
117 }
119 WidgetDesc &withKey(std::string v) {
120 key = std::move(v);
121 return *this;
122 }
124 WidgetDesc &withText(std::string v) {
125 text = std::move(v);
126 return *this;
127 }
129 WidgetDesc &withValueText(std::string v) {
130 valueText = std::move(v);
131 return *this;
132 }
134 WidgetDesc &withTooltip(std::string v) {
135 tooltip = std::move(v);
136 return *this;
137 }
140 visible = v;
141 return *this;
142 }
145 enabled = v;
146 return *this;
147 }
150 focusMode = v;
151 return *this;
152 }
155 mouseFilter = v;
156 return *this;
157 }
160 themePreset = v;
161 return *this;
162 }
165 tabIndex = v;
166 return *this;
167 }
169 WidgetDesc &withFocusOrder(std::string previous, std::string next) {
170 focusPrevious = std::move(previous);
171 focusNext = std::move(next);
172 return *this;
173 }
175 WidgetDesc &withFocusNeighbors(std::string left, std::string right, std::string up,
176 std::string down) {
177 focusLeft = std::move(left);
178 focusRight = std::move(right);
179 focusUp = std::move(up);
180 focusDown = std::move(down);
181 return *this;
182 }
185 std::string description = {}) {
186 accessibilityRole = role;
187 accessibilityName = std::move(name);
189 return *this;
190 }
193 dragSource = true;
194 dragPayloadType = std::move(payloadType);
195 dragPayloadText = std::move(payloadText);
196 return *this;
197 }
199 WidgetDesc &withDropTarget(std::string acceptedType) {
200 dropTarget = true;
201 acceptedDropType = std::move(acceptedType);
202 return *this;
203 }
206 checked = v;
207 return *this;
208 }
211 open = v;
212 return *this;
213 }
216 value = v;
217 return *this;
218 }
220 WidgetDesc &withRange(float lo, float hi) {
221 minValue = lo;
222 maxValue = hi;
223 return *this;
224 }
226 WidgetDesc &withSize(float w, float h) {
227 sizeX = w;
228 sizeY = h;
229 return *this;
230 }
232 WidgetDesc &withMargin(float l, float t, float r, float b) {
233 marginL = l;
234 marginT = t;
235 marginR = r;
236 marginB = b;
237 return *this;
238 }
240 WidgetDesc &withPadding(float l, float t, float r, float b) {
241 paddingL = l;
242 paddingT = t;
243 paddingR = r;
244 paddingB = b;
245 return *this;
246 }
248 WidgetDesc &withMinSize(float w, float h) {
249 minSizeX = w;
250 minSizeY = h;
251 return *this;
252 }
254 WidgetDesc &withMaxSize(float w, float h) {
255 maxSizeX = w;
256 maxSizeY = h;
257 return *this;
258 }
260 WidgetDesc &withPercent(float w, float h) {
261 percentW = w;
262 percentH = h;
263 return *this;
264 }
267 styleClass = std::move(v);
268 return *this;
269 }
272 aspectRatio = ratio;
273 return *this;
274 }
277 WidgetDesc &withAbsolute(float ax, float ay, float x = 0.f, float y = 0.f) {
278 absolute = true;
279 anchorX = ax;
280 anchorY = ay;
281 posX = x;
282 posY = y;
283 return *this;
284 }
286 WidgetDesc &withTint(float r, float g, float b, float a = 1.f) {
287 tintR = r;
288 tintG = g;
289 tintB = b;
290 tintA = a;
291 return *this;
292 }
294 WidgetDesc &withUv(float u0, float v0, float u1, float v1) {
295 uv0x = u0;
296 uv0y = v0;
297 uv1x = u1;
298 uv1y = v1;
299 return *this;
300 }
303 WidgetDesc &withNinePatch(float l, float t, float r, float b) {
304 borderL = l;
305 borderT = t;
306 borderR = r;
307 borderB = b;
308 return *this;
309 }
313 return *this;
314 }
318 return *this;
319 }
323 return *this;
324 }
327 gap = g;
328 return *this;
329 }
333 rowGap = rows;
334 return *this;
335 }
338 flexWrap = wrap;
339 return *this;
340 }
343 overflow = mode;
344 return *this;
345 }
348 gridColumnSpan = span;
349 return *this;
350 }
354 return *this;
355 }
358 alignItems = a;
359 return *this;
360 }
363 justifyContent = j;
364 return *this;
365 }
368 flexGrow = g;
369 return *this;
370 }
372 WidgetDesc &withFlexShrink(float shrink) {
373 flexShrink = shrink;
374 return *this;
375 }
377 WidgetDesc &withFlexBasis(float basis) {
378 flexBasis = basis;
379 return *this;
380 }
383 alignSelf = int(align);
384 return *this;
385 }
387 WidgetDesc &withClick(std::function<void()> fn) {
388 onClick = std::move(fn);
389 return *this;
390 }
392 WidgetDesc &withToggle(std::function<void(bool)> fn) {
393 onToggle = std::move(fn);
394 return *this;
395 }
397 WidgetDesc &withValueFn(std::function<void(float)> fn) {
398 onValue = std::move(fn);
399 return *this;
400 }
402 WidgetDesc &withTextChange(std::function<void(const std::string &)> fn) {
403 onTextChange = std::move(fn);
404 return *this;
405 }
408 children.push_back(std::move(c));
409 return *this;
410 }
411
413 const std::string &reconcileKey() const { return key.empty() ? id : key; }
414};
415
417EVENGINE_API_WORLD WidgetDesc window(std::string title, std::vector<WidgetDesc> children = {}, std::string id = "root");
419EVENGINE_API_WORLD WidgetDesc text(std::string content, std::string id = "");
421EVENGINE_API_WORLD WidgetDesc button(std::string label, std::string id = "", std::function<void()> onClick = {});
423EVENGINE_API_WORLD WidgetDesc icon(Icon value, std::string id = "");
425EVENGINE_API_WORLD WidgetDesc iconButton(Icon value, std::string label = "", std::string id = "",
427 std::function<void()> onClick = {});
429EVENGINE_API_WORLD WidgetDesc group(std::vector<WidgetDesc> children = {}, std::string id = "");
431EVENGINE_API_WORLD WidgetDesc sameLine(std::string id = "");
433EVENGINE_API_WORLD WidgetDesc separator(std::string id = "");
435EVENGINE_API_WORLD WidgetDesc checkbox(std::string label, bool checked = false, std::string id = "",
437 std::function<void(bool)> onToggle = {});
439EVENGINE_API_WORLD WidgetDesc slider(std::string label, float value, float minV, float maxV, std::string id = "",
441 std::function<void(float)> onValue = {});
443EVENGINE_API_WORLD WidgetDesc progress(float fraction, std::string id = "", std::string overlay = "");
446EVENGINE_API_WORLD WidgetDesc combo(std::string label, std::vector<std::string> options, int selected,
447 std::string id = "", std::function<void(float)> onValue = {});
450EVENGINE_API_WORLD WidgetDesc image(std::string id = "", float width = 0.f, float height = 0.f,
452 std::function<void()> onClick = {});
454WidgetDesc ninePatchPanel(std::vector<WidgetDesc> children = {}, std::string id = "",
455 uint64_t textureId = 0);
458EVENGINE_API_WORLD WidgetDesc imageButton(std::string id, float width, float height,
460 std::function<void()> onClick = {});
463EVENGINE_API_WORLD WidgetDesc viewport(std::string id = "", float width = 0.f, float height = 0.f);
465EVENGINE_API_WORLD WidgetDesc inputText(std::string label, std::string value, std::string id = "",
467 std::function<void(const std::string &)> onChange = {});
469EVENGINE_API_WORLD WidgetDesc searchField(std::string hint, std::string value = {}, std::string id = "",
471 std::function<void(const std::string &)> onChange = {});
473EVENGINE_API_WORLD WidgetDesc toggleSwitch(std::string label, bool checked = false, std::string id = "",
475 std::function<void(bool)> onToggle = {});
477EVENGINE_API_WORLD WidgetDesc badge(std::string label, std::string id = "");
484EVENGINE_API_WORLD WidgetDesc colorPalette(std::string label, float r, float g, float b, float a = 1.f,
485 std::string id = "", std::function<void(float)> onValue = {});
487EVENGINE_API_WORLD WidgetDesc card(std::vector<WidgetDesc> children = {}, std::string id = "");
489EVENGINE_API_WORLD WidgetDesc sectionHeader(std::string label, std::string id = "");
491EVENGINE_API_WORLD WidgetDesc menuBar(std::vector<WidgetDesc> children = {}, std::string id = "");
493EVENGINE_API_WORLD WidgetDesc menu(std::string label, std::vector<WidgetDesc> children = {}, std::string id = "");
495EVENGINE_API_WORLD WidgetDesc menuItem(std::string label, std::string shortcut = {}, std::string id = "",
497 std::function<void()> onClick = {}, bool selected = false);
499EVENGINE_API_WORLD WidgetDesc toolbar(std::vector<WidgetDesc> children = {}, std::string id = "");
501EVENGINE_API_WORLD WidgetDesc toolbox(std::vector<WidgetDesc> children = {}, std::string id = "", float cellSize = 0.f,
502 int columns = 0);
504EVENGINE_API_WORLD WidgetDesc sidebar(std::vector<WidgetDesc> children = {}, std::string id = "", float width = 0.f);
506EVENGINE_API_WORLD WidgetDesc statusBar(std::vector<WidgetDesc> children = {}, std::string id = "");
512EVENGINE_API_WORLD WidgetDesc splitPane(FlexDirection direction, WidgetDesc first, WidgetDesc second,
513 float ratio = 0.25f, std::string id = "",
515 std::function<void(float)> onResize = {});
517EVENGINE_API_WORLD WidgetDesc collapsingHeader(std::string label, std::vector<WidgetDesc> children = {},
518 std::string id = "", bool defaultOpen = true);
520EVENGINE_API_WORLD WidgetDesc child(std::string id, std::vector<WidgetDesc> children = {}, float width = 0.f,
521 float height = 120.f);
528EVENGINE_API_WORLD WidgetDesc scrollList(std::string id, std::vector<WidgetDesc> children = {}, float height = 0.f,
529 float itemHeight = 0.f);
532EVENGINE_API_WORLD WidgetDesc virtualList(std::string listId, const std::vector<std::string> &items,
533 float height = 200.f, float itemHeight = 0.f);
534
536EVENGINE_API_WORLD WidgetDesc flex(FlexDirection direction, std::vector<WidgetDesc> children = {}, std::string id = "");
538EVENGINE_API_WORLD WidgetDesc row(std::vector<WidgetDesc> children = {}, std::string id = "");
540EVENGINE_API_WORLD WidgetDesc column(std::vector<WidgetDesc> children = {}, std::string id = "");
542EVENGINE_API_WORLD WidgetDesc grid(int columns, std::vector<WidgetDesc> children = {}, std::string id = "");
544EVENGINE_API_WORLD WidgetDesc spacer(std::string id = "", float grow = 1.f);
545
547EVENGINE_API_WORLD WidgetDesc when(bool cond, WidgetDesc child);
549WidgetDesc whenElse(bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse);
550
555WidgetDesc list(std::string listId, const std::vector<std::string> &items,
557 const std::function<WidgetDesc(const std::string &, int)> &itemFn);
558
560EVENGINE_API_WORLD WidgetDesc listButtons(std::string listId, const std::vector<std::string> &items);
561
563EVENGINE_API_WORLD void applyTree(UIHost *host, WidgetDesc root);
564
569bool applyTreeReconcile(UIHost *host, WidgetDesc root);
570
571} // namespace eve::ui
double value
float w
Definition AnimClip.cpp:738
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
int root
Definition AnimSmr.cpp:119
building::EdgeCurveGroup group
int ax
Definition CaveMesh.cpp:113
int ay
Definition CaveMesh.cpp:113
std::string title
std::string label
int column
#define EVENGINE_API_WORLD
Definition Export.h:109
int rows
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
std::string text
std::string description
std::string name
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
graphics::Canvas * previous
float radius
float d
float t
RoadLaneDirection direction
const SquirrelValueOptions & options
int columns
int children
Definition TreeMesh.cpp:295
UIHostHandle host
std::string payloadType
Definition UISystem.cpp:71
std::string payloadText
Definition UISystem.cpp:72
WidgetDesc collapsingHeader(std::string label, std::vector< WidgetDesc > children, std::string id, bool defaultOpen)
Collapsible header containing child widgets.
Definition Widget.cpp:623
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:550
WidgetDesc badge(std::string label, std::string id)
Compact status/category pill. Tint controls its background color.
Definition Widget.cpp:489
WidgetDesc checkbox(std::string label, bool checked, std::string id, std::function< void(bool)> onToggle)
Checkbox with a label; fires onToggle.
Definition Widget.cpp:353
Icon
Semantic editor icons backed by the bundled Font Awesome 4.7 font.
Definition Icons.h:11
WidgetDesc combo(std::string label, std::vector< std::string > options, int selected, std::string id, std::function< void(float)> onValue)
Combo.
Definition Widget.cpp:405
WidgetDesc statusBar(std::vector< WidgetDesc > children, std::string id)
Compact horizontal status strip; Spacer children absorb free width.
Definition Widget.cpp:596
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:365
FlexWrap
Whether Flex children remain on one line or wrap onto additional lines.
Definition UIHost.h:61
void applyTree(UIHost *host, WidgetDesc root)
Full replace flatten.
Definition Widget.cpp:735
FlexDirection
Main-axis direction for Flex containers.
Definition UIHost.h:58
MouseFilter
Pointer event participation and propagation policy.
Definition UIHost.h:85
WidgetDesc whenElse(bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse)
When else.
Definition Widget.cpp:711
WidgetDesc imageButton(std::string id, float width, float height, std::function< void()> onClick)
Image button.
Definition Widget.cpp:432
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:453
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:697
WidgetDesc child(std::string id, std::vector< WidgetDesc > children, float width, float height)
Scrollable child region with an explicit size.
Definition Widget.cpp:635
NodeType
Widget node kinds understood by the UI renderer.
Definition UIHost.h:19
WidgetDesc when(bool cond, WidgetDesc child)
Conditional: include child only when cond is true (empty group otherwise).
Definition Widget.cpp:706
WidgetDesc toolbar(std::vector< WidgetDesc > children, std::string id)
Horizontal editor command strip; Spacer children absorb free width.
Definition Widget.cpp:563
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:540
FocusMode
Keyboard/gamepad focus policy for an interactive control.
Definition UIHost.h:79
WidgetDesc progress(float fraction, std::string id, std::string overlay)
Progress bar; fraction is clamped to [0,1].
Definition Widget.cpp:395
FlexJustify
Main-axis distribution of free space in a Flex container.
Definition UIHost.h:70
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:379
WidgetDesc ninePatchPanel(std::vector< WidgetDesc > children, std::string id, uint64_t textureId)
Stretchable textured container with asset-defined content padding.
Definition Widget.cpp:511
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:323
WidgetDesc grid(int columns, std::vector< WidgetDesc > children, std::string id)
Fixed-column grid; children are placed in source order.
Definition Widget.cpp:687
ThemePreset
Built-in theme override inherited by a retained UI subtree.
Definition UIHost.h:88
WidgetDesc listButtons(std::string listId, const std::vector< std::string > &items)
Default list: one Button per item, id = listId + "/" + index.
Definition Widget.cpp:728
WidgetDesc viewport(std::string id, float width, float height)
Viewport.
Definition Widget.cpp:443
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:465
WidgetDesc button(std::string label, std::string id, std::function< void()> onClick)
Clickable button; fires onClick.
Definition Widget.cpp:311
WidgetDesc flex(FlexDirection direction, std::vector< WidgetDesc > children, std::string id)
Elastic layout container (row/column). Prefer row / column shorthands.
Definition Widget.cpp:669
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:477
WidgetDesc sidebar(std::vector< WidgetDesc > children, std::string id, float width)
Vertical editor side panel. Width defaults to 240 logical pixels.
Definition Widget.cpp:586
WidgetDesc card(std::vector< WidgetDesc > children, std::string id)
Bordered surface container with editor-friendly padding.
Definition Widget.cpp:502
OverflowMode
Behavior when arranged children exceed the retained layout box.
Definition UIHost.h:64
bool applyTreeReconcile(UIHost *host, WidgetDesc root)
Patch by key/id when structure (type + child keys) matches; otherwise full replace....
Definition Widget.cpp:748
WidgetDesc row(std::vector< WidgetDesc > children, std::string id)
Horizontal elastic layout row.
Definition Widget.cpp:679
FlexAlign
Cross-axis alignment of Flex children.
Definition UIHost.h:67
WidgetDesc virtualList(std::string listId, const std::vector< std::string > &items, float height, float itemHeight)
Virtual list.
Definition Widget.cpp:658
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:574
WidgetDesc scrollList(std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
Scroll list.
Definition Widget.cpp:646
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:607
WidgetDesc sectionHeader(std::string label, std::string id)
Non-collapsible editor section heading with an accent marker.
Definition Widget.cpp:522
WidgetDesc separator(std::string id)
Horizontal separator line.
Definition Widget.cpp:345
AccessibilityRole
Platform-neutral accessibility role exposed by controls.
Definition UIHost.h:107
WidgetDesc sameLine(std::string id)
Holds the next widget on the same line as the previous one.
Definition Widget.cpp:337
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:715
WidgetDesc menuBar(std::vector< WidgetDesc > children, std::string id)
Window menu bar container. Must be a direct child of a Window.
Definition Widget.cpp:531
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:111
uint64_t textureId
Definition Widget.h:73
WidgetDesc & withNinePatch(float l, float t, float r, float b)
With nine patch.
Definition Widget.h:303
NodeType type
Definition Widget.h:16
FlexWrap flexWrap
Definition Widget.h:99
WidgetDesc & withFlexGrow(float g)
With flex grow.
Definition Widget.h:367
std::string key
Reconciliation key; defaults to id when empty.
Definition Widget.h:19
std::string dragPayloadType
Definition Widget.h:43
WidgetDesc & withVisible(bool v)
With visible.
Definition Widget.h:139
std::string valueText
Definition Widget.h:21
WidgetDesc & withItemHeight(float height)
With item height.
Definition Widget.h:321
WidgetDesc & withFlexShrink(float shrink)
With flex shrink.
Definition Widget.h:372
WidgetDesc & withText(std::string v)
With text.
Definition Widget.h:124
WidgetDesc & withOpen(bool v)
With open.
Definition Widget.h:210
std::string focusDown
Definition Widget.h:37
WidgetDesc & withTooltip(std::string v)
With tooltip.
Definition Widget.h:134
WidgetDesc & withPercent(float w, float h)
With percent.
Definition Widget.h:260
FocusMode focusMode
Definition Widget.h:27
WidgetDesc & withAbsolute(float ax, float ay, float x=0.f, float y=0.f)
With absolute.
Definition Widget.h:277
std::string focusNext
Definition Widget.h:32
WidgetDesc & withJustify(FlexJustify j)
With justify.
Definition Widget.h:362
WidgetDesc & withChecked(bool v)
With checked.
Definition Widget.h:205
WidgetDesc & withTextChange(std::function< void(const std::string &)> fn)
With text change.
Definition Widget.h:402
WidgetDesc & withRange(float lo, float hi)
With range.
Definition Widget.h:220
WidgetDesc & withMouseFilter(MouseFilter v)
Selects whether pointer input stops, passes through, or ignores this widget.
Definition Widget.h:154
std::string accessibilityName
Definition Widget.h:39
WidgetDesc & withCornerRadius(float radius)
With corner radius.
Definition Widget.h:311
WidgetDesc & withPadding(float l, float t, float r, float b)
With padding.
Definition Widget.h:240
WidgetDesc & withMaxSize(float w, float h)
With max size.
Definition Widget.h:254
WidgetDesc & withAccessibility(AccessibilityRole role, std::string name, std::string description={})
Supplies the semantic role and labels exposed to accessibility clients.
Definition Widget.h:184
std::string tooltip
Definition Widget.h:22
WidgetDesc & withTint(float r, float g, float b, float a=1.f)
With tint.
Definition Widget.h:286
WidgetDesc & child(WidgetDesc c)
Child.
Definition Widget.h:407
WidgetDesc & withFocusOrder(std::string previous, std::string next)
Assigns explicit previous and next focus-neighbor widget identifiers.
Definition Widget.h:169
std::string focusPrevious
Definition Widget.h:33
std::string focusRight
Definition Widget.h:35
WidgetDesc & withFlexWrap(FlexWrap wrap)
With flex wrap.
Definition Widget.h:337
MouseFilter mouseFilter
Definition Widget.h:28
std::string accessibilityDescription
Definition Widget.h:40
WidgetDesc & withDropTarget(std::string acceptedType)
Marks this widget as a desktop drop target for one type or "*".
Definition Widget.h:199
WidgetDesc & withMargin(float l, float t, float r, float b)
With margin.
Definition Widget.h:232
WidgetDesc & withMinSize(float w, float h)
With min size.
Definition Widget.h:248
std::function< void()> onClick
Void.
Definition Widget.h:104
WidgetDesc & withSize(float w, float h)
With size.
Definition Widget.h:226
std::string text
Definition Widget.h:20
WidgetDesc & withFlexDirection(FlexDirection d)
With flex direction.
Definition Widget.h:352
std::function< void(const std::string &)> onTextChange
Void.
Definition Widget.h:110
WidgetDesc & withAlign(FlexAlign a)
With align.
Definition Widget.h:357
std::function< void(bool)> onToggle
Void.
Definition Widget.h:106
WidgetDesc & withFocusNeighbors(std::string left, std::string right, std::string up, std::string down)
Assigns explicit directional focus-neighbor widget identifiers.
Definition Widget.h:175
WidgetDesc & withUv(float u0, float v0, float u1, float v1)
With uv.
Definition Widget.h:294
WidgetDesc & withKey(std::string v)
With key.
Definition Widget.h:119
WidgetDesc & withGaps(float columns, float rows)
With gaps.
Definition Widget.h:331
WidgetDesc & withToggle(std::function< void(bool)> fn)
With toggle.
Definition Widget.h:392
WidgetDesc & withGap(float g)
With gap.
Definition Widget.h:326
std::string focusLeft
Definition Widget.h:34
WidgetDesc & withValueText(std::string v)
With value text.
Definition Widget.h:129
WidgetDesc & withValue(float v)
With value.
Definition Widget.h:215
WidgetDesc & withClick(std::function< void()> fn)
With click.
Definition Widget.h:387
FlexDirection flexDirection
Definition Widget.h:89
FlexJustify justifyContent
Definition Widget.h:91
WidgetDesc & withWrap(float width)
With wrap.
Definition Widget.h:316
WidgetDesc & withAspectRatio(float ratio)
With aspect ratio.
Definition Widget.h:271
std::string acceptedDropType
Definition Widget.h:45
WidgetDesc & withId(std::string v)
With id.
Definition Widget.h:114
WidgetDesc & withDragSource(std::string payloadType, std::string payloadText)
Marks this widget as a desktop drag source with an owning text payload.
Definition Widget.h:192
std::string styleClass
Definition Widget.h:30
std::string id
Definition Widget.h:17
WidgetDesc & withStyleClass(std::string v)
Applies a named sparse style class resolved when the tree is built.
Definition Widget.h:266
WidgetDesc & withValueFn(std::function< void(float)> fn)
With value fn.
Definition Widget.h:397
AccessibilityRole accessibilityRole
Definition Widget.h:38
WidgetDesc & withTheme(ThemePreset v)
Overrides the built-in theme for this widget subtree.
Definition Widget.h:159
WidgetDesc & withFocusMode(FocusMode v)
Selects how the widget participates in keyboard focus navigation.
Definition Widget.h:149
WidgetDesc & withTabIndex(int v)
Sets the stable ordering hint used by sequential focus traversal.
Definition Widget.h:164
WidgetDesc & withFlexBasis(float basis)
With flex basis.
Definition Widget.h:377
FlexAlign alignItems
Definition Widget.h:90
const std::string & reconcileKey() const
Reconcile key.
Definition Widget.h:413
std::string focusUp
Definition Widget.h:36
WidgetDesc & withOverflow(OverflowMode mode)
With overflow.
Definition Widget.h:342
std::function< void(float)> onValue
Void.
Definition Widget.h:108
OverflowMode overflow
Definition Widget.h:100
WidgetDesc & withEnabled(bool v)
Sets whether the widget accepts interaction.
Definition Widget.h:144
WidgetDesc & withGridColumnSpan(int span)
With grid column span.
Definition Widget.h:347
WidgetDesc & withAlignSelf(FlexAlign align)
With align self.
Definition Widget.h:382
ThemePreset themePreset
Definition Widget.h:29
std::string dragPayloadText
Definition Widget.h:44