nomen-lang 0.7.1 → 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 +2556 -656
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A horizontal/vertical divider line
|
|
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
|
+
* NSBox in its separator style: thin etched line, orientation implied by
|
|
10
|
+
* the frame's aspect (wide = horizontal, tall = vertical). macOS-only —
|
|
11
|
+
* iOS has no separator view (TODO stubs; see GUI_PLAN Tier 1 #17).
|
|
12
|
+
**/
|
|
13
|
+
pub mv struct Separator : Control {
|
|
14
|
+
var uint64 handle = 0
|
|
15
|
+
|
|
16
|
+
pub func #init = (self, Window window) {
|
|
17
|
+
```
|
|
18
|
+
#arch: c
|
|
19
|
+
#platform: macos
|
|
20
|
+
id sep = ((id(*)(id, SEL, CGRect))objc_msgSend)(
|
|
21
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSBox"), sel_registerName("alloc")),
|
|
22
|
+
sel_registerName("initWithFrame:"),
|
|
23
|
+
((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 4));
|
|
24
|
+
((void(*)(id, SEL, long))objc_msgSend)(
|
|
25
|
+
sep, sel_registerName("setBoxType:"), 2); // NSBoxSeparator = 2
|
|
26
|
+
id contentView = ((id(*)(id, SEL))objc_msgSend)(
|
|
27
|
+
(id)window->handle, sel_registerName("contentView"));
|
|
28
|
+
((void(*)(id, SEL, id))objc_msgSend)(
|
|
29
|
+
contentView, sel_registerName("addSubview:"), sep);
|
|
30
|
+
self.handle = (uint64_t)sep;
|
|
31
|
+
```
|
|
32
|
+
```
|
|
33
|
+
#arch: aarch64_use_c
|
|
34
|
+
#platform: macos
|
|
35
|
+
id sep = ((id(*)(id, SEL, CGRect))objc_msgSend)(
|
|
36
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSBox"), sel_registerName("alloc")),
|
|
37
|
+
sel_registerName("initWithFrame:"),
|
|
38
|
+
((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 4));
|
|
39
|
+
((void(*)(id, SEL, long))objc_msgSend)(
|
|
40
|
+
sep, sel_registerName("setBoxType:"), 2); // NSBoxSeparator = 2
|
|
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:"), sep);
|
|
45
|
+
self->handle = (uint64_t)sep;
|
|
46
|
+
```
|
|
47
|
+
```
|
|
48
|
+
#arch: c
|
|
49
|
+
#platform: ios
|
|
50
|
+
/* TODO: iOS — no native separator view (see GUI_PLAN Tier 1 #17;
|
|
51
|
+
* compose from a thin background-colored view if needed). */
|
|
52
|
+
```
|
|
53
|
+
```
|
|
54
|
+
#arch: aarch64_use_c
|
|
55
|
+
#platform: ios
|
|
56
|
+
/* TODO: iOS — no native separator view (see GUI_PLAN Tier 1 #17;
|
|
57
|
+
* compose from a thin background-colored view if needed). */
|
|
58
|
+
```
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pub func set_frame = (ref self, int x, int y, int width, int height) {
|
|
62
|
+
```
|
|
63
|
+
#arch: c
|
|
64
|
+
#platform: macos
|
|
65
|
+
((void(*)(id, SEL, CGRect))objc_msgSend)(
|
|
66
|
+
(id)self->handle, sel_registerName("setFrame:"),
|
|
67
|
+
((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
|
|
68
|
+
```
|
|
69
|
+
```
|
|
70
|
+
#arch: aarch64_use_c
|
|
71
|
+
#platform: macos
|
|
72
|
+
((void(*)(id, SEL, CGRect))objc_msgSend)(
|
|
73
|
+
(id)self->handle, sel_registerName("setFrame:"),
|
|
74
|
+
((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
|
|
75
|
+
```
|
|
76
|
+
```
|
|
77
|
+
#arch: c
|
|
78
|
+
#platform: ios
|
|
79
|
+
/* TODO: iOS (see #init) */
|
|
80
|
+
```
|
|
81
|
+
```
|
|
82
|
+
#arch: aarch64_use_c
|
|
83
|
+
#platform: ios
|
|
84
|
+
/* TODO: iOS (see #init) */
|
|
85
|
+
```
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The NSBoxType (2 = separator) — exposes the native style for tests
|
|
89
|
+
// and diagnostics.
|
|
90
|
+
pub func box_type = (self, out int) {
|
|
91
|
+
```
|
|
92
|
+
#arch: c
|
|
93
|
+
#platform: macos
|
|
94
|
+
return (int)((long(*)(id, SEL))objc_msgSend)(
|
|
95
|
+
(id)self->handle, sel_registerName("boxType"));
|
|
96
|
+
```
|
|
97
|
+
```
|
|
98
|
+
#arch: aarch64_use_c
|
|
99
|
+
#platform: macos
|
|
100
|
+
return (int)((long(*)(id, SEL))objc_msgSend)(
|
|
101
|
+
(id)self->handle, sel_registerName("boxType"));
|
|
102
|
+
```
|
|
103
|
+
```
|
|
104
|
+
#arch: c
|
|
105
|
+
#platform: ios
|
|
106
|
+
/* TODO: iOS (see #init) */
|
|
107
|
+
return 0;
|
|
108
|
+
```
|
|
109
|
+
```
|
|
110
|
+
#arch: aarch64_use_c
|
|
111
|
+
#platform: ios
|
|
112
|
+
/* TODO: iOS (see #init) */
|
|
113
|
+
return 0;
|
|
114
|
+
```
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
pub func set_hidden = (self, bool hidden) {
|
|
118
|
+
```
|
|
119
|
+
#arch: c
|
|
120
|
+
#platform: macos
|
|
121
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(
|
|
122
|
+
(id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
|
|
123
|
+
```
|
|
124
|
+
```
|
|
125
|
+
#arch: aarch64_use_c
|
|
126
|
+
#platform: macos
|
|
127
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(
|
|
128
|
+
(id)self->handle, sel_registerName("setHidden:"), hidden ? 1 : 0);
|
|
129
|
+
```
|
|
130
|
+
```
|
|
131
|
+
#arch: c
|
|
132
|
+
#platform: ios
|
|
133
|
+
/* TODO: iOS (see #init) */
|
|
134
|
+
```
|
|
135
|
+
```
|
|
136
|
+
#arch: aarch64_use_c
|
|
137
|
+
#platform: ios
|
|
138
|
+
/* TODO: iOS (see #init) */
|
|
139
|
+
```
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ── Control trait conformance ──
|
|
143
|
+
pub func intrinsic_size = (self, out Size) {
|
|
144
|
+
var [w, h] = native_intrinsic(self.handle)
|
|
145
|
+
var s = Size()
|
|
146
|
+
s.width = w
|
|
147
|
+
s.height = h
|
|
148
|
+
return s
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
pub func measure = (self, BoxConstraints constraints, out Size) {
|
|
152
|
+
var Size s = self.intrinsic_size()
|
|
153
|
+
if s.width > constraints.max_width {
|
|
154
|
+
s.width = constraints.max_width
|
|
155
|
+
}
|
|
156
|
+
if s.width < constraints.min_width {
|
|
157
|
+
s.width = constraints.min_width
|
|
158
|
+
}
|
|
159
|
+
if s.height > constraints.max_height {
|
|
160
|
+
s.height = constraints.max_height
|
|
161
|
+
}
|
|
162
|
+
if s.height < constraints.min_height {
|
|
163
|
+
s.height = constraints.min_height
|
|
164
|
+
}
|
|
165
|
+
return s
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
func #destroy = () {
|
|
169
|
+
```
|
|
170
|
+
#arch: c
|
|
171
|
+
#platform: macos
|
|
172
|
+
if (self->handle) {
|
|
173
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
|
|
174
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
|
|
175
|
+
self->handle = 0;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
```
|
|
179
|
+
#arch: aarch64_use_c
|
|
180
|
+
#platform: macos
|
|
181
|
+
if (self->handle) {
|
|
182
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
|
|
183
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
|
|
184
|
+
self->handle = 0;
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
```
|
|
188
|
+
#arch: c
|
|
189
|
+
#platform: ios
|
|
190
|
+
/* TODO: iOS (see #init) */
|
|
191
|
+
```
|
|
192
|
+
```
|
|
193
|
+
#arch: aarch64_use_c
|
|
194
|
+
#platform: ios
|
|
195
|
+
/* TODO: iOS (see #init) */
|
|
196
|
+
```
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A modal sheet attached to a window (the macOS "forms slide out of the
|
|
3
|
+
* title bar" presentation)
|
|
4
|
+
*
|
|
5
|
+
* An OWNING STRUCT (STRUCT_PLAN_3 Phase R, tranche 4 — the shape menu): the
|
|
6
|
+
* fields are platform handles, so the value is movable and its `#destroy`
|
|
7
|
+
* releases what they name. The constructor's `self` is the inline instance
|
|
8
|
+
* (the `.` accessor); methods keep the pointer form.
|
|
9
|
+
*
|
|
10
|
+
* The sheet is its own NSWindow presented attached to the host — so its
|
|
11
|
+
* contentView is just another layout root: `content_window` hands back a
|
|
12
|
+
* Window-shaped value whose contentView is the sheet's, and every control
|
|
13
|
+
* constructor (and `Container.layout`) accepts it like any window.
|
|
14
|
+
* `present`/`dismiss` are non-blocking (completion-handler form); iOS
|
|
15
|
+
* defers to UISheetPresentationController (TODO stubs; see GUI_PLAN
|
|
16
|
+
* Tier 1 #20).
|
|
17
|
+
**/
|
|
18
|
+
pub mv struct Sheet : Control {
|
|
19
|
+
var uint64 handle = 0
|
|
20
|
+
var uint64 host = 0
|
|
21
|
+
|
|
22
|
+
pub func #init = (self, Window window, int width, int height) {
|
|
23
|
+
```
|
|
24
|
+
#arch: c
|
|
25
|
+
#platform: macos
|
|
26
|
+
unsigned long style = 1 | 2; // NSWindowStyleMaskTitled | Closable
|
|
27
|
+
id sheet = ((id(*)(id, SEL, double, double, double, double, unsigned long, unsigned long, BOOL))objc_msgSend)(
|
|
28
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSWindow"), sel_registerName("alloc")),
|
|
29
|
+
sel_registerName("initWithContentRect:styleMask:backing:defer:"),
|
|
30
|
+
0.0, 0.0, (double)width, (double)height,
|
|
31
|
+
style, 2, 0);
|
|
32
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(sheet, sel_registerName("setReleasedWhenClosed:"), 0);
|
|
33
|
+
id cv = ((id(*)(id, SEL))objc_msgSend)(sheet, sel_registerName("contentView"));
|
|
34
|
+
((void(*)(id, SEL, unsigned long))objc_msgSend)(cv, sel_registerName("setAutoresizingMask:"), 18UL);
|
|
35
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(cv, sel_registerName("setAutoresizesSubviews:"), 1);
|
|
36
|
+
self.handle = (uint64_t)sheet;
|
|
37
|
+
self.host = window->handle;
|
|
38
|
+
```
|
|
39
|
+
```
|
|
40
|
+
#arch: aarch64_use_c
|
|
41
|
+
#platform: macos
|
|
42
|
+
unsigned long style = 1 | 2; // NSWindowStyleMaskTitled | Closable
|
|
43
|
+
id sheet = ((id(*)(id, SEL, double, double, double, double, unsigned long, unsigned long, BOOL))objc_msgSend)(
|
|
44
|
+
((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSWindow"), sel_registerName("alloc")),
|
|
45
|
+
sel_registerName("initWithContentRect:styleMask:backing:defer:"),
|
|
46
|
+
0.0, 0.0, (double)width, (double)height,
|
|
47
|
+
style, 2, 0);
|
|
48
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(sheet, sel_registerName("setReleasedWhenClosed:"), 0);
|
|
49
|
+
id cv = ((id(*)(id, SEL))objc_msgSend)(sheet, sel_registerName("contentView"));
|
|
50
|
+
((void(*)(id, SEL, unsigned long))objc_msgSend)(cv, sel_registerName("setAutoresizingMask:"), 18UL);
|
|
51
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(cv, sel_registerName("setAutoresizesSubviews:"), 1);
|
|
52
|
+
self->handle = (uint64_t)sheet;
|
|
53
|
+
self->host = window->handle;
|
|
54
|
+
```
|
|
55
|
+
```
|
|
56
|
+
#arch: c
|
|
57
|
+
#platform: ios
|
|
58
|
+
/* TODO: iOS — UISheetPresentationController (iOS 15+) needs a
|
|
59
|
+
* presenting view controller (see GUI_PLAN Tier 1 #20; defer). */
|
|
60
|
+
```
|
|
61
|
+
```
|
|
62
|
+
#arch: aarch64_use_c
|
|
63
|
+
#platform: ios
|
|
64
|
+
/* TODO: iOS — UISheetPresentationController (iOS 15+) needs a
|
|
65
|
+
* presenting view controller (see GUI_PLAN Tier 1 #20; defer). */
|
|
66
|
+
```
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// A Window-shaped handle to the sheet's contentView: pass it to control
|
|
70
|
+
// constructors and `Container.layout` to host controls in the sheet.
|
|
71
|
+
// The value retains the sheet's window (+1), so its scope-exit
|
|
72
|
+
// `#destroy` releases its OWN reference and the Sheet's stays balanced
|
|
73
|
+
// — keep the Sheet alive at least as long as the returned value.
|
|
74
|
+
pub func content_window = (self, out Window) {
|
|
75
|
+
```
|
|
76
|
+
#arch: c
|
|
77
|
+
#platform: macos
|
|
78
|
+
extern void *_Window_traits[];
|
|
79
|
+
struct Window w;
|
|
80
|
+
w._vt = (void *)&_Window_traits;
|
|
81
|
+
w.handle = self->handle;
|
|
82
|
+
((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("retain"));
|
|
83
|
+
return w;
|
|
84
|
+
```
|
|
85
|
+
```
|
|
86
|
+
#arch: aarch64_use_c
|
|
87
|
+
#platform: macos
|
|
88
|
+
extern void *Window_traits;
|
|
89
|
+
struct Window w;
|
|
90
|
+
w._vt = (void *)&Window_traits;
|
|
91
|
+
w.handle = self->handle;
|
|
92
|
+
((id(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("retain"));
|
|
93
|
+
return w;
|
|
94
|
+
```
|
|
95
|
+
```
|
|
96
|
+
#arch: c
|
|
97
|
+
#platform: ios
|
|
98
|
+
/* TODO: iOS (see #init) */
|
|
99
|
+
{
|
|
100
|
+
extern void *_Window_traits[];
|
|
101
|
+
struct Window w;
|
|
102
|
+
w._vt = (void *)&_Window_traits;
|
|
103
|
+
w.handle = 0;
|
|
104
|
+
return w;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
```
|
|
108
|
+
#arch: aarch64_use_c
|
|
109
|
+
#platform: ios
|
|
110
|
+
/* TODO: iOS (see #init) */
|
|
111
|
+
{
|
|
112
|
+
extern void *Window_traits;
|
|
113
|
+
struct Window w;
|
|
114
|
+
w._vt = (void *)&Window_traits;
|
|
115
|
+
w.handle = 0;
|
|
116
|
+
return w;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pub func set_title = (self, string title) {
|
|
122
|
+
```
|
|
123
|
+
#arch: c
|
|
124
|
+
#platform: macos
|
|
125
|
+
((void(*)(id, SEL, id))objc_msgSend)(
|
|
126
|
+
(id)self->handle, sel_registerName("setTitle:"),
|
|
127
|
+
((id(*)(id, SEL, const char*))objc_msgSend)(
|
|
128
|
+
(id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), title.ptr));
|
|
129
|
+
```
|
|
130
|
+
```
|
|
131
|
+
#arch: aarch64_use_c
|
|
132
|
+
#platform: macos
|
|
133
|
+
((void(*)(id, SEL, id))objc_msgSend)(
|
|
134
|
+
(id)self->handle, sel_registerName("setTitle:"),
|
|
135
|
+
((id(*)(id, SEL, const char*))objc_msgSend)(
|
|
136
|
+
(id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), title.ptr));
|
|
137
|
+
```
|
|
138
|
+
```
|
|
139
|
+
#arch: c
|
|
140
|
+
#platform: ios
|
|
141
|
+
/* TODO: iOS (see #init) */
|
|
142
|
+
```
|
|
143
|
+
```
|
|
144
|
+
#arch: aarch64_use_c
|
|
145
|
+
#platform: ios
|
|
146
|
+
/* TODO: iOS (see #init) */
|
|
147
|
+
```
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
pub func get_title = (self, out string) {
|
|
151
|
+
```
|
|
152
|
+
#arch: c
|
|
153
|
+
#platform: macos
|
|
154
|
+
id str = ((id(*)(id, SEL))objc_msgSend)(
|
|
155
|
+
(id)self->handle, sel_registerName("title"));
|
|
156
|
+
if (!str) return (nomen_string){ strdup(""), 0 };
|
|
157
|
+
const char *cstr = ((const char*(*)(id, SEL))objc_msgSend)(
|
|
158
|
+
str, sel_registerName("UTF8String"));
|
|
159
|
+
return (nomen_string){ strdup(cstr), (long)strlen(cstr) };
|
|
160
|
+
```
|
|
161
|
+
```
|
|
162
|
+
#arch: aarch64_use_c
|
|
163
|
+
#platform: macos
|
|
164
|
+
id str = ((id(*)(id, SEL))objc_msgSend)(
|
|
165
|
+
(id)self->handle, sel_registerName("title"));
|
|
166
|
+
if (!str) return (nomen_string){ strdup(""), 0 };
|
|
167
|
+
const char *cstr = ((const char*(*)(id, SEL))objc_msgSend)(
|
|
168
|
+
str, sel_registerName("UTF8String"));
|
|
169
|
+
return (nomen_string){ strdup(cstr), (long)strlen(cstr) };
|
|
170
|
+
```
|
|
171
|
+
```
|
|
172
|
+
#arch: c
|
|
173
|
+
#platform: ios
|
|
174
|
+
/* TODO: iOS (see #init) */
|
|
175
|
+
return (nomen_string){ strdup(""), 0 };
|
|
176
|
+
```
|
|
177
|
+
```
|
|
178
|
+
#arch: aarch64_use_c
|
|
179
|
+
#platform: ios
|
|
180
|
+
/* TODO: iOS (see #init) */
|
|
181
|
+
return (nomen_string){ strdup(""), 0 };
|
|
182
|
+
```
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Slide the sheet out of the host window's title bar. Non-blocking: the
|
|
186
|
+
// sheet stays up while the manual loop keeps polling.
|
|
187
|
+
pub func present = (self) {
|
|
188
|
+
```
|
|
189
|
+
#arch: c
|
|
190
|
+
#platform: macos
|
|
191
|
+
((void(*)(id, SEL, id, id, id))objc_msgSend)(
|
|
192
|
+
(id)self->host, sel_registerName("beginSheet:completionHandler:"),
|
|
193
|
+
(id)self->handle, (id)0, (id)0);
|
|
194
|
+
```
|
|
195
|
+
```
|
|
196
|
+
#arch: aarch64_use_c
|
|
197
|
+
#platform: macos
|
|
198
|
+
((void(*)(id, SEL, id, id, id))objc_msgSend)(
|
|
199
|
+
(id)self->host, sel_registerName("beginSheet:completionHandler:"),
|
|
200
|
+
(id)self->handle, (id)0, (id)0);
|
|
201
|
+
```
|
|
202
|
+
```
|
|
203
|
+
#arch: c
|
|
204
|
+
#platform: ios
|
|
205
|
+
/* TODO: iOS (see #init) */
|
|
206
|
+
```
|
|
207
|
+
```
|
|
208
|
+
#arch: aarch64_use_c
|
|
209
|
+
#platform: ios
|
|
210
|
+
/* TODO: iOS (see #init) */
|
|
211
|
+
```
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Close the sheet (the host regains focus).
|
|
215
|
+
pub func dismiss = (self) {
|
|
216
|
+
```
|
|
217
|
+
#arch: c
|
|
218
|
+
#platform: macos
|
|
219
|
+
id app = ((id(*)(id, SEL))objc_msgSend)(
|
|
220
|
+
(id)objc_getClass("NSApplication"), sel_registerName("sharedApplication"));
|
|
221
|
+
((void(*)(id, SEL, id))objc_msgSend)(app, sel_registerName("endSheet:"), (id)self->handle);
|
|
222
|
+
((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("orderOut:"), (id)0);
|
|
223
|
+
```
|
|
224
|
+
```
|
|
225
|
+
#arch: aarch64_use_c
|
|
226
|
+
#platform: macos
|
|
227
|
+
id app = ((id(*)(id, SEL))objc_msgSend)(
|
|
228
|
+
(id)objc_getClass("NSApplication"), sel_registerName("sharedApplication"));
|
|
229
|
+
((void(*)(id, SEL, id))objc_msgSend)(app, sel_registerName("endSheet:"), (id)self->handle);
|
|
230
|
+
((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("orderOut:"), (id)0);
|
|
231
|
+
```
|
|
232
|
+
```
|
|
233
|
+
#arch: c
|
|
234
|
+
#platform: ios
|
|
235
|
+
/* TODO: iOS (see #init) */
|
|
236
|
+
```
|
|
237
|
+
```
|
|
238
|
+
#arch: aarch64_use_c
|
|
239
|
+
#platform: ios
|
|
240
|
+
/* TODO: iOS (see #init) */
|
|
241
|
+
```
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// True while the sheet is attached to its host window.
|
|
245
|
+
pub func is_presented = (self, out bool) {
|
|
246
|
+
```
|
|
247
|
+
#arch: c
|
|
248
|
+
#platform: macos
|
|
249
|
+
id attached = ((id(*)(id, SEL))objc_msgSend)(
|
|
250
|
+
(id)self->host, sel_registerName("attachedSheet"));
|
|
251
|
+
return attached == (id)self->handle ? 1 : 0;
|
|
252
|
+
```
|
|
253
|
+
```
|
|
254
|
+
#arch: aarch64_use_c
|
|
255
|
+
#platform: macos
|
|
256
|
+
id attached = ((id(*)(id, SEL))objc_msgSend)(
|
|
257
|
+
(id)self->host, sel_registerName("attachedSheet"));
|
|
258
|
+
return attached == (id)self->handle ? 1 : 0;
|
|
259
|
+
```
|
|
260
|
+
```
|
|
261
|
+
#arch: c
|
|
262
|
+
#platform: ios
|
|
263
|
+
/* TODO: iOS (see #init) */
|
|
264
|
+
return 0;
|
|
265
|
+
```
|
|
266
|
+
```
|
|
267
|
+
#arch: aarch64_use_c
|
|
268
|
+
#platform: ios
|
|
269
|
+
/* TODO: iOS (see #init) */
|
|
270
|
+
return 0;
|
|
271
|
+
```
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ── Control trait conformance ──
|
|
275
|
+
// A sheet is window-coordinated like Alert: the layout engine never
|
|
276
|
+
// frames it (its own NSWindow carries the geometry).
|
|
277
|
+
pub func set_frame = (ref self, int x, int y, int width, int height) {
|
|
278
|
+
// No-op: the sheet's NSWindow carries the geometry.
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
pub func intrinsic_size = (self, out Size) {
|
|
282
|
+
var s = Size()
|
|
283
|
+
return s
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
pub func measure = (self, BoxConstraints constraints, out Size) {
|
|
287
|
+
var s = Size()
|
|
288
|
+
return s
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
func #destroy = () {
|
|
292
|
+
```
|
|
293
|
+
#arch: c
|
|
294
|
+
#platform: macos
|
|
295
|
+
if (self->handle) {
|
|
296
|
+
id app = ((id(*)(id, SEL))objc_msgSend)(
|
|
297
|
+
(id)objc_getClass("NSApplication"), sel_registerName("sharedApplication"));
|
|
298
|
+
((void(*)(id, SEL, id))objc_msgSend)(app, sel_registerName("endSheet:"), (id)self->handle);
|
|
299
|
+
((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("orderOut:"), (id)0);
|
|
300
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
|
|
301
|
+
self->handle = 0;
|
|
302
|
+
}
|
|
303
|
+
self->host = 0;
|
|
304
|
+
```
|
|
305
|
+
```
|
|
306
|
+
#arch: aarch64_use_c
|
|
307
|
+
#platform: macos
|
|
308
|
+
if (self->handle) {
|
|
309
|
+
id app = ((id(*)(id, SEL))objc_msgSend)(
|
|
310
|
+
(id)objc_getClass("NSApplication"), sel_registerName("sharedApplication"));
|
|
311
|
+
((void(*)(id, SEL, id))objc_msgSend)(app, sel_registerName("endSheet:"), (id)self->handle);
|
|
312
|
+
((void(*)(id, SEL, id))objc_msgSend)((id)self->handle, sel_registerName("orderOut:"), (id)0);
|
|
313
|
+
((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
|
|
314
|
+
self->handle = 0;
|
|
315
|
+
}
|
|
316
|
+
self->host = 0;
|
|
317
|
+
```
|
|
318
|
+
```
|
|
319
|
+
#arch: c
|
|
320
|
+
#platform: ios
|
|
321
|
+
/* TODO: iOS (see #init) */
|
|
322
|
+
```
|
|
323
|
+
```
|
|
324
|
+
#arch: aarch64_use_c
|
|
325
|
+
#platform: ios
|
|
326
|
+
/* TODO: iOS (see #init) */
|
|
327
|
+
```
|
|
328
|
+
}
|
|
329
|
+
}
|