nomen-lang 0.8.0 → 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.
- package/audit_runtime.c +12 -2
- package/core/System/Arena.nm +8 -1
- package/core/System/Buffer.nm +366 -9
- package/core/System/ClassBuffer.nm +133 -1
- package/core/System/Controls/Alert.nm +2 -2
- package/core/System/Controls/App.nm +12 -12
- package/core/System/Controls/Button.nm +1 -1
- package/core/System/Controls/CheckBox.nm +2 -2
- package/core/System/Controls/ColorPicker.nm +1 -1
- package/core/System/Controls/ComboBox.nm +1 -1
- package/core/System/Controls/Container.nm +7 -1
- package/core/System/Controls/GroupBox.nm +1 -1
- package/core/System/Controls/ImageView.nm +1 -1
- package/core/System/Controls/LevelIndicator.nm +1 -1
- package/core/System/Controls/ListView.nm +1 -1
- package/core/System/Controls/Menu.nm +1 -1
- package/core/System/Controls/OutlineView.nm +1 -1
- package/core/System/Controls/Pagination.nm +8 -8
- package/core/System/Controls/Popover.nm +1 -1
- package/core/System/Controls/Progress.nm +1 -1
- package/core/System/Controls/Radio.nm +2 -2
- package/core/System/Controls/SearchField.nm +1 -1
- package/core/System/Controls/SecureField.nm +1 -1
- package/core/System/Controls/Segmented.nm +1 -1
- package/core/System/Controls/Select.nm +1 -1
- package/core/System/Controls/Separator.nm +1 -1
- package/core/System/Controls/Sheet.nm +1 -1
- package/core/System/Controls/Slider.nm +1 -1
- package/core/System/Controls/Spinner.nm +2 -2
- package/core/System/Controls/SplitView.nm +1 -1
- package/core/System/Controls/Stepper.nm +1 -1
- package/core/System/Controls/Switch.nm +1 -1
- package/core/System/Controls/Table.nm +1 -1
- package/core/System/Controls/Tabs.nm +1 -1
- package/core/System/Controls/Text.nm +1 -1
- package/core/System/Controls/TextBox.nm +2 -2
- package/core/System/Controls/TextView.nm +1 -1
- package/core/System/Controls/Toggle.nm +2 -2
- package/core/System/Controls/Toolbar.nm +1 -1
- package/core/System/Controls/Window.nm +1 -2
- package/core/System/LinkedList.nm +8 -1
- package/core/System/List.nm +68 -12
- package/core/System/Map.nm +174 -18
- package/core/System/Mutex.nm +4 -4
- package/core/System/Random.nm +3 -4
- package/core/System/Set.nm +94 -20
- package/core/System/StableList.nm +371 -0
- package/core/System/Stream/Directory.nm +2 -2
- package/core/System/Stream/File.nm +2 -2
- package/core/System/Stream/Http.nm +2 -2
- package/core/System/String.nm +10 -5
- package/core/System/StringBuilder.nm +213 -2
- package/core/System/Text/CharIndex.nm +9 -9
- package/core/System/Text/Json.nm +60 -46
- package/core/System/Text/JsonTree.nm +120 -92
- package/core/System/Text/Regex.nm +23 -18
- package/core/System/Text/Utf8.nm +5 -5
- package/core/System/float.nm +36 -22
- package/core/System/int.nm +80 -28
- package/core/System/int16.nm +11 -0
- package/core/System/int32.nm +11 -0
- package/core/System/int64.nm +11 -0
- package/core/System/int8.nm +11 -0
- package/core/System/uint.nm +11 -0
- package/core/System/uint16.nm +11 -0
- package/core/System/uint32.nm +11 -0
- package/core/System/uint64.nm +11 -0
- package/core/System/uint8.nm +11 -0
- package/core/docs/System/StringBuilder.md +6 -0
- package/core/docs/System/Text/JsonTree.md +3 -2
- package/dist/index.mjs +36575 -30747
- package/package.json +1 -1
- package/src/bench_loop.nm +9 -9
|
@@ -65,7 +65,7 @@ pub struct ClassBuffer<T> {
|
|
|
65
65
|
// handles, so the slot's CONTENT is the instance pointer: return the
|
|
66
66
|
// stored word, not the slot's address. Library-internal: bounds are the
|
|
67
67
|
// caller's obligation (the List wrapper constrains them).
|
|
68
|
-
|
|
68
|
+
internal func slot_ptr = (ref self, int i, out ptr T) {
|
|
69
69
|
```
|
|
70
70
|
#arch: c
|
|
71
71
|
// The slot's address: through the alias, reads and writes hit the
|
|
@@ -118,6 +118,15 @@ pub struct ClassBuffer<T> {
|
|
|
118
118
|
```
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// Labeled delegation point for raw-body callers in other containers
|
|
122
|
+
// (StableList's chunked storage calls this): `load` is `inline` — spliced
|
|
123
|
+
// at Nomen call sites, so no label exists for a raw C call or `bl` to
|
|
124
|
+
// target. Mirror of Buffer.load_from (class slots are pointer words —
|
|
125
|
+
// the pointer load IS the borrow form).
|
|
126
|
+
internal func load_from = (self, int i: i >= 0 && i < self.cap, out T) {
|
|
127
|
+
return self.load(i)
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
// Store the owned class pointer `val` into slot `i`, which MUST be fresh
|
|
122
131
|
// (calloc'd, or zeroed by mv/move_int). Takes OWNERSHIP of `val`
|
|
123
132
|
// (`mv`): the slot's #destroy reclaims the instance, so the caller must
|
|
@@ -141,6 +150,42 @@ pub struct ClassBuffer<T> {
|
|
|
141
150
|
```
|
|
142
151
|
}
|
|
143
152
|
|
|
153
|
+
// Initialize this buffer as a VIEW over a foreign slab (INTERNAL — the
|
|
154
|
+
// chunked-container primitive): `data` becomes `slab` and `cap` becomes
|
|
155
|
+
// `fill`, and the buffer owns NOTHING — the slab keeps its real owner
|
|
156
|
+
// (never grown, never freed by the view). Mirror of Buffer.init_view;
|
|
157
|
+
// class slots are pointer words.
|
|
158
|
+
internal func init_view = (ref self, uint64 slab, int fill: fill >= 0) {
|
|
159
|
+
self.data = slab
|
|
160
|
+
self.cap = fill
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Clear a view initialized by init_view (see Buffer.clear_view): the
|
|
164
|
+
// holder's own field destroy then reclaims nothing.
|
|
165
|
+
internal func clear_view = (ref self) {
|
|
166
|
+
self.data = 0
|
|
167
|
+
self.cap = 0
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Store the owned class pointer `val` into slot `slot` of a foreign slab
|
|
171
|
+
// at `slab` (fill `fill`) through this buffer as a transient view —
|
|
172
|
+
// INTERNAL (StableList's directory chunks, class elements): init the
|
|
173
|
+
// view, run the typed `store` (the ownership-transferring slot store),
|
|
174
|
+
// then clear the view so the holder's teardown reclaims nothing. The
|
|
175
|
+
// holder passes a ClassBuffer FIELD, never a local (a local owning buffer
|
|
176
|
+
// is auto-destroyed at scope exit and would free the borrowed slab).
|
|
177
|
+
internal func store_in_slab = (
|
|
178
|
+
ref self,
|
|
179
|
+
uint64 slab,
|
|
180
|
+
int fill: fill >= 0,
|
|
181
|
+
int slot: slot >= 0,
|
|
182
|
+
mv T val
|
|
183
|
+
) {
|
|
184
|
+
self.init_view(slab, fill)
|
|
185
|
+
self.store(slot, val)
|
|
186
|
+
self.clear_view()
|
|
187
|
+
}
|
|
188
|
+
|
|
144
189
|
// Move a class pointer out of a slot: return it and zero the slot so the
|
|
145
190
|
// buffer no longer references it. Declared `mv out T` so the borrow
|
|
146
191
|
// checker treats the result as OWNED — the slot is relinquished, so the
|
|
@@ -278,6 +323,40 @@ pub struct ClassBuffer<T> {
|
|
|
278
323
|
```
|
|
279
324
|
}
|
|
280
325
|
|
|
326
|
+
// Reclaim slot i's owned class pointer (destroy + free) WITHOUT writing
|
|
327
|
+
// the slot — the destroy half of replace_int, without the store, zeroing
|
|
328
|
+
// the handle so a re-destroy is a no-op. The caller (Map.set_slot_ptr's
|
|
329
|
+
// replace path — the value-side sibling of `values.replace`) overwrites
|
|
330
|
+
// the slot immediately afterwards. Contract: the slot must be
|
|
331
|
+
// overwritten before it is read or destroyed again.
|
|
332
|
+
internal func destroy_at = (ref self, int i: i >= 0 && i < self.cap) {
|
|
333
|
+
```
|
|
334
|
+
#arch: c
|
|
335
|
+
long *slots = (long*)(unsigned long long)self->data;
|
|
336
|
+
if (slots[i]) {
|
|
337
|
+
T_destroy((void*)slots[i]);
|
|
338
|
+
free((void*)slots[i]);
|
|
339
|
+
slots[i] = 0;
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
```
|
|
343
|
+
#arch: aarch64
|
|
344
|
+
stp x20, x21, [sp, #-16]!
|
|
345
|
+
ldr x20, [x19, #8]
|
|
346
|
+
lsl x3, x1, #3
|
|
347
|
+
add x20, x20, x3
|
|
348
|
+
ldr x0, [x20]
|
|
349
|
+
cbz x0, .Lcb_destroy_at_done
|
|
350
|
+
mov x21, x0
|
|
351
|
+
bl T_destroy
|
|
352
|
+
mov x0, x21
|
|
353
|
+
bl _free
|
|
354
|
+
str xzr, [x20]
|
|
355
|
+
.Lcb_destroy_at_done:
|
|
356
|
+
ldp x20, x21, [sp], #16
|
|
357
|
+
```
|
|
358
|
+
}
|
|
359
|
+
|
|
281
360
|
// T-typed alias of replace_int: free the outgoing class pointer (destroy +
|
|
282
361
|
// free) then store the new one. Used by List.set so the uniform API
|
|
283
362
|
// preserves ownership for class elements.
|
|
@@ -363,6 +442,59 @@ pub struct ClassBuffer<T> {
|
|
|
363
442
|
```
|
|
364
443
|
}
|
|
365
444
|
|
|
445
|
+
// Bulk transfer for backward-shift deletion — the ClassBuffer
|
|
446
|
+
// counterpart of Buffer.move_range (same contract: every slot in
|
|
447
|
+
// [dst, dst + count) must be DEAD — zeroed by a move-out or otherwise
|
|
448
|
+
// unowned — because the block move overwrites without reclaiming; the
|
|
449
|
+
// deletion algorithms zero and relocate in lockstep). Slots are 8-byte
|
|
450
|
+
// instance pointers, so the block is one memmove + one memset of the
|
|
451
|
+
// source slots the destination never covers — List.remove_at_or_panic's
|
|
452
|
+
// whole-tail shift instead of per-element `shift` calls.
|
|
453
|
+
internal inline func move_range = (
|
|
454
|
+
ref self,
|
|
455
|
+
int dst: dst >= 0,
|
|
456
|
+
int src: src >= dst,
|
|
457
|
+
int count: count >= 0 && src + count <= self.cap
|
|
458
|
+
) {
|
|
459
|
+
```
|
|
460
|
+
#arch: c
|
|
461
|
+
if (count > 0) {
|
|
462
|
+
long *slots = (long*)(unsigned long long)self->data;
|
|
463
|
+
memmove((void*)&slots[dst], (void*)&slots[src],
|
|
464
|
+
(unsigned long long)count * sizeof(long));
|
|
465
|
+
memset((void*)&slots[dst + count], 0,
|
|
466
|
+
(unsigned long long)(src - dst) * sizeof(long));
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
```
|
|
470
|
+
#arch: aarch64
|
|
471
|
+
// x19 = self, x1 = dst, x2 = src, x3 = count. x0-x18 die across the
|
|
472
|
+
// bl calls, so the block math parks on the stack around _memmove.
|
|
473
|
+
cbz x3, .Lcb_move_range_T_end
|
|
474
|
+
ldr x4, [x19, #8]
|
|
475
|
+
lsl x5, x1, #3
|
|
476
|
+
add x6, x4, x5
|
|
477
|
+
lsl x5, x2, #3
|
|
478
|
+
add x7, x4, x5
|
|
479
|
+
lsl x9, x3, #3
|
|
480
|
+
sub x10, x2, x1
|
|
481
|
+
lsl x10, x10, #3
|
|
482
|
+
stp x6, x9, [sp, #-16]!
|
|
483
|
+
str x10, [sp, #-16]!
|
|
484
|
+
mov x0, x6
|
|
485
|
+
mov x1, x7
|
|
486
|
+
mov x2, x9
|
|
487
|
+
bl _memmove
|
|
488
|
+
ldr x10, [sp], #16
|
|
489
|
+
ldp x6, x9, [sp], #16
|
|
490
|
+
add x0, x6, x9
|
|
491
|
+
mov x1, #0
|
|
492
|
+
mov x2, x10
|
|
493
|
+
bl _memset
|
|
494
|
+
.Lcb_move_range_T_end:
|
|
495
|
+
```
|
|
496
|
+
}
|
|
497
|
+
|
|
366
498
|
// A non-mv (ptr, len) slice [start, end) over this buffer's class
|
|
367
499
|
// pointers, returned as a `view T` (T is a class, so each element is an
|
|
368
500
|
// 8-byte pointer). Borrows from self — invalidated on reassignment. Mirrors
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* UIAlertController needs a presenting view controller (TODO stubs; see
|
|
13
13
|
* GUI_PLAN Tier 1 #19).
|
|
14
14
|
**/
|
|
15
|
-
pub mv struct Alert
|
|
15
|
+
pub mv struct Alert: Control {
|
|
16
16
|
var uint64 handle = 0
|
|
17
17
|
|
|
18
18
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
19
19
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
20
20
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
21
|
-
#handle = () {}
|
|
21
|
+
#handle = () { }
|
|
22
22
|
|
|
23
23
|
pub func #init = (self) {
|
|
24
24
|
```
|
|
@@ -102,7 +102,7 @@ pub trait App {
|
|
|
102
102
|
pub mv struct FrameEvents {
|
|
103
103
|
// 0 = no mouse-down this frame, 1 = left, 2 = right (edge-triggered:
|
|
104
104
|
// only the frame that pumped the event reports it).
|
|
105
|
-
pub var
|
|
105
|
+
pub var click = 0
|
|
106
106
|
pub var int click_x = -1
|
|
107
107
|
pub var int click_y = -1
|
|
108
108
|
// The full mouse record for this frame (0 = no mouse-down): the 1-based
|
|
@@ -112,14 +112,14 @@ pub mv struct FrameEvents {
|
|
|
112
112
|
// 0x40000, Shift = 0x20000). The same values the `win.mouse_button()` /
|
|
113
113
|
// `mouse_click_count()` / `mouse_modifiers()` getters report to
|
|
114
114
|
// `on_mouse_down` handlers. `click` remains the left/right compat view.
|
|
115
|
-
pub var
|
|
116
|
-
pub var
|
|
117
|
-
pub var
|
|
115
|
+
pub var mouse_button = 0
|
|
116
|
+
pub var mouse_click_count = 0
|
|
117
|
+
pub var mouse_modifiers = 0
|
|
118
118
|
// This frame's accumulated scroll-wheel deltas (dy positive scrolling
|
|
119
119
|
// up/away, dx positive right; trackpad frames sum every small event).
|
|
120
120
|
// `Scrollable.on_scroll` is the registered-handler form.
|
|
121
|
-
pub var
|
|
122
|
-
pub var
|
|
121
|
+
pub var scroll_dx = 0
|
|
122
|
+
pub var scroll_dy = 0
|
|
123
123
|
// The keyboard record for this frame (-1 = no key this frame): the
|
|
124
124
|
// hardware keycode of the last key-down (Space = 49, Return = 36,
|
|
125
125
|
// arrows = 123–126, letters a…z = 0–25), the modifiers at key-down,
|
|
@@ -127,8 +127,8 @@ pub mv struct FrameEvents {
|
|
|
127
127
|
// `on_key_down` / `on_key_up` are the registered-handler forms; text
|
|
128
128
|
// ENTRY flows through `on_input` (the field editor), not here.
|
|
129
129
|
pub var int key_code = -1
|
|
130
|
-
pub var
|
|
131
|
-
pub var
|
|
130
|
+
pub var key_modifiers = 0
|
|
131
|
+
pub var key_repeat = false
|
|
132
132
|
pub var int key_up_code = -1
|
|
133
133
|
// The pointer-MOVE record for this frame (-1 = no movement): the
|
|
134
134
|
// current pointer position. `on_mouse_move` is the registered-handler
|
|
@@ -137,11 +137,11 @@ pub mv struct FrameEvents {
|
|
|
137
137
|
pub var int mouse_y = -1
|
|
138
138
|
// Milliseconds since the previous frame (0 on the first) — the
|
|
139
139
|
// animation clock. `win.dt()` reports the same value.
|
|
140
|
-
pub var
|
|
140
|
+
pub var dt = 0
|
|
141
141
|
// True when the window's content rect changed since the last frame —
|
|
142
142
|
// the framework has already re-laid-out the registered roots; re-layout
|
|
143
143
|
// App-owned panes (tab pages, split panes) here.
|
|
144
|
-
pub var
|
|
145
|
-
pub var
|
|
146
|
-
pub var
|
|
144
|
+
pub var resized = false
|
|
145
|
+
pub var width = 0
|
|
146
|
+
pub var height = 0
|
|
147
147
|
}
|
|
@@ -12,7 +12,7 @@ pub mv struct Button: Control {
|
|
|
12
12
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
13
13
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
14
14
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
15
|
-
#handle = () {}
|
|
15
|
+
#handle = () { }
|
|
16
16
|
|
|
17
17
|
pub func #init = (self, Window window, string title) {
|
|
18
18
|
```
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* `#destroy` releases what the handle names. The constructor's `self` is
|
|
7
7
|
* the inline instance (the `.` accessor); methods keep the pointer form.
|
|
8
8
|
**/
|
|
9
|
-
pub mv struct CheckBox
|
|
9
|
+
pub mv struct CheckBox: Control {
|
|
10
10
|
var uint64 handle = 0
|
|
11
11
|
|
|
12
12
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
13
13
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
14
14
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
15
|
-
#handle = () {}
|
|
15
|
+
#handle = () { }
|
|
16
16
|
|
|
17
17
|
pub func #init = (self, Window window) {
|
|
18
18
|
```
|
|
@@ -18,7 +18,7 @@ pub struct Rgb {
|
|
|
18
18
|
* Components travel as 0-255 ints; the platform stores 0-1 doubles, so the
|
|
19
19
|
* round trip is exact to ±1 (the getters round).
|
|
20
20
|
**/
|
|
21
|
-
pub mv struct ColorPicker
|
|
21
|
+
pub mv struct ColorPicker: Control {
|
|
22
22
|
var uint64 handle = 0
|
|
23
23
|
|
|
24
24
|
pub func #init = (self, Window window) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* macOS-only (NSComboBox has no iOS counterpart — see GUI_PLAN Tier 2; the
|
|
13
13
|
* iOS blocks are TODO stubs).
|
|
14
14
|
**/
|
|
15
|
-
pub mv struct ComboBox
|
|
15
|
+
pub mv struct ComboBox: Control {
|
|
16
16
|
var uint64 handle = 0
|
|
17
17
|
|
|
18
18
|
pub func #init = (self, Window window) {
|
|
@@ -2394,7 +2394,13 @@ pub func nomen_scroll_measure = (ref Container grid, int max_w, out [int, int])
|
|
|
2394
2394
|
// aarch64_use_c function routes to the C companion using only its raw
|
|
2395
2395
|
// blocks, so any Nomen statement here would be silently dropped
|
|
2396
2396
|
// (FOLLOWUP.md) — the measure goes through nomen_scroll_measure instead.
|
|
2397
|
-
pub func nomen_scroll_thunk = (
|
|
2397
|
+
pub func nomen_scroll_thunk = (
|
|
2398
|
+
ref Container grid,
|
|
2399
|
+
uint64 sv,
|
|
2400
|
+
uint64 doc,
|
|
2401
|
+
ref Window win,
|
|
2402
|
+
int first
|
|
2403
|
+
) {
|
|
2398
2404
|
```
|
|
2399
2405
|
#arch: c
|
|
2400
2406
|
#platform: macos
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* NSBox in its primary style with a title. macOS-only — iOS has no boxed
|
|
10
10
|
* group view (TODO stubs; see GUI_PLAN Tier 1 #17).
|
|
11
11
|
**/
|
|
12
|
-
pub mv struct GroupBox
|
|
12
|
+
pub mv struct GroupBox: Control {
|
|
13
13
|
var uint64 handle = 0
|
|
14
14
|
|
|
15
15
|
pub func #init = (self, Window window, string title) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* symbol/SF Symbol set. A failed load leaves the view empty (`has_image`
|
|
11
11
|
* reads false) — there is no error channel for images.
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct ImageView
|
|
13
|
+
pub mv struct ImageView: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
pub func #init = (self, Window window) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Tier 1 #16 — the iOS blocks are TODO stubs). Styles: 0 relevancy,
|
|
11
11
|
* 1 discrete capacity, 2 continuous capacity, 3 rating (stars).
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct LevelIndicator
|
|
13
|
+
pub mv struct LevelIndicator: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
pub func #init = (self, Window window) {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* Interaction needs a scene-attached view — see GUI_PLAN Tier 2; the iOS
|
|
18
18
|
* blocks are TODO stubs).
|
|
19
19
|
**/
|
|
20
|
-
pub mv struct Menu
|
|
20
|
+
pub mv struct Menu: Control {
|
|
21
21
|
var uint64 handle = 0
|
|
22
22
|
|
|
23
23
|
// File-scope helper: the shared item target. The action records the
|
|
@@ -28,7 +28,7 @@ pub mv struct Pagination {
|
|
|
28
28
|
// The up-call plumbing: the dispatch id the app enrolled (—1 = none)
|
|
29
29
|
// and whether a page change is waiting for the next tick.
|
|
30
30
|
var int page_change_id = -1
|
|
31
|
-
var
|
|
31
|
+
var page_change_pending = false
|
|
32
32
|
|
|
33
33
|
pub func #init = (self, Window window, int pages: pages > 0 && pages <= 5) {
|
|
34
34
|
self.prev = Button(window, "<")
|
|
@@ -56,13 +56,13 @@ pub mv struct Pagination {
|
|
|
56
56
|
// spares can never be clicked). The closures hoist to hidden methods
|
|
57
57
|
// on Pagination and run with `ref self` — the app's dispatch
|
|
58
58
|
// forwards into the field that hosts the row. No polls to starve.
|
|
59
|
-
self.prev.on_click(func
|
|
60
|
-
self.next.on_click(func
|
|
61
|
-
self.b0.on_click(func
|
|
62
|
-
self.b1.on_click(func
|
|
63
|
-
self.b2.on_click(func
|
|
64
|
-
self.b3.on_click(func
|
|
65
|
-
self.b4.on_click(func
|
|
59
|
+
self.prev.on_click(func() { self.prev() })
|
|
60
|
+
self.next.on_click(func() { self.next() })
|
|
61
|
+
self.b0.on_click(func() { self.select(0) })
|
|
62
|
+
self.b1.on_click(func() { self.select(1) })
|
|
63
|
+
self.b2.on_click(func() { self.select(2) })
|
|
64
|
+
self.b3.on_click(func() { self.select(3) })
|
|
65
|
+
self.b4.on_click(func() { self.select(4) })
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// Wire the row into the caller's grid under `parent`.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* For the spinning variant (macOS styles the SAME control differently, iOS
|
|
11
11
|
* uses a distinct class) see `Spinner`.
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct Progress
|
|
13
|
+
pub mv struct Progress: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
pub func #init = (self, Window window) {
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* the rest. The control itself is a CheckBox sibling (button type 4,
|
|
13
13
|
* NSRadioButton). iOS defers to Segmented or a checkmark list.
|
|
14
14
|
**/
|
|
15
|
-
pub mv struct Radio
|
|
15
|
+
pub mv struct Radio: Control {
|
|
16
16
|
var uint64 handle = 0
|
|
17
17
|
|
|
18
18
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
19
19
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
20
20
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
21
|
-
#handle = () {}
|
|
21
|
+
#handle = () { }
|
|
22
22
|
|
|
23
23
|
pub func #init = (self, Window window, string title) {
|
|
24
24
|
```
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* NSSearchField gives the magnifier icon, placeholder, and Cancel button for
|
|
10
10
|
* free; UISearchTextField is the iOS 13+ equivalent.
|
|
11
11
|
**/
|
|
12
|
-
pub mv struct SearchField
|
|
12
|
+
pub mv struct SearchField: Control {
|
|
13
13
|
var uint64 handle = 0
|
|
14
14
|
|
|
15
15
|
pub func #init = (self, Window window) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* A distinct native class on both platforms (NSSecureTextField is NOT
|
|
10
10
|
* NSTextField), so it lands as its own control rather than a TextBox mode.
|
|
11
11
|
**/
|
|
12
|
-
pub mv struct SecureField
|
|
12
|
+
pub mv struct SecureField: Control {
|
|
13
13
|
var uint64 handle = 0
|
|
14
14
|
|
|
15
15
|
pub func #init = (self, Window window) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* The segment count is fixed at construction; labels and the selection are
|
|
10
10
|
* set/poll per frame like every other control.
|
|
11
11
|
**/
|
|
12
|
-
pub mv struct Segmented
|
|
12
|
+
pub mv struct Segmented: Control {
|
|
13
13
|
var uint64 handle = 0
|
|
14
14
|
|
|
15
15
|
pub func #init = (self, Window window, int count) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* polled after each event batch. iOS needs a picker or action sheet and
|
|
11
11
|
* defers (TODO stubs below; see GUI_PLAN Tier 1 #9).
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct Select
|
|
13
|
+
pub mv struct Select: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
pub func #init = (self, Window window) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* the frame's aspect (wide = horizontal, tall = vertical). macOS-only —
|
|
11
11
|
* iOS has no separator view (TODO stubs; see GUI_PLAN Tier 1 #17).
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct Separator
|
|
13
|
+
pub mv struct Separator: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
pub func #init = (self, Window window) {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* tracked at the Nomen level (NSProgressIndicator has no isSpinning getter),
|
|
12
12
|
* so `is_spinning` reads true exactly between start() and stop().
|
|
13
13
|
**/
|
|
14
|
-
pub mv struct Spinner
|
|
14
|
+
pub mv struct Spinner: Control {
|
|
15
15
|
var uint64 handle = 0
|
|
16
|
-
var
|
|
16
|
+
var spinning = false
|
|
17
17
|
|
|
18
18
|
pub func #init = (self, Window window) {
|
|
19
19
|
```
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* UISplitViewController (a view-controller-level type — see GUI_PLAN
|
|
22
22
|
* Tier 2; the iOS blocks are TODO stubs).
|
|
23
23
|
**/
|
|
24
|
-
pub mv struct SplitView
|
|
24
|
+
pub mv struct SplitView: Control {
|
|
25
25
|
var uint64 handle = 0
|
|
26
26
|
|
|
27
27
|
// File-scope helper: the pane view class (answers `-contentView` with
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Pair with a TextBox for the "number input" composition (gpui-kit's
|
|
10
10
|
* number-input is exactly that pairing).
|
|
11
11
|
**/
|
|
12
|
-
pub mv struct Stepper
|
|
12
|
+
pub mv struct Stepper: Control {
|
|
13
13
|
var uint64 handle = 0
|
|
14
14
|
|
|
15
15
|
pub func #init = (self, Window window) {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* `List<T>` lesson). macOS-only (no iOS counterpart for a plain embeddable
|
|
20
20
|
* grid; see GUI_PLAN Tier 2 — the iOS blocks are TODO stubs).
|
|
21
21
|
**/
|
|
22
|
-
pub mv struct Table
|
|
22
|
+
pub mv struct Table: Control {
|
|
23
23
|
var uint64 handle = 0
|
|
24
24
|
var uint64 table = 0
|
|
25
25
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* NSTabView counterpart (UITabBarController is app-level chrome — see
|
|
18
18
|
* GUI_PLAN Tier 2; defer with TODO stubs).
|
|
19
19
|
**/
|
|
20
|
-
pub mv struct Tabs
|
|
20
|
+
pub mv struct Tabs: Control {
|
|
21
21
|
var uint64 handle = 0
|
|
22
22
|
|
|
23
23
|
// File-scope helper: the page view class. It answers `-contentView` with
|
|
@@ -18,7 +18,7 @@ pub mv struct Text: Control {
|
|
|
18
18
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
19
19
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
20
20
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
21
|
-
#handle = () {}
|
|
21
|
+
#handle = () { }
|
|
22
22
|
|
|
23
23
|
pub func #init = (self, Window window) {
|
|
24
24
|
```
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* `#destroy` releases what the handle names. The constructor's `self` is
|
|
7
7
|
* the inline instance (the `.` accessor); methods keep the pointer form.
|
|
8
8
|
**/
|
|
9
|
-
pub mv struct TextBox
|
|
9
|
+
pub mv struct TextBox: Control {
|
|
10
10
|
var uint64 handle = 0
|
|
11
11
|
|
|
12
12
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
13
13
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
14
14
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
15
|
-
#handle = () {}
|
|
15
|
+
#handle = () { }
|
|
16
16
|
|
|
17
17
|
pub func #init = (self, Window window) {
|
|
18
18
|
```
|
|
@@ -17,7 +17,7 @@ pub mv struct TextView: Control {
|
|
|
17
17
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
18
18
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
19
19
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
20
|
-
#handle = () {}
|
|
20
|
+
#handle = () { }
|
|
21
21
|
|
|
22
22
|
pub func #init = (self, Window window) {
|
|
23
23
|
```
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* selected state. Where `Button` is momentary, `Toggle` stays depressed
|
|
11
11
|
* until clicked again (toolbar-style).
|
|
12
12
|
**/
|
|
13
|
-
pub mv struct Toggle
|
|
13
|
+
pub mv struct Toggle: Control {
|
|
14
14
|
var uint64 handle = 0
|
|
15
15
|
|
|
16
16
|
// The `#handle` hook synthesizes `NameHandle` — a copyable, non-owning
|
|
17
17
|
// twin (same public bare-self methods, no destroy) so closures can
|
|
18
18
|
// capture this control without moving it. See GUI.md, "Handles".
|
|
19
|
-
#handle = () {}
|
|
19
|
+
#handle = () { }
|
|
20
20
|
|
|
21
21
|
pub func #init = (self, Window window, string title) {
|
|
22
22
|
```
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* already make). macOS-only (NSToolbar has no iOS counterpart; see GUI_PLAN
|
|
18
18
|
* Tier 2 — the iOS blocks are TODO stubs).
|
|
19
19
|
**/
|
|
20
|
-
pub mv struct Toolbar
|
|
20
|
+
pub mv struct Toolbar: Control {
|
|
21
21
|
var uint64 handle = 0
|
|
22
22
|
|
|
23
23
|
// File-scope helper: the shared delegate + action recorder (shared — one
|
|
@@ -1354,7 +1354,7 @@ pub mv struct Window: Control {
|
|
|
1354
1354
|
self.relayout(1)
|
|
1355
1355
|
var int prev_w = self.content_width()
|
|
1356
1356
|
var int prev_h = self.content_height()
|
|
1357
|
-
var
|
|
1357
|
+
var ev = FrameEvents()
|
|
1358
1358
|
while self.is_visible() {
|
|
1359
1359
|
// Close interception: the delegate refused the native close and
|
|
1360
1360
|
// set the pending flag; consult the app. Accept → forced close
|
|
@@ -1853,7 +1853,6 @@ pub func nomen_control_take_input = (uint64 handle, out bool) {
|
|
|
1853
1853
|
```
|
|
1854
1854
|
}
|
|
1855
1855
|
|
|
1856
|
-
|
|
1857
1856
|
pub func nomen_window_clicks_init = (uint64 handle) {
|
|
1858
1857
|
```
|
|
1859
1858
|
#arch: c
|