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.
- package/core/System/Buffer.nm +32 -0
- package/core/System/ClassBuffer.nm +24 -0
- package/core/System/Controls/Alert.nm +326 -0
- package/core/System/Controls/App.nm +147 -0
- package/core/System/Controls/Button.nm +119 -1
- package/core/System/Controls/CheckBox.nm +24 -0
- package/core/System/Controls/ColorPicker.nm +307 -0
- package/core/System/Controls/ComboBox.nm +430 -0
- package/core/System/Controls/Container.nm +837 -9
- package/core/System/Controls/Control.nm +443 -0
- package/core/System/Controls/DatePicker.nm +288 -0
- package/core/System/Controls/Form.nm +70 -0
- package/core/System/Controls/GroupBox.nm +267 -0
- package/core/System/Controls/ImageView.nm +311 -0
- package/core/System/Controls/LevelIndicator.nm +305 -0
- package/core/System/Controls/ListView.nm +633 -0
- package/core/System/Controls/Menu.nm +428 -0
- package/core/System/Controls/NumberInput.nm +56 -0
- package/core/System/Controls/OtpInput.nm +50 -0
- package/core/System/Controls/OutlineView.nm +598 -0
- package/core/System/Controls/Pagination.nm +142 -0
- package/core/System/Controls/Popover.nm +296 -0
- package/core/System/Controls/Progress.nm +348 -0
- package/core/System/Controls/Radio.nm +292 -0
- package/core/System/Controls/Scrollable.nm +584 -0
- package/core/System/Controls/SearchField.nm +326 -0
- package/core/System/Controls/SecureField.nm +344 -0
- package/core/System/Controls/Segmented.nm +380 -0
- package/core/System/Controls/Select.nm +340 -0
- package/core/System/Controls/Separator.nm +198 -0
- package/core/System/Controls/Sheet.nm +329 -0
- package/core/System/Controls/Slider.nm +315 -0
- package/core/System/Controls/Spinner.nm +287 -0
- package/core/System/Controls/SplitView.nm +509 -0
- package/core/System/Controls/Stepper.nm +349 -0
- package/core/System/Controls/Switch.nm +259 -0
- package/core/System/Controls/Table.nm +833 -0
- package/core/System/Controls/Tabs.nm +500 -0
- package/core/System/Controls/Text.nm +108 -11
- package/core/System/Controls/TextBox.nm +112 -1
- package/core/System/Controls/TextView.nm +329 -0
- package/core/System/Controls/Toggle.nm +346 -0
- package/core/System/Controls/Toolbar.nm +501 -0
- package/core/System/Controls/Tooltip.nm +76 -0
- package/core/System/Controls/Window.nm +1549 -91
- package/core/System/List.nm +34 -0
- package/core/System/Map.nm +21 -4
- package/core/System/Set.nm +14 -0
- package/dist/index.mjs +3425 -710
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page-picker row — prev/next plus one numbered Button per page composed
|
|
3
|
+
*
|
|
4
|
+
* PURE COMPOSITION (GUI_PLAN Tier 3 "reachable earlier"): no new native
|
|
5
|
+
* control, no drawing — a row of Buttons wired into the caller's grid.
|
|
6
|
+
* The page count is fixed at construction (1..5; spare buttons are hidden
|
|
7
|
+
* and skipped by the layout's hidden-leaf pass). The composite is its own
|
|
8
|
+
* HANDLER HOST (docs/HANDLERS.md Stage 2): #init registers a handler per
|
|
9
|
+
* button and the arms keep `current` up to date — the run loop forwards
|
|
10
|
+
* into whatever app field hosts the pagination. Changes the app cares
|
|
11
|
+
* about travel UP via the id up-call (Stage 3): `on_page_change(id)`
|
|
12
|
+
* enrolls interest, the mutators raise the pending flag, and the app
|
|
13
|
+
* forwards itself down once per frame — `pag.tick(ref self, ref win)` —
|
|
14
|
+
* for the callback into its `run_handler`. Value polling (`page`) remains
|
|
15
|
+
* for apps that don't need the event. Handles (`prev_handle`/
|
|
16
|
+
* `next_handle`/`page_handle`) remain for coordinate hit-testing.
|
|
17
|
+
**/
|
|
18
|
+
pub mv struct Pagination {
|
|
19
|
+
var Button prev
|
|
20
|
+
var Button next
|
|
21
|
+
var Button b0
|
|
22
|
+
var Button b1
|
|
23
|
+
var Button b2
|
|
24
|
+
var Button b3
|
|
25
|
+
var Button b4
|
|
26
|
+
var pages = 1
|
|
27
|
+
var current = 0
|
|
28
|
+
// The up-call plumbing: the dispatch id the app enrolled (—1 = none)
|
|
29
|
+
// and whether a page change is waiting for the next tick.
|
|
30
|
+
var int page_change_id = -1
|
|
31
|
+
var bool page_change_pending = false
|
|
32
|
+
|
|
33
|
+
pub func #init = (self, Window window, int pages: pages > 0 && pages <= 5) {
|
|
34
|
+
self.prev = Button(window, "<")
|
|
35
|
+
self.next = Button(window, ">")
|
|
36
|
+
self.b0 = Button(window, "1")
|
|
37
|
+
self.b1 = Button(window, "2")
|
|
38
|
+
self.b2 = Button(window, "3")
|
|
39
|
+
self.b3 = Button(window, "4")
|
|
40
|
+
self.b4 = Button(window, "5")
|
|
41
|
+
self.pages = pages
|
|
42
|
+
// Spare page buttons stay hidden (the layout skips hidden leaves).
|
|
43
|
+
if pages <= 4 {
|
|
44
|
+
self.b4.set_hidden(true)
|
|
45
|
+
}
|
|
46
|
+
if pages <= 3 {
|
|
47
|
+
self.b3.set_hidden(true)
|
|
48
|
+
}
|
|
49
|
+
if pages <= 2 {
|
|
50
|
+
self.b2.set_hidden(true)
|
|
51
|
+
}
|
|
52
|
+
if pages <= 1 {
|
|
53
|
+
self.b1.set_hidden(true)
|
|
54
|
+
}
|
|
55
|
+
// The row self-drives: one registered handler per button (hidden
|
|
56
|
+
// spares can never be clicked). The closures hoist to hidden methods
|
|
57
|
+
// on Pagination and run with `ref self` — the app's dispatch
|
|
58
|
+
// forwards into the field that hosts the row. No polls to starve.
|
|
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
|
+
}
|
|
67
|
+
|
|
68
|
+
// Wire the row into the caller's grid under `parent`.
|
|
69
|
+
pub func add_to = (ref self, ref Container grid, int parent, int span) {
|
|
70
|
+
var int hs = grid.add_hstack(parent, 6, span)
|
|
71
|
+
grid.add_to_intrinsic(hs, self.prev.handle, 1)
|
|
72
|
+
grid.add_to_intrinsic(hs, self.b0.handle, 1)
|
|
73
|
+
grid.add_to_intrinsic(hs, self.b1.handle, 1)
|
|
74
|
+
grid.add_to_intrinsic(hs, self.b2.handle, 1)
|
|
75
|
+
grid.add_to_intrinsic(hs, self.b3.handle, 1)
|
|
76
|
+
grid.add_to_intrinsic(hs, self.b4.handle, 1)
|
|
77
|
+
grid.add_to_intrinsic(hs, self.next.handle, 1)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// The page buttons' handles, for grid.contains hit-testing.
|
|
81
|
+
pub func prev_handle = (self, out uint64) {
|
|
82
|
+
return self.prev.handle
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub func next_handle = (self, out uint64) {
|
|
86
|
+
return self.next.handle
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub func page_handle = (self, int index, out uint64) {
|
|
90
|
+
if index == 0 { return self.b0.handle }
|
|
91
|
+
if index == 1 { return self.b1.handle }
|
|
92
|
+
if index == 2 { return self.b2.handle }
|
|
93
|
+
if index == 3 { return self.b3.handle }
|
|
94
|
+
if index == 4 { return self.b4.handle }
|
|
95
|
+
return 0
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// The current page (0-based), clamped to the page count.
|
|
99
|
+
pub func page = (self, out int) {
|
|
100
|
+
return self.current
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
pub func select = (ref self, int index) {
|
|
104
|
+
var int i = index
|
|
105
|
+
if i < 0 { i = 0 }
|
|
106
|
+
if i > self.pages - 1 { i = self.pages - 1 }
|
|
107
|
+
self.current = i
|
|
108
|
+
self.page_change_pending = true
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
pub func next = (ref self) {
|
|
112
|
+
if self.current < self.pages - 1 {
|
|
113
|
+
self.current += 1
|
|
114
|
+
self.page_change_pending = true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
pub func prev = (ref self) {
|
|
119
|
+
if self.current > 0 {
|
|
120
|
+
self.current -= 1
|
|
121
|
+
self.page_change_pending = true
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// The declared event API (docs/HANDLERS.md Stage 3): the desugar's
|
|
126
|
+
// enrollment rewrite calls this with the app handler's dispatch id.
|
|
127
|
+
pub func on_page_change = (ref self, int id) {
|
|
128
|
+
self.page_change_id = id
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// One tick of the up-call protocol: the app forwards itself down once
|
|
132
|
+
// per frame — `self.pag.tick(ref self, ref win)` — and a pending page
|
|
133
|
+
// change calls back into the app's `run_handler` (one vtable hop into
|
|
134
|
+
// the concrete override). The borrow flows down per call; nothing is
|
|
135
|
+
// stored and nothing outlives the tick.
|
|
136
|
+
pub func tick = (ref self, ref App owner, ref Window win) {
|
|
137
|
+
if self.page_change_pending && self.page_change_id >= 0 {
|
|
138
|
+
owner.run_handler(self.page_change_id, ref win)
|
|
139
|
+
}
|
|
140
|
+
self.page_change_pending = false
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An anchored transient popup (NSPopover)
|
|
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
|
+
* `show(handle)` anchors the popover to ANY control by its native handle
|
|
10
|
+
* (the popover appears above it and the user dismisses it by clicking
|
|
11
|
+
* elsewhere — NSPopover's transient behavior). Sizing drives the content
|
|
12
|
+
* view's frame; hosting arbitrary controls inside the popover needs the
|
|
13
|
+
* same layout-root shim as Sheet and lands with that design work. iOS
|
|
14
|
+
* defers to UIPopoverPresentationController (TODO stubs; see GUI_PLAN
|
|
15
|
+
* Tier 1 #21).
|
|
16
|
+
**/
|
|
17
|
+
/**
|
|
18
|
+
* The popover content area's size (`Popover.content_size`'s return value)
|
|
19
|
+
**/
|
|
20
|
+
pub struct PopSize {
|
|
21
|
+
pub var width = 0
|
|
22
|
+
pub var height = 0
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pub mv struct Popover : Control {
|
|
26
|
+
var uint64 handle = 0
|
|
27
|
+
|
|
28
|
+
pub func #init = (self, Window window) {
|
|
29
|
+
```
|
|
30
|
+
#arch: c
|
|
31
|
+
#platform: macos
|
|
32
|
+
id pop = ((id(*)(id, SEL))objc_msgSend)(
|
|
33
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSPopover"), sel_registerName("alloc")),
|
|
34
|
+
sel_registerName("init"));
|
|
35
|
+
id vc = ((id(*)(id, SEL))objc_msgSend)(
|
|
36
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSViewController"), sel_registerName("alloc")),
|
|
37
|
+
sel_registerName("init"));
|
|
38
|
+
id content = ((id(*)(id, SEL, CGRect))objc_msgSend)(
|
|
39
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSView"), sel_registerName("alloc")),
|
|
40
|
+
sel_registerName("initWithFrame:"),
|
|
41
|
+
((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 120));
|
|
42
|
+
((void(*)(id, SEL, id))objc_msgSend)(vc, sel_registerName("setView:"), content);
|
|
43
|
+
((void(*)(id, SEL, id))objc_msgSend)(pop, sel_registerName("setContentViewController:"), vc);
|
|
44
|
+
((void(*)(id, SEL, double, double))objc_msgSend)(
|
|
45
|
+
pop, sel_registerName("setContentSize:"), 200.0, 120.0);
|
|
46
|
+
// The window argument satisfies the Control-constructor shape; the
|
|
47
|
+
// popover presents relative to an anchor view, not into the window.
|
|
48
|
+
(void)window->handle;
|
|
49
|
+
self.handle = (uint64_t)pop;
|
|
50
|
+
```
|
|
51
|
+
```
|
|
52
|
+
#arch: aarch64_use_c
|
|
53
|
+
#platform: macos
|
|
54
|
+
id pop = ((id(*)(id, SEL))objc_msgSend)(
|
|
55
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSPopover"), sel_registerName("alloc")),
|
|
56
|
+
sel_registerName("init"));
|
|
57
|
+
id vc = ((id(*)(id, SEL))objc_msgSend)(
|
|
58
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSViewController"), sel_registerName("alloc")),
|
|
59
|
+
sel_registerName("init"));
|
|
60
|
+
id content = ((id(*)(id, SEL, CGRect))objc_msgSend)(
|
|
61
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSView"), sel_registerName("alloc")),
|
|
62
|
+
sel_registerName("initWithFrame:"),
|
|
63
|
+
((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 120));
|
|
64
|
+
((void(*)(id, SEL, id))objc_msgSend)(vc, sel_registerName("setView:"), content);
|
|
65
|
+
((void(*)(id, SEL, id))objc_msgSend)(pop, sel_registerName("setContentViewController:"), vc);
|
|
66
|
+
((void(*)(id, SEL, double, double))objc_msgSend)(
|
|
67
|
+
pop, sel_registerName("setContentSize:"), 200.0, 120.0);
|
|
68
|
+
// The window argument satisfies the Control-constructor shape; the
|
|
69
|
+
// popover presents relative to an anchor view, not into the window.
|
|
70
|
+
(void)window->handle;
|
|
71
|
+
self->handle = (uint64_t)pop;
|
|
72
|
+
```
|
|
73
|
+
```
|
|
74
|
+
#arch: c
|
|
75
|
+
#platform: ios
|
|
76
|
+
/* TODO: iOS — UIPopoverPresentationController needs a source view +
|
|
77
|
+
* presenting controller (see GUI_PLAN Tier 1 #21; defer). */
|
|
78
|
+
```
|
|
79
|
+
```
|
|
80
|
+
#arch: aarch64_use_c
|
|
81
|
+
#platform: ios
|
|
82
|
+
/* TODO: iOS — UIPopoverPresentationController needs a source view +
|
|
83
|
+
* presenting controller (see GUI_PLAN Tier 1 #21; defer). */
|
|
84
|
+
```
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Resize the popover's content area.
|
|
88
|
+
pub func set_content_size = (self, int width, int height) {
|
|
89
|
+
```
|
|
90
|
+
#arch: c
|
|
91
|
+
#platform: macos
|
|
92
|
+
((void(*)(id, SEL, double, double))objc_msgSend)(
|
|
93
|
+
(id)self->handle, sel_registerName("setContentSize:"),
|
|
94
|
+
(double)width, (double)height);
|
|
95
|
+
```
|
|
96
|
+
```
|
|
97
|
+
#arch: aarch64_use_c
|
|
98
|
+
#platform: macos
|
|
99
|
+
((void(*)(id, SEL, double, double))objc_msgSend)(
|
|
100
|
+
(id)self->handle, sel_registerName("setContentSize:"),
|
|
101
|
+
(double)width, (double)height);
|
|
102
|
+
```
|
|
103
|
+
```
|
|
104
|
+
#arch: c
|
|
105
|
+
#platform: ios
|
|
106
|
+
/* TODO: iOS (see #init) */
|
|
107
|
+
```
|
|
108
|
+
```
|
|
109
|
+
#arch: aarch64_use_c
|
|
110
|
+
#platform: ios
|
|
111
|
+
/* TODO: iOS (see #init) */
|
|
112
|
+
```
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// The content area's current size.
|
|
116
|
+
pub func content_size = (self, out PopSize) {
|
|
117
|
+
```
|
|
118
|
+
#arch: c
|
|
119
|
+
#platform: macos
|
|
120
|
+
CGSize sz = ((CGSize(*)(id, SEL))objc_msgSend)(
|
|
121
|
+
(id)self->handle, sel_registerName("contentSize"));
|
|
122
|
+
struct PopSize r;
|
|
123
|
+
r.width = (int)sz.width;
|
|
124
|
+
r.height = (int)sz.height;
|
|
125
|
+
return r;
|
|
126
|
+
```
|
|
127
|
+
```
|
|
128
|
+
#arch: aarch64_use_c
|
|
129
|
+
#platform: macos
|
|
130
|
+
CGSize sz = ((CGSize(*)(id, SEL))objc_msgSend)(
|
|
131
|
+
(id)self->handle, sel_registerName("contentSize"));
|
|
132
|
+
struct PopSize r;
|
|
133
|
+
r.width = (int)sz.width;
|
|
134
|
+
r.height = (int)sz.height;
|
|
135
|
+
return r;
|
|
136
|
+
```
|
|
137
|
+
```
|
|
138
|
+
#arch: c
|
|
139
|
+
#platform: ios
|
|
140
|
+
/* TODO: iOS (see #init) */
|
|
141
|
+
{
|
|
142
|
+
struct PopSize r;
|
|
143
|
+
r.width = 0;
|
|
144
|
+
r.height = 0;
|
|
145
|
+
return r;
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
```
|
|
149
|
+
#arch: aarch64_use_c
|
|
150
|
+
#platform: ios
|
|
151
|
+
/* TODO: iOS (see #init) */
|
|
152
|
+
{
|
|
153
|
+
struct PopSize r;
|
|
154
|
+
r.width = 0;
|
|
155
|
+
r.height = 0;
|
|
156
|
+
return r;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Present the popover anchored above the view `handle` names (any
|
|
162
|
+
// control's handle). Non-blocking; the user dismisses it by clicking
|
|
163
|
+
// elsewhere (transient behavior).
|
|
164
|
+
pub func show = (self, uint64 anchor) {
|
|
165
|
+
```
|
|
166
|
+
#arch: c
|
|
167
|
+
#platform: macos
|
|
168
|
+
id view = (id)anchor;
|
|
169
|
+
CGRect bounds = ((CGRect(*)(id, SEL))objc_msgSend)(view, sel_registerName("bounds"));
|
|
170
|
+
((void(*)(id, SEL, CGRect, id, long))objc_msgSend)(
|
|
171
|
+
(id)self->handle, sel_registerName("showRelativeToRect:ofView:preferredEdge:"),
|
|
172
|
+
bounds, view, 3); // NSRectEdgeMaxY = 3 (anchor above)
|
|
173
|
+
```
|
|
174
|
+
```
|
|
175
|
+
#arch: aarch64_use_c
|
|
176
|
+
#platform: macos
|
|
177
|
+
id view = (id)anchor;
|
|
178
|
+
CGRect bounds = ((CGRect(*)(id, SEL))objc_msgSend)(view, sel_registerName("bounds"));
|
|
179
|
+
((void(*)(id, SEL, CGRect, id, long))objc_msgSend)(
|
|
180
|
+
(id)self->handle, sel_registerName("showRelativeToRect:ofView:preferredEdge:"),
|
|
181
|
+
bounds, view, 3); // NSRectEdgeMaxY = 3 (anchor above)
|
|
182
|
+
```
|
|
183
|
+
```
|
|
184
|
+
#arch: c
|
|
185
|
+
#platform: ios
|
|
186
|
+
/* TODO: iOS (see #init) */
|
|
187
|
+
```
|
|
188
|
+
```
|
|
189
|
+
#arch: aarch64_use_c
|
|
190
|
+
#platform: ios
|
|
191
|
+
/* TODO: iOS (see #init) */
|
|
192
|
+
```
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
pub func dismiss = (self) {
|
|
196
|
+
```
|
|
197
|
+
#arch: c
|
|
198
|
+
#platform: macos
|
|
199
|
+
((void(*)(id, SEL))objc_msgSend)(
|
|
200
|
+
(id)self->handle, sel_registerName("close"));
|
|
201
|
+
```
|
|
202
|
+
```
|
|
203
|
+
#arch: aarch64_use_c
|
|
204
|
+
#platform: macos
|
|
205
|
+
((void(*)(id, SEL))objc_msgSend)(
|
|
206
|
+
(id)self->handle, sel_registerName("close"));
|
|
207
|
+
```
|
|
208
|
+
```
|
|
209
|
+
#arch: c
|
|
210
|
+
#platform: ios
|
|
211
|
+
/* TODO: iOS (see #init) */
|
|
212
|
+
```
|
|
213
|
+
```
|
|
214
|
+
#arch: aarch64_use_c
|
|
215
|
+
#platform: ios
|
|
216
|
+
/* TODO: iOS (see #init) */
|
|
217
|
+
```
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// True while the popover is on screen.
|
|
221
|
+
pub func is_shown = (self, out bool) {
|
|
222
|
+
```
|
|
223
|
+
#arch: c
|
|
224
|
+
#platform: macos
|
|
225
|
+
BOOL shown = ((BOOL(*)(id, SEL))objc_msgSend)(
|
|
226
|
+
(id)self->handle, sel_registerName("isShown"));
|
|
227
|
+
return shown ? 1 : 0;
|
|
228
|
+
```
|
|
229
|
+
```
|
|
230
|
+
#arch: aarch64_use_c
|
|
231
|
+
#platform: macos
|
|
232
|
+
BOOL shown = ((BOOL(*)(id, SEL))objc_msgSend)(
|
|
233
|
+
(id)self->handle, sel_registerName("isShown"));
|
|
234
|
+
return shown ? 1 : 0;
|
|
235
|
+
```
|
|
236
|
+
```
|
|
237
|
+
#arch: c
|
|
238
|
+
#platform: ios
|
|
239
|
+
/* TODO: iOS (see #init) */
|
|
240
|
+
return 0;
|
|
241
|
+
```
|
|
242
|
+
```
|
|
243
|
+
#arch: aarch64_use_c
|
|
244
|
+
#platform: ios
|
|
245
|
+
/* TODO: iOS (see #init) */
|
|
246
|
+
return 0;
|
|
247
|
+
```
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ── Control trait conformance ──
|
|
251
|
+
// A popover is window-coordinated: the layout engine never frames it.
|
|
252
|
+
pub func set_frame = (ref self, int x, int y, int width, int height) {
|
|
253
|
+
// No-op: the popover positions itself relative to its anchor.
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
pub func intrinsic_size = (self, out Size) {
|
|
257
|
+
var s = Size()
|
|
258
|
+
return s
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
pub func measure = (self, BoxConstraints constraints, out Size) {
|
|
262
|
+
var s = Size()
|
|
263
|
+
return s
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
func #destroy = () {
|
|
267
|
+
```
|
|
268
|
+
#arch: c
|
|
269
|
+
#platform: macos
|
|
270
|
+
if (self->handle) {
|
|
271
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("close"));
|
|
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: macos
|
|
279
|
+
if (self->handle) {
|
|
280
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("close"));
|
|
281
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
|
|
282
|
+
self->handle = 0;
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
```
|
|
286
|
+
#arch: c
|
|
287
|
+
#platform: ios
|
|
288
|
+
/* TODO: iOS (see #init) */
|
|
289
|
+
```
|
|
290
|
+
```
|
|
291
|
+
#arch: aarch64_use_c
|
|
292
|
+
#platform: ios
|
|
293
|
+
/* TODO: iOS (see #init) */
|
|
294
|
+
```
|
|
295
|
+
}
|
|
296
|
+
}
|