nomen-lang 0.7.0 → 0.8.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 (50) hide show
  1. package/core/System/Buffer.nm +32 -0
  2. package/core/System/ClassBuffer.nm +24 -0
  3. package/core/System/Controls/Alert.nm +326 -0
  4. package/core/System/Controls/App.nm +147 -0
  5. package/core/System/Controls/Button.nm +119 -1
  6. package/core/System/Controls/CheckBox.nm +24 -0
  7. package/core/System/Controls/ColorPicker.nm +307 -0
  8. package/core/System/Controls/ComboBox.nm +430 -0
  9. package/core/System/Controls/Container.nm +837 -9
  10. package/core/System/Controls/Control.nm +443 -0
  11. package/core/System/Controls/DatePicker.nm +288 -0
  12. package/core/System/Controls/Form.nm +70 -0
  13. package/core/System/Controls/GroupBox.nm +267 -0
  14. package/core/System/Controls/ImageView.nm +311 -0
  15. package/core/System/Controls/LevelIndicator.nm +305 -0
  16. package/core/System/Controls/ListView.nm +633 -0
  17. package/core/System/Controls/Menu.nm +428 -0
  18. package/core/System/Controls/NumberInput.nm +56 -0
  19. package/core/System/Controls/OtpInput.nm +50 -0
  20. package/core/System/Controls/OutlineView.nm +598 -0
  21. package/core/System/Controls/Pagination.nm +142 -0
  22. package/core/System/Controls/Popover.nm +296 -0
  23. package/core/System/Controls/Progress.nm +348 -0
  24. package/core/System/Controls/Radio.nm +292 -0
  25. package/core/System/Controls/Scrollable.nm +584 -0
  26. package/core/System/Controls/SearchField.nm +326 -0
  27. package/core/System/Controls/SecureField.nm +344 -0
  28. package/core/System/Controls/Segmented.nm +380 -0
  29. package/core/System/Controls/Select.nm +340 -0
  30. package/core/System/Controls/Separator.nm +198 -0
  31. package/core/System/Controls/Sheet.nm +329 -0
  32. package/core/System/Controls/Slider.nm +315 -0
  33. package/core/System/Controls/Spinner.nm +287 -0
  34. package/core/System/Controls/SplitView.nm +509 -0
  35. package/core/System/Controls/Stepper.nm +349 -0
  36. package/core/System/Controls/Switch.nm +259 -0
  37. package/core/System/Controls/Table.nm +833 -0
  38. package/core/System/Controls/Tabs.nm +500 -0
  39. package/core/System/Controls/Text.nm +108 -11
  40. package/core/System/Controls/TextBox.nm +112 -1
  41. package/core/System/Controls/TextView.nm +329 -0
  42. package/core/System/Controls/Toggle.nm +346 -0
  43. package/core/System/Controls/Toolbar.nm +501 -0
  44. package/core/System/Controls/Tooltip.nm +76 -0
  45. package/core/System/Controls/Window.nm +1549 -91
  46. package/core/System/List.nm +34 -0
  47. package/core/System/Map.nm +21 -4
  48. package/core/System/Set.nm +14 -0
  49. package/dist/index.mjs +3425 -710
  50. package/package.json +1 -1
@@ -0,0 +1,315 @@
1
+ /**
2
+ * A horizontal value picker over a min/max range (poll per frame)
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
+ * Continuous control: read `value` each frame in the manual event loop.
10
+ **/
11
+ pub mv struct Slider : Control {
12
+ var uint64 handle = 0
13
+
14
+ pub func #init = (self, Window window, float min, float max) {
15
+ ```
16
+ #arch: c
17
+ #platform: macos
18
+ id sl = ((id(*)(id, SEL, CGRect))objc_msgSend)(
19
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSSlider"), sel_registerName("alloc")),
20
+ sel_registerName("initWithFrame:"),
21
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 120, 24));
22
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setMinValue:"), min);
23
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setMaxValue:"), max);
24
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setDoubleValue:"), min);
25
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
26
+ (id)window->handle, sel_registerName("contentView"));
27
+ ((void(*)(id, SEL, id))objc_msgSend)(
28
+ contentView, sel_registerName("addSubview:"), sl);
29
+ self.handle = (uint64_t)sl;
30
+ ```
31
+ ```
32
+ #arch: aarch64_use_c
33
+ #platform: macos
34
+ id sl = ((id(*)(id, SEL, CGRect))objc_msgSend)(
35
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSSlider"), sel_registerName("alloc")),
36
+ sel_registerName("initWithFrame:"),
37
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 120, 24));
38
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setMinValue:"), min);
39
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setMaxValue:"), max);
40
+ ((void(*)(id, SEL, double))objc_msgSend)(sl, sel_registerName("setDoubleValue:"), min);
41
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
42
+ (id)window->handle, sel_registerName("contentView"));
43
+ ((void(*)(id, SEL, id))objc_msgSend)(
44
+ contentView, sel_registerName("addSubview:"), sl);
45
+ self->handle = (uint64_t)sl;
46
+ ```
47
+ ```
48
+ #arch: c
49
+ #platform: ios
50
+ id sl = ((id(*)(id, SEL, CGRect))objc_msgSend)(
51
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UISlider"), sel_registerName("alloc")),
52
+ sel_registerName("initWithFrame:"),
53
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 120, 32));
54
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setMinimumValue:"), (float)min);
55
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setMaximumValue:"), (float)max);
56
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setValue:"), (float)min);
57
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
58
+ ((id(*)(id, SEL))objc_msgSend)(
59
+ (id)window->handle, sel_registerName("rootViewController")),
60
+ sel_registerName("view"));
61
+ ((void(*)(id, SEL, id))objc_msgSend)(
62
+ parentView, sel_registerName("addSubview:"), sl);
63
+ self.handle = (uint64_t)sl;
64
+ ```
65
+ ```
66
+ #arch: aarch64_use_c
67
+ #platform: ios
68
+ id sl = ((id(*)(id, SEL, CGRect))objc_msgSend)(
69
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UISlider"), sel_registerName("alloc")),
70
+ sel_registerName("initWithFrame:"),
71
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 120, 32));
72
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setMinimumValue:"), (float)min);
73
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setMaximumValue:"), (float)max);
74
+ ((void(*)(id, SEL, float))objc_msgSend)(sl, sel_registerName("setValue:"), (float)min);
75
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
76
+ ((id(*)(id, SEL))objc_msgSend)(
77
+ (id)window->handle, sel_registerName("rootViewController")),
78
+ sel_registerName("view"));
79
+ ((void(*)(id, SEL, id))objc_msgSend)(
80
+ parentView, sel_registerName("addSubview:"), sl);
81
+ self->handle = (uint64_t)sl;
82
+ ```
83
+ }
84
+
85
+ pub func set_frame = (ref self, int x, int y, int width, int height) {
86
+ ```
87
+ #arch: c
88
+ #platform: macos
89
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
90
+ (id)self->handle, sel_registerName("setFrame:"),
91
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
92
+ ```
93
+ ```
94
+ #arch: aarch64_use_c
95
+ #platform: macos
96
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
97
+ (id)self->handle, sel_registerName("setFrame:"),
98
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
99
+ ```
100
+ ```
101
+ #arch: c
102
+ #platform: ios
103
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
104
+ (id)self->handle, sel_registerName("setFrame:"),
105
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
106
+ ```
107
+ ```
108
+ #arch: aarch64_use_c
109
+ #platform: ios
110
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
111
+ (id)self->handle, sel_registerName("setFrame:"),
112
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
113
+ ```
114
+ }
115
+
116
+ pub func set_min = (self, float min) {
117
+ ```
118
+ #arch: c
119
+ #platform: macos
120
+ ((void(*)(id, SEL, double))objc_msgSend)(
121
+ (id)self->handle, sel_registerName("setMinValue:"), min);
122
+ ```
123
+ ```
124
+ #arch: aarch64_use_c
125
+ #platform: macos
126
+ ((void(*)(id, SEL, double))objc_msgSend)(
127
+ (id)self->handle, sel_registerName("setMinValue:"), min);
128
+ ```
129
+ ```
130
+ #arch: c
131
+ #platform: ios
132
+ ((void(*)(id, SEL, float))objc_msgSend)(
133
+ (id)self->handle, sel_registerName("setMinimumValue:"), (float)min);
134
+ ```
135
+ ```
136
+ #arch: aarch64_use_c
137
+ #platform: ios
138
+ ((void(*)(id, SEL, float))objc_msgSend)(
139
+ (id)self->handle, sel_registerName("setMinimumValue:"), (float)min);
140
+ ```
141
+ }
142
+
143
+ pub func set_max = (self, float max) {
144
+ ```
145
+ #arch: c
146
+ #platform: macos
147
+ ((void(*)(id, SEL, double))objc_msgSend)(
148
+ (id)self->handle, sel_registerName("setMaxValue:"), max);
149
+ ```
150
+ ```
151
+ #arch: aarch64_use_c
152
+ #platform: macos
153
+ ((void(*)(id, SEL, double))objc_msgSend)(
154
+ (id)self->handle, sel_registerName("setMaxValue:"), max);
155
+ ```
156
+ ```
157
+ #arch: c
158
+ #platform: ios
159
+ ((void(*)(id, SEL, float))objc_msgSend)(
160
+ (id)self->handle, sel_registerName("setMaximumValue:"), (float)max);
161
+ ```
162
+ ```
163
+ #arch: aarch64_use_c
164
+ #platform: ios
165
+ ((void(*)(id, SEL, float))objc_msgSend)(
166
+ (id)self->handle, sel_registerName("setMaximumValue:"), (float)max);
167
+ ```
168
+ }
169
+
170
+ pub func set_value = (self, float value) {
171
+ ```
172
+ #arch: c
173
+ #platform: macos
174
+ ((void(*)(id, SEL, double))objc_msgSend)(
175
+ (id)self->handle, sel_registerName("setDoubleValue:"), value);
176
+ ```
177
+ ```
178
+ #arch: aarch64_use_c
179
+ #platform: macos
180
+ ((void(*)(id, SEL, double))objc_msgSend)(
181
+ (id)self->handle, sel_registerName("setDoubleValue:"), value);
182
+ ```
183
+ ```
184
+ #arch: c
185
+ #platform: ios
186
+ ((void(*)(id, SEL, float))objc_msgSend)(
187
+ (id)self->handle, sel_registerName("setValue:"), (float)value);
188
+ ```
189
+ ```
190
+ #arch: aarch64_use_c
191
+ #platform: ios
192
+ ((void(*)(id, SEL, float))objc_msgSend)(
193
+ (id)self->handle, sel_registerName("setValue:"), (float)value);
194
+ ```
195
+ }
196
+
197
+ pub func value = (self, out float) {
198
+ ```
199
+ #arch: c
200
+ #platform: macos
201
+ return ((double(*)(id, SEL))objc_msgSend)(
202
+ (id)self->handle, sel_registerName("doubleValue"));
203
+ ```
204
+ ```
205
+ #arch: aarch64_use_c
206
+ #platform: macos
207
+ return ((double(*)(id, SEL))objc_msgSend)(
208
+ (id)self->handle, sel_registerName("doubleValue"));
209
+ ```
210
+ ```
211
+ #arch: c
212
+ #platform: ios
213
+ return (double)((float(*)(id, SEL))objc_msgSend)(
214
+ (id)self->handle, sel_registerName("value"));
215
+ ```
216
+ ```
217
+ #arch: aarch64_use_c
218
+ #platform: ios
219
+ return (double)((float(*)(id, SEL))objc_msgSend)(
220
+ (id)self->handle, sel_registerName("value"));
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
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
241
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
242
+ ```
243
+ ```
244
+ #arch: aarch64_use_c
245
+ #platform: ios
246
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
247
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
248
+ ```
249
+ }
250
+
251
+ // ── Control trait conformance ──
252
+ pub func intrinsic_size = (self, out Size) {
253
+ var [w, h] = native_intrinsic(self.handle)
254
+ var s = Size()
255
+ s.width = w
256
+ s.height = h
257
+ return s
258
+ }
259
+
260
+ pub func measure = (self, BoxConstraints constraints, out Size) {
261
+ var Size s = self.intrinsic_size()
262
+ if s.width > constraints.max_width {
263
+ s.width = constraints.max_width
264
+ }
265
+ if s.width < constraints.min_width {
266
+ s.width = constraints.min_width
267
+ }
268
+ if s.height > constraints.max_height {
269
+ s.height = constraints.max_height
270
+ }
271
+ if s.height < constraints.min_height {
272
+ s.height = constraints.min_height
273
+ }
274
+ return s
275
+ }
276
+
277
+ func #destroy = () {
278
+ ```
279
+ #arch: c
280
+ #platform: macos
281
+ if (self->handle) {
282
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
283
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
284
+ self->handle = 0;
285
+ }
286
+ ```
287
+ ```
288
+ #arch: aarch64_use_c
289
+ #platform: macos
290
+ if (self->handle) {
291
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
292
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
293
+ self->handle = 0;
294
+ }
295
+ ```
296
+ ```
297
+ #arch: c
298
+ #platform: ios
299
+ if (self->handle) {
300
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
301
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
302
+ self->handle = 0;
303
+ }
304
+ ```
305
+ ```
306
+ #arch: aarch64_use_c
307
+ #platform: ios
308
+ if (self->handle) {
309
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
310
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
311
+ self->handle = 0;
312
+ }
313
+ ```
314
+ }
315
+ }
@@ -0,0 +1,287 @@
1
+ /**
2
+ * An indeterminate spinning activity indicator
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
+ * On macOS this is the same NSProgressIndicator as `Progress`, styled as a
10
+ * spinner; on iOS it is the distinct UIActivityIndicatorView. `spinning` is
11
+ * tracked at the Nomen level (NSProgressIndicator has no isSpinning getter),
12
+ * so `is_spinning` reads true exactly between start() and stop().
13
+ **/
14
+ pub mv struct Spinner : Control {
15
+ var uint64 handle = 0
16
+ var bool spinning = false
17
+
18
+ pub func #init = (self, Window window) {
19
+ ```
20
+ #arch: c
21
+ #platform: macos
22
+ id spin = ((id(*)(id, SEL, CGRect))objc_msgSend)(
23
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSProgressIndicator"), sel_registerName("alloc")),
24
+ sel_registerName("initWithFrame:"),
25
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 22, 22));
26
+ ((void(*)(id, SEL, long))objc_msgSend)(
27
+ spin, sel_registerName("setStyle:"), 1); // NSProgressIndicatorSpinningStyle = 1
28
+ ((void(*)(id, SEL, unsigned long))objc_msgSend)(
29
+ spin, sel_registerName("setControlSize:"), 1); // NSControlSizeSmall = 1
30
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(spin, sel_registerName("setIndeterminate:"), 1);
31
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(spin, sel_registerName("setUsesThreadedAnimation:"), 1);
32
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
33
+ (id)window->handle, sel_registerName("contentView"));
34
+ ((void(*)(id, SEL, id))objc_msgSend)(
35
+ contentView, sel_registerName("addSubview:"), spin);
36
+ self.handle = (uint64_t)spin;
37
+ self.spinning = 0;
38
+ ```
39
+ ```
40
+ #arch: aarch64_use_c
41
+ #platform: macos
42
+ id spin = ((id(*)(id, SEL, CGRect))objc_msgSend)(
43
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSProgressIndicator"), sel_registerName("alloc")),
44
+ sel_registerName("initWithFrame:"),
45
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 22, 22));
46
+ ((void(*)(id, SEL, long))objc_msgSend)(
47
+ spin, sel_registerName("setStyle:"), 1); // NSProgressIndicatorSpinningStyle = 1
48
+ ((void(*)(id, SEL, unsigned long))objc_msgSend)(
49
+ spin, sel_registerName("setControlSize:"), 1); // NSControlSizeSmall = 1
50
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(spin, sel_registerName("setIndeterminate:"), 1);
51
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(spin, sel_registerName("setUsesThreadedAnimation:"), 1);
52
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
53
+ (id)window->handle, sel_registerName("contentView"));
54
+ ((void(*)(id, SEL, id))objc_msgSend)(
55
+ contentView, sel_registerName("addSubview:"), spin);
56
+ self->handle = (uint64_t)spin;
57
+ self->spinning = 0;
58
+ ```
59
+ ```
60
+ #arch: c
61
+ #platform: ios
62
+ id spin = ((id(*)(id, SEL, long, CGRect))objc_msgSend)(
63
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UIActivityIndicatorView"), sel_registerName("alloc")),
64
+ sel_registerName("initWithFrame:"),
65
+ 100, // UIActivityIndicatorViewStyleMedium = 100
66
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 20, 20));
67
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
68
+ ((id(*)(id, SEL))objc_msgSend)(
69
+ (id)window->handle, sel_registerName("rootViewController")),
70
+ sel_registerName("view"));
71
+ ((void(*)(id, SEL, id))objc_msgSend)(
72
+ parentView, sel_registerName("addSubview:"), spin);
73
+ self.handle = (uint64_t)spin;
74
+ self.spinning = 0;
75
+ ```
76
+ ```
77
+ #arch: aarch64_use_c
78
+ #platform: ios
79
+ id spin = ((id(*)(id, SEL, long, CGRect))objc_msgSend)(
80
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UIActivityIndicatorView"), sel_registerName("alloc")),
81
+ sel_registerName("initWithFrame:"),
82
+ 100, // UIActivityIndicatorViewStyleMedium = 100
83
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 20, 20));
84
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
85
+ ((id(*)(id, SEL))objc_msgSend)(
86
+ (id)window->handle, sel_registerName("rootViewController")),
87
+ sel_registerName("view"));
88
+ ((void(*)(id, SEL, id))objc_msgSend)(
89
+ parentView, sel_registerName("addSubview:"), spin);
90
+ self->handle = (uint64_t)spin;
91
+ self->spinning = 0;
92
+ ```
93
+ }
94
+
95
+ pub func set_frame = (ref self, int x, int y, int width, int height) {
96
+ ```
97
+ #arch: c
98
+ #platform: macos
99
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
100
+ (id)self->handle, sel_registerName("setFrame:"),
101
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
102
+ ```
103
+ ```
104
+ #arch: aarch64_use_c
105
+ #platform: macos
106
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
107
+ (id)self->handle, sel_registerName("setFrame:"),
108
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
109
+ ```
110
+ ```
111
+ #arch: c
112
+ #platform: ios
113
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
114
+ (id)self->handle, sel_registerName("setFrame:"),
115
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
116
+ ```
117
+ ```
118
+ #arch: aarch64_use_c
119
+ #platform: ios
120
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
121
+ (id)self->handle, sel_registerName("setFrame:"),
122
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
123
+ ```
124
+ }
125
+
126
+ pub func start = (ref self) {
127
+ ```
128
+ #arch: c
129
+ #platform: macos
130
+ ((void(*)(id, SEL, id))objc_msgSend)(
131
+ (id)self->handle, sel_registerName("startAnimation:"), (id)0);
132
+ self->spinning = 1;
133
+ ```
134
+ ```
135
+ #arch: aarch64_use_c
136
+ #platform: macos
137
+ ((void(*)(id, SEL, id))objc_msgSend)(
138
+ (id)self->handle, sel_registerName("startAnimation:"), (id)0);
139
+ self->spinning = 1;
140
+ ```
141
+ ```
142
+ #arch: c
143
+ #platform: ios
144
+ ((void(*)(id, SEL))objc_msgSend)(
145
+ (id)self->handle, sel_registerName("startAnimating"));
146
+ self->spinning = 1;
147
+ ```
148
+ ```
149
+ #arch: aarch64_use_c
150
+ #platform: ios
151
+ ((void(*)(id, SEL))objc_msgSend)(
152
+ (id)self->handle, sel_registerName("startAnimating"));
153
+ self->spinning = 1;
154
+ ```
155
+ }
156
+
157
+ pub func stop = (ref self) {
158
+ ```
159
+ #arch: c
160
+ #platform: macos
161
+ ((void(*)(id, SEL, id))objc_msgSend)(
162
+ (id)self->handle, sel_registerName("stopAnimation:"), (id)0);
163
+ self->spinning = 0;
164
+ ```
165
+ ```
166
+ #arch: aarch64_use_c
167
+ #platform: macos
168
+ ((void(*)(id, SEL, id))objc_msgSend)(
169
+ (id)self->handle, sel_registerName("stopAnimation:"), (id)0);
170
+ self->spinning = 0;
171
+ ```
172
+ ```
173
+ #arch: c
174
+ #platform: ios
175
+ ((void(*)(id, SEL))objc_msgSend)(
176
+ (id)self->handle, sel_registerName("stopAnimating"));
177
+ self->spinning = 0;
178
+ ```
179
+ ```
180
+ #arch: aarch64_use_c
181
+ #platform: ios
182
+ ((void(*)(id, SEL))objc_msgSend)(
183
+ (id)self->handle, sel_registerName("stopAnimating"));
184
+ self->spinning = 0;
185
+ ```
186
+ }
187
+
188
+ pub func is_spinning = (self, out bool) {
189
+ return self.spinning
190
+ }
191
+
192
+ pub func set_hidden = (self, bool hidden) {
193
+ ```
194
+ #arch: c
195
+ #platform: macos
196
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
197
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
198
+ ```
199
+ ```
200
+ #arch: aarch64_use_c
201
+ #platform: macos
202
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
203
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
204
+ ```
205
+ ```
206
+ #arch: c
207
+ #platform: ios
208
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
209
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
210
+ ```
211
+ ```
212
+ #arch: aarch64_use_c
213
+ #platform: ios
214
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
215
+ (id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
216
+ ```
217
+ }
218
+
219
+ // ── Control trait conformance ──
220
+ pub func intrinsic_size = (self, out Size) {
221
+ var [w, h] = native_intrinsic(self.handle)
222
+ var s = Size()
223
+ s.width = w
224
+ s.height = h
225
+ return s
226
+ }
227
+
228
+ pub func measure = (self, BoxConstraints constraints, out Size) {
229
+ var Size s = self.intrinsic_size()
230
+ if s.width > constraints.max_width {
231
+ s.width = constraints.max_width
232
+ }
233
+ if s.width < constraints.min_width {
234
+ s.width = constraints.min_width
235
+ }
236
+ if s.height > constraints.max_height {
237
+ s.height = constraints.max_height
238
+ }
239
+ if s.height < constraints.min_height {
240
+ s.height = constraints.min_height
241
+ }
242
+ return s
243
+ }
244
+
245
+ func #destroy = () {
246
+ ```
247
+ #arch: c
248
+ #platform: macos
249
+ if (self->handle) {
250
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("stopAnimation:"), (id)0);
251
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
252
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
253
+ self->handle = 0;
254
+ }
255
+ ```
256
+ ```
257
+ #arch: aarch64_use_c
258
+ #platform: macos
259
+ if (self->handle) {
260
+ ((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("stopAnimation:"), (id)0);
261
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
262
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
263
+ self->handle = 0;
264
+ }
265
+ ```
266
+ ```
267
+ #arch: c
268
+ #platform: ios
269
+ if (self->handle) {
270
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("stopAnimating"));
271
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
272
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
273
+ self->handle = 0;
274
+ }
275
+ ```
276
+ ```
277
+ #arch: aarch64_use_c
278
+ #platform: ios
279
+ if (self->handle) {
280
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("stopAnimating"));
281
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
282
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
283
+ self->handle = 0;
284
+ }
285
+ ```
286
+ }
287
+ }