nomen-lang 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/audit_runtime.c +12 -2
  2. package/core/System/Arena.nm +8 -1
  3. package/core/System/Buffer.nm +397 -8
  4. package/core/System/ClassBuffer.nm +156 -0
  5. package/core/System/Controls/Alert.nm +326 -0
  6. package/core/System/Controls/App.nm +147 -0
  7. package/core/System/Controls/Button.nm +119 -1
  8. package/core/System/Controls/CheckBox.nm +25 -1
  9. package/core/System/Controls/ColorPicker.nm +307 -0
  10. package/core/System/Controls/ComboBox.nm +430 -0
  11. package/core/System/Controls/Container.nm +843 -9
  12. package/core/System/Controls/Control.nm +443 -0
  13. package/core/System/Controls/DatePicker.nm +288 -0
  14. package/core/System/Controls/Form.nm +70 -0
  15. package/core/System/Controls/GroupBox.nm +267 -0
  16. package/core/System/Controls/ImageView.nm +311 -0
  17. package/core/System/Controls/LevelIndicator.nm +305 -0
  18. package/core/System/Controls/ListView.nm +633 -0
  19. package/core/System/Controls/Menu.nm +428 -0
  20. package/core/System/Controls/NumberInput.nm +56 -0
  21. package/core/System/Controls/OtpInput.nm +50 -0
  22. package/core/System/Controls/OutlineView.nm +598 -0
  23. package/core/System/Controls/Pagination.nm +142 -0
  24. package/core/System/Controls/Popover.nm +296 -0
  25. package/core/System/Controls/Progress.nm +348 -0
  26. package/core/System/Controls/Radio.nm +292 -0
  27. package/core/System/Controls/Scrollable.nm +584 -0
  28. package/core/System/Controls/SearchField.nm +326 -0
  29. package/core/System/Controls/SecureField.nm +344 -0
  30. package/core/System/Controls/Segmented.nm +380 -0
  31. package/core/System/Controls/Select.nm +340 -0
  32. package/core/System/Controls/Separator.nm +198 -0
  33. package/core/System/Controls/Sheet.nm +329 -0
  34. package/core/System/Controls/Slider.nm +315 -0
  35. package/core/System/Controls/Spinner.nm +287 -0
  36. package/core/System/Controls/SplitView.nm +509 -0
  37. package/core/System/Controls/Stepper.nm +349 -0
  38. package/core/System/Controls/Switch.nm +259 -0
  39. package/core/System/Controls/Table.nm +833 -0
  40. package/core/System/Controls/Tabs.nm +500 -0
  41. package/core/System/Controls/Text.nm +108 -11
  42. package/core/System/Controls/TextBox.nm +113 -2
  43. package/core/System/Controls/TextView.nm +329 -0
  44. package/core/System/Controls/Toggle.nm +346 -0
  45. package/core/System/Controls/Toolbar.nm +501 -0
  46. package/core/System/Controls/Tooltip.nm +76 -0
  47. package/core/System/Controls/Window.nm +1548 -91
  48. package/core/System/LinkedList.nm +8 -1
  49. package/core/System/List.nm +97 -7
  50. package/core/System/Map.nm +191 -18
  51. package/core/System/Mutex.nm +4 -4
  52. package/core/System/Random.nm +3 -4
  53. package/core/System/Set.nm +101 -13
  54. package/core/System/StableList.nm +371 -0
  55. package/core/System/Stream/Directory.nm +2 -2
  56. package/core/System/Stream/File.nm +2 -2
  57. package/core/System/Stream/Http.nm +2 -2
  58. package/core/System/String.nm +10 -5
  59. package/core/System/StringBuilder.nm +213 -2
  60. package/core/System/Text/CharIndex.nm +9 -9
  61. package/core/System/Text/Json.nm +60 -46
  62. package/core/System/Text/JsonTree.nm +120 -92
  63. package/core/System/Text/Regex.nm +23 -18
  64. package/core/System/Text/Utf8.nm +5 -5
  65. package/core/System/float.nm +36 -22
  66. package/core/System/int.nm +80 -28
  67. package/core/System/int16.nm +11 -0
  68. package/core/System/int32.nm +11 -0
  69. package/core/System/int64.nm +11 -0
  70. package/core/System/int8.nm +11 -0
  71. package/core/System/uint.nm +11 -0
  72. package/core/System/uint16.nm +11 -0
  73. package/core/System/uint32.nm +11 -0
  74. package/core/System/uint64.nm +11 -0
  75. package/core/System/uint8.nm +11 -0
  76. package/core/docs/System/StringBuilder.md +6 -0
  77. package/core/docs/System/Text/JsonTree.md +3 -2
  78. package/dist/index.mjs +38332 -30604
  79. package/package.json +1 -1
  80. package/src/bench_loop.nm +9 -9
@@ -0,0 +1,311 @@
1
+ /**
2
+ * A static image (file path or named system symbol)
3
+ *
4
+ * An OWNING STRUCT (STRUCT_PLAN_3 Phase R, tranche 4 — the shape menu): the
5
+ * single field is a platform handle, so the value is movable and its
6
+ * `#destroy` releases what the handle names. The constructor's `self` is
7
+ * the inline instance (the `.` accessor); methods keep the pointer form.
8
+ *
9
+ * `set_path` loads from the filesystem; `set_symbol` uses the system
10
+ * symbol/SF Symbol set. A failed load leaves the view empty (`has_image`
11
+ * reads false) — there is no error channel for images.
12
+ **/
13
+ pub mv struct ImageView: Control {
14
+ var uint64 handle = 0
15
+
16
+ pub func #init = (self, Window window) {
17
+ ```
18
+ #arch: c
19
+ #platform: macos
20
+ id iv = ((id(*)(id, SEL, CGRect))objc_msgSend)(
21
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSImageView"), sel_registerName("alloc")),
22
+ sel_registerName("initWithFrame:"),
23
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 64, 64));
24
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
25
+ (id)window->handle, sel_registerName("contentView"));
26
+ ((void(*)(id, SEL, id))objc_msgSend)(
27
+ contentView, sel_registerName("addSubview:"), iv);
28
+ self.handle = (uint64_t)iv;
29
+ ```
30
+ ```
31
+ #arch: aarch64_use_c
32
+ #platform: macos
33
+ id iv = ((id(*)(id, SEL, CGRect))objc_msgSend)(
34
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSImageView"), sel_registerName("alloc")),
35
+ sel_registerName("initWithFrame:"),
36
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 64, 64));
37
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
38
+ (id)window->handle, sel_registerName("contentView"));
39
+ ((void(*)(id, SEL, id))objc_msgSend)(
40
+ contentView, sel_registerName("addSubview:"), iv);
41
+ self->handle = (uint64_t)iv;
42
+ ```
43
+ ```
44
+ #arch: c
45
+ #platform: ios
46
+ id iv = ((id(*)(id, SEL, CGRect))objc_msgSend)(
47
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UIImageView"), sel_registerName("alloc")),
48
+ sel_registerName("initWithFrame:"),
49
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 64, 64));
50
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
51
+ ((id(*)(id, SEL))objc_msgSend)(
52
+ (id)window->handle, sel_registerName("rootViewController")),
53
+ sel_registerName("view"));
54
+ ((void(*)(id, SEL, id))objc_msgSend)(
55
+ parentView, sel_registerName("addSubview:"), iv);
56
+ self.handle = (uint64_t)iv;
57
+ ```
58
+ ```
59
+ #arch: aarch64_use_c
60
+ #platform: ios
61
+ id iv = ((id(*)(id, SEL, CGRect))objc_msgSend)(
62
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UIImageView"), sel_registerName("alloc")),
63
+ sel_registerName("initWithFrame:"),
64
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 64, 64));
65
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
66
+ ((id(*)(id, SEL))objc_msgSend)(
67
+ (id)window->handle, sel_registerName("rootViewController")),
68
+ sel_registerName("view"));
69
+ ((void(*)(id, SEL, id))objc_msgSend)(
70
+ parentView, sel_registerName("addSubview:"), iv);
71
+ self->handle = (uint64_t)iv;
72
+ ```
73
+ }
74
+
75
+ pub func set_frame = (ref self, int x, int y, int width, int height) {
76
+ ```
77
+ #arch: c
78
+ #platform: macos
79
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
80
+ (id)self->handle, sel_registerName("setFrame:"),
81
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
82
+ ```
83
+ ```
84
+ #arch: aarch64_use_c
85
+ #platform: macos
86
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
87
+ (id)self->handle, sel_registerName("setFrame:"),
88
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
89
+ ```
90
+ ```
91
+ #arch: c
92
+ #platform: ios
93
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
94
+ (id)self->handle, sel_registerName("setFrame:"),
95
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
96
+ ```
97
+ ```
98
+ #arch: aarch64_use_c
99
+ #platform: ios
100
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
101
+ (id)self->handle, sel_registerName("setFrame:"),
102
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
103
+ ```
104
+ }
105
+
106
+ // Load the image at `path`. A missing/undecodable file clears the view.
107
+ pub func set_path = (self, string path) {
108
+ ```
109
+ #arch: c
110
+ #platform: macos
111
+ id path_str = ((id(*)(id, SEL, const char*))objc_msgSend)(
112
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), path.ptr);
113
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
114
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSImage"), sel_registerName("alloc")),
115
+ sel_registerName("initWithContentsOfFile:"), path_str);
116
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
117
+ if (img) ((void(*)(id, SEL))objc_msgSend)(img, sel_registerName("release"));
118
+ ```
119
+ ```
120
+ #arch: aarch64_use_c
121
+ #platform: macos
122
+ id path_str = ((id(*)(id, SEL, const char*))objc_msgSend)(
123
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), path.ptr);
124
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
125
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSImage"), sel_registerName("alloc")),
126
+ sel_registerName("initWithContentsOfFile:"), path_str);
127
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
128
+ if (img) ((void(*)(id, SEL))objc_msgSend)(img, sel_registerName("release"));
129
+ ```
130
+ ```
131
+ #arch: c
132
+ #platform: ios
133
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
134
+ (id)objc_getClass("UIImage"), sel_registerName("imageWithContentsOfFile:"),
135
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
136
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), path.ptr));
137
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
138
+ ```
139
+ ```
140
+ #arch: aarch64_use_c
141
+ #platform: ios
142
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
143
+ (id)objc_getClass("UIImage"), sel_registerName("imageWithContentsOfFile:"),
144
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
145
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), path.ptr));
146
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
147
+ ```
148
+ }
149
+
150
+ // Load a named system symbol (SF Symbols). An unknown name clears the view.
151
+ pub func set_symbol = (self, string name) {
152
+ ```
153
+ #arch: c
154
+ #platform: macos
155
+ id img = ((id(*)(id, SEL, id, id))objc_msgSend)(
156
+ (id)objc_getClass("NSImage"), sel_registerName("imageWithSystemSymbolName:accessibilityDescription:"),
157
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
158
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), name.ptr),
159
+ (id)0);
160
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
161
+ ```
162
+ ```
163
+ #arch: aarch64_use_c
164
+ #platform: macos
165
+ id img = ((id(*)(id, SEL, id, id))objc_msgSend)(
166
+ (id)objc_getClass("NSImage"), sel_registerName("imageWithSystemSymbolName:accessibilityDescription:"),
167
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
168
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), name.ptr),
169
+ (id)0);
170
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
171
+ ```
172
+ ```
173
+ #arch: c
174
+ #platform: ios
175
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
176
+ (id)objc_getClass("UIImage"), sel_registerName("systemImageNamed:"),
177
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
178
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), name.ptr));
179
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
180
+ ```
181
+ ```
182
+ #arch: aarch64_use_c
183
+ #platform: ios
184
+ id img = ((id(*)(id, SEL, id))objc_msgSend)(
185
+ (id)objc_getClass("UIImage"), sel_registerName("systemImageNamed:"),
186
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
187
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), name.ptr));
188
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("setImage:"), img);
189
+ ```
190
+ }
191
+
192
+ // True when the view currently holds an image.
193
+ pub func has_image = (self, out bool) {
194
+ ```
195
+ #arch: c
196
+ #platform: macos
197
+ id img = ((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("image"));
198
+ return img != (id)0 ? 1 : 0;
199
+ ```
200
+ ```
201
+ #arch: aarch64_use_c
202
+ #platform: macos
203
+ id img = ((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("image"));
204
+ return img != (id)0 ? 1 : 0;
205
+ ```
206
+ ```
207
+ #arch: c
208
+ #platform: ios
209
+ id img = ((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("image"));
210
+ return img != (id)0 ? 1 : 0;
211
+ ```
212
+ ```
213
+ #arch: aarch64_use_c
214
+ #platform: ios
215
+ id img = ((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("image"));
216
+ return img != (id)0 ? 1 : 0;
217
+ ```
218
+ }
219
+
220
+ pub func set_hidden = (self, bool hidden) {
221
+ ```
222
+ #arch: c
223
+ #platform: macos
224
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
225
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
226
+ ```
227
+ ```
228
+ #arch: aarch64_use_c
229
+ #platform: macos
230
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
231
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
232
+ ```
233
+ ```
234
+ #arch: c
235
+ #platform: ios
236
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
237
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
238
+ ```
239
+ ```
240
+ #arch: aarch64_use_c
241
+ #platform: ios
242
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
243
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
244
+ ```
245
+ }
246
+
247
+ // ── Control trait conformance ──
248
+ pub func intrinsic_size = (self, out Size) {
249
+ var [w, h] = native_intrinsic(self.handle)
250
+ var s = Size()
251
+ s.width = w
252
+ s.height = h
253
+ return s
254
+ }
255
+
256
+ pub func measure = (self, BoxConstraints constraints, out Size) {
257
+ var Size s = self.intrinsic_size()
258
+ if s.width > constraints.max_width {
259
+ s.width = constraints.max_width
260
+ }
261
+ if s.width < constraints.min_width {
262
+ s.width = constraints.min_width
263
+ }
264
+ if s.height > constraints.max_height {
265
+ s.height = constraints.max_height
266
+ }
267
+ if s.height < constraints.min_height {
268
+ s.height = constraints.min_height
269
+ }
270
+ return s
271
+ }
272
+
273
+ func #destroy = () {
274
+ ```
275
+ #arch: c
276
+ #platform: macos
277
+ if (self->handle) {
278
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
279
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
280
+ self->handle = 0;
281
+ }
282
+ ```
283
+ ```
284
+ #arch: aarch64_use_c
285
+ #platform: macos
286
+ if (self->handle) {
287
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
288
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
289
+ self->handle = 0;
290
+ }
291
+ ```
292
+ ```
293
+ #arch: c
294
+ #platform: ios
295
+ if (self->handle) {
296
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
297
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
298
+ self->handle = 0;
299
+ }
300
+ ```
301
+ ```
302
+ #arch: aarch64_use_c
303
+ #platform: ios
304
+ if (self->handle) {
305
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
306
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
307
+ self->handle = 0;
308
+ }
309
+ ```
310
+ }
311
+ }
@@ -0,0 +1,305 @@
1
+ /**
2
+ * A capacity/rating display (stars, discrete or continuous fill)
3
+ *
4
+ * An OWNING STRUCT (STRUCT_PLAN_3 Phase R, tranche 4 — the shape menu): the
5
+ * single field is a platform handle, so the value is movable and its
6
+ * `#destroy` releases what the handle names. The constructor's `self` is
7
+ * the inline instance (the `.` accessor); methods keep the pointer form.
8
+ *
9
+ * macOS-only (NSLevelIndicator has no iOS counterpart; see GUI_PLAN
10
+ * Tier 1 #16 — the iOS blocks are TODO stubs). Styles: 0 relevancy,
11
+ * 1 discrete capacity, 2 continuous capacity, 3 rating (stars).
12
+ **/
13
+ pub mv struct LevelIndicator: Control {
14
+ var uint64 handle = 0
15
+
16
+ pub func #init = (self, Window window) {
17
+ ```
18
+ #arch: c
19
+ #platform: macos
20
+ id li = ((id(*)(id, SEL, CGRect))objc_msgSend)(
21
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSLevelIndicator"), sel_registerName("alloc")),
22
+ sel_registerName("initWithFrame:"),
23
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 80, 22));
24
+ ((void(*)(id, SEL, long))objc_msgSend)(
25
+ li, sel_registerName("setLevelIndicatorStyle:"), 3); // NSRatingLevelIndicatorStyle = 3
26
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setMinValue:"), 0.0);
27
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setMaxValue:"), 5.0);
28
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setDoubleValue:"), 0.0);
29
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
30
+ (id)window->handle, sel_registerName("contentView"));
31
+ ((void(*)(id, SEL, id))objc_msgSend)(
32
+ contentView, sel_registerName("addSubview:"), li);
33
+ self.handle = (uint64_t)li;
34
+ ```
35
+ ```
36
+ #arch: aarch64_use_c
37
+ #platform: macos
38
+ id li = ((id(*)(id, SEL, CGRect))objc_msgSend)(
39
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSLevelIndicator"), sel_registerName("alloc")),
40
+ sel_registerName("initWithFrame:"),
41
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 80, 22));
42
+ ((void(*)(id, SEL, long))objc_msgSend)(
43
+ li, sel_registerName("setLevelIndicatorStyle:"), 3); // NSRatingLevelIndicatorStyle = 3
44
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setMinValue:"), 0.0);
45
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setMaxValue:"), 5.0);
46
+ ((void(*)(id, SEL, double))objc_msgSend)(li, sel_registerName("setDoubleValue:"), 0.0);
47
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
48
+ (id)window->handle, sel_registerName("contentView"));
49
+ ((void(*)(id, SEL, id))objc_msgSend)(
50
+ contentView, sel_registerName("addSubview:"), li);
51
+ self->handle = (uint64_t)li;
52
+ ```
53
+ ```
54
+ #arch: c
55
+ #platform: ios
56
+ /* TODO: iOS — no native level indicator (see GUI_PLAN Tier 1 #16;
57
+ * compose from a Button row of symbols if needed). */
58
+ ```
59
+ ```
60
+ #arch: aarch64_use_c
61
+ #platform: ios
62
+ /* TODO: iOS — no native level indicator (see GUI_PLAN Tier 1 #16;
63
+ * compose from a Button row of symbols if needed). */
64
+ ```
65
+ }
66
+
67
+ pub func set_frame = (ref self, int x, int y, int width, int height) {
68
+ ```
69
+ #arch: c
70
+ #platform: macos
71
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
72
+ (id)self->handle, sel_registerName("setFrame:"),
73
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
74
+ ```
75
+ ```
76
+ #arch: aarch64_use_c
77
+ #platform: macos
78
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
79
+ (id)self->handle, sel_registerName("setFrame:"),
80
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
81
+ ```
82
+ ```
83
+ #arch: c
84
+ #platform: ios
85
+ /* TODO: iOS (see #init) */
86
+ ```
87
+ ```
88
+ #arch: aarch64_use_c
89
+ #platform: ios
90
+ /* TODO: iOS (see #init) */
91
+ ```
92
+ }
93
+
94
+ // 0 relevancy, 1 discrete capacity, 2 continuous capacity, 3 rating stars.
95
+ pub func set_style = (self, int style) {
96
+ ```
97
+ #arch: c
98
+ #platform: macos
99
+ ((void(*)(id, SEL, long))objc_msgSend)(
100
+ (id)self->handle, sel_registerName("setLevelIndicatorStyle:"), (long)style);
101
+ ```
102
+ ```
103
+ #arch: aarch64_use_c
104
+ #platform: macos
105
+ ((void(*)(id, SEL, long))objc_msgSend)(
106
+ (id)self->handle, sel_registerName("setLevelIndicatorStyle:"), (long)style);
107
+ ```
108
+ ```
109
+ #arch: c
110
+ #platform: ios
111
+ /* TODO: iOS (see #init) */
112
+ ```
113
+ ```
114
+ #arch: aarch64_use_c
115
+ #platform: ios
116
+ /* TODO: iOS (see #init) */
117
+ ```
118
+ }
119
+
120
+ pub func set_max = (self, float max) {
121
+ ```
122
+ #arch: c
123
+ #platform: macos
124
+ ((void(*)(id, SEL, double))objc_msgSend)(
125
+ (id)self->handle, sel_registerName("setMaxValue:"), max);
126
+ ```
127
+ ```
128
+ #arch: aarch64_use_c
129
+ #platform: macos
130
+ ((void(*)(id, SEL, double))objc_msgSend)(
131
+ (id)self->handle, sel_registerName("setMaxValue:"), max);
132
+ ```
133
+ ```
134
+ #arch: c
135
+ #platform: ios
136
+ /* TODO: iOS (see #init) */
137
+ ```
138
+ ```
139
+ #arch: aarch64_use_c
140
+ #platform: ios
141
+ /* TODO: iOS (see #init) */
142
+ ```
143
+ }
144
+
145
+ pub func set_value = (self, float value) {
146
+ ```
147
+ #arch: c
148
+ #platform: macos
149
+ ((void(*)(id, SEL, double))objc_msgSend)(
150
+ (id)self->handle, sel_registerName("setDoubleValue:"), value);
151
+ ```
152
+ ```
153
+ #arch: aarch64_use_c
154
+ #platform: macos
155
+ ((void(*)(id, SEL, double))objc_msgSend)(
156
+ (id)self->handle, sel_registerName("setDoubleValue:"), value);
157
+ ```
158
+ ```
159
+ #arch: c
160
+ #platform: ios
161
+ /* TODO: iOS (see #init) */
162
+ ```
163
+ ```
164
+ #arch: aarch64_use_c
165
+ #platform: ios
166
+ /* TODO: iOS (see #init) */
167
+ ```
168
+ }
169
+
170
+ pub func value = (self, out float) {
171
+ ```
172
+ #arch: c
173
+ #platform: macos
174
+ return ((double(*)(id, SEL))objc_msgSend)(
175
+ (id)self->handle, sel_registerName("doubleValue"));
176
+ ```
177
+ ```
178
+ #arch: aarch64_use_c
179
+ #platform: macos
180
+ return ((double(*)(id, SEL))objc_msgSend)(
181
+ (id)self->handle, sel_registerName("doubleValue"));
182
+ ```
183
+ ```
184
+ #arch: c
185
+ #platform: ios
186
+ /* TODO: iOS (see #init) */
187
+ return 0.0;
188
+ ```
189
+ ```
190
+ #arch: aarch64_use_c
191
+ #platform: ios
192
+ /* TODO: iOS (see #init) */
193
+ return 0.0;
194
+ ```
195
+ }
196
+
197
+ pub func max = (self, out float) {
198
+ ```
199
+ #arch: c
200
+ #platform: macos
201
+ return ((double(*)(id, SEL))objc_msgSend)(
202
+ (id)self->handle, sel_registerName("maxValue"));
203
+ ```
204
+ ```
205
+ #arch: aarch64_use_c
206
+ #platform: macos
207
+ return ((double(*)(id, SEL))objc_msgSend)(
208
+ (id)self->handle, sel_registerName("maxValue"));
209
+ ```
210
+ ```
211
+ #arch: c
212
+ #platform: ios
213
+ /* TODO: iOS (see #init) */
214
+ return 0.0;
215
+ ```
216
+ ```
217
+ #arch: aarch64_use_c
218
+ #platform: ios
219
+ /* TODO: iOS (see #init) */
220
+ return 0.0;
221
+ ```
222
+ }
223
+
224
+ pub func set_hidden = (self, bool hidden) {
225
+ ```
226
+ #arch: c
227
+ #platform: macos
228
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
229
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
230
+ ```
231
+ ```
232
+ #arch: aarch64_use_c
233
+ #platform: macos
234
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
235
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
236
+ ```
237
+ ```
238
+ #arch: c
239
+ #platform: ios
240
+ /* TODO: iOS (see #init) */
241
+ ```
242
+ ```
243
+ #arch: aarch64_use_c
244
+ #platform: ios
245
+ /* TODO: iOS (see #init) */
246
+ ```
247
+ }
248
+
249
+ // ── Control trait conformance ──
250
+ pub func intrinsic_size = (self, out Size) {
251
+ var [w, h] = native_intrinsic(self.handle)
252
+ var s = Size()
253
+ s.width = w
254
+ s.height = h
255
+ return s
256
+ }
257
+
258
+ pub func measure = (self, BoxConstraints constraints, out Size) {
259
+ var Size s = self.intrinsic_size()
260
+ if s.width > constraints.max_width {
261
+ s.width = constraints.max_width
262
+ }
263
+ if s.width < constraints.min_width {
264
+ s.width = constraints.min_width
265
+ }
266
+ if s.height > constraints.max_height {
267
+ s.height = constraints.max_height
268
+ }
269
+ if s.height < constraints.min_height {
270
+ s.height = constraints.min_height
271
+ }
272
+ return s
273
+ }
274
+
275
+ func #destroy = () {
276
+ ```
277
+ #arch: c
278
+ #platform: macos
279
+ if (self->handle) {
280
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
281
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
282
+ self->handle = 0;
283
+ }
284
+ ```
285
+ ```
286
+ #arch: aarch64_use_c
287
+ #platform: macos
288
+ if (self->handle) {
289
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
290
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
291
+ self->handle = 0;
292
+ }
293
+ ```
294
+ ```
295
+ #arch: c
296
+ #platform: ios
297
+ /* TODO: iOS (see #init) */
298
+ ```
299
+ ```
300
+ #arch: aarch64_use_c
301
+ #platform: ios
302
+ /* TODO: iOS (see #init) */
303
+ ```
304
+ }
305
+ }