quickwin 3.0.1 → 3.0.3

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 (163) hide show
  1. package/README.en.md +3 -0
  2. package/README.md +2 -0
  3. package/package.json +2 -3
  4. package/qwin-nowasm-x86.exe +0 -0
  5. package/qwin-nowasm.exe +0 -0
  6. package/qwin-x86.exe +0 -0
  7. package/qwin.exe +0 -0
  8. package/examples/PdfCanvas.js +0 -38
  9. package/examples/PdfCanvas.tsx +0 -54
  10. package/examples/execd/main.js +0 -23379
  11. package/examples/execd/tray.js +0 -192
  12. package/examples/execd/worker.js +0 -122
  13. package/examples/pdf_preview2.js +0 -398
  14. package/examples/pdf_preview2.ts +0 -353
  15. package/examples/pdf_viewer.js +0 -22515
  16. package/examples/pdf_viewer.tsx +0 -228
  17. package/examples/test_gallery.js +0 -18692
  18. package/examples/test_gallery.tsx +0 -291
  19. package/examples/test_react_lazy.js +0 -18560
  20. package/examples/test_react_lazy.tsx +0 -65
  21. package/examples/test_react_listbox.js +0 -18562
  22. package/examples/test_react_listbox.tsx +0 -73
  23. package/examples/test_root_window.js +0 -18532
  24. package/examples/test_root_window.tsx +0 -41
  25. package/examples/test_tab.js +0 -18563
  26. package/examples/test_tab.tsx +0 -77
  27. package/examples/tray_demo.js +0 -86
  28. package/examples/tray_demo.tsx +0 -89
  29. package/test/add.wasm +0 -0
  30. package/test/bench_ffi_callraw.js +0 -235
  31. package/test/bench_ffi_callraw.ts +0 -235
  32. package/test/bench_ffi_overhead.js +0 -139
  33. package/test/bench_ffi_overhead.ts +0 -141
  34. package/test/bench_sendmessage.js +0 -104
  35. package/test/bench_sendmessage.ts +0 -100
  36. package/test/bench_sendmessage_nonnull.js +0 -187
  37. package/test/bench_sendmessage_nonnull.ts +0 -188
  38. package/test/complex.wasm +0 -0
  39. package/test/complex_imports.wasm +0 -0
  40. package/test/debug/http_server_e2e.js +0 -31
  41. package/test/debug/minwasm.js +0 -52
  42. package/test/debug/mupdf_debug.js +0 -86
  43. package/test/debug/wasm.js +0 -122
  44. package/test/debug/wasm_export_debug.js +0 -54
  45. package/test/debug/wasm_names.js +0 -36
  46. package/test/example.pdf +0 -0
  47. package/test/global_imports.wasm +0 -0
  48. package/test/import_func.wasm +0 -0
  49. package/test/imports.wasm +0 -0
  50. package/test/mupdf-cdn.js +0 -40
  51. package/test/mupdf-cdn.ts +0 -43
  52. package/test/run.js +0 -111
  53. package/test/run.ts +0 -116
  54. package/test/sjlj.wasm +0 -0
  55. package/test/test_basic.js +0 -7
  56. package/test/test_basic.ts +0 -9
  57. package/test/test_basic_fetch.js +0 -63
  58. package/test/test_basic_fetch.ts +0 -59
  59. package/test/test_brotli.js +0 -48
  60. package/test/test_brotli.ts +0 -52
  61. package/test/test_fetch_cache.js +0 -169
  62. package/test/test_fetch_cache.ts +0 -187
  63. package/test/test_ffi.js +0 -157
  64. package/test/test_ffi.ts +0 -170
  65. package/test/test_ffi_abi.js +0 -290
  66. package/test/test_ffi_abi.ts +0 -274
  67. package/test/test_ffi_array.js +0 -116
  68. package/test/test_ffi_array.ts +0 -141
  69. package/test/test_ffi_bind.js +0 -656
  70. package/test/test_ffi_bind.ts +0 -670
  71. package/test/test_ffi_struct.js +0 -779
  72. package/test/test_ffi_struct.ts +0 -828
  73. package/test/test_ffi_struct_layout.js +0 -495
  74. package/test/test_ffi_struct_layout.ts +0 -543
  75. package/test/test_ffi_user32.js +0 -103
  76. package/test/test_ffi_user32.ts +0 -113
  77. package/test/test_ffi_windows.js +0 -172
  78. package/test/test_ffi_windows.ts +0 -187
  79. package/test/test_files.js +0 -102
  80. package/test/test_files.ts +0 -121
  81. package/test/test_frame_encoding.js +0 -128
  82. package/test/test_frame_encoding.ts +0 -132
  83. package/test/test_gdi_draw.js +0 -681
  84. package/test/test_gdi_draw.ts +0 -725
  85. package/test/test_helper.js +0 -91
  86. package/test/test_helper.ts +0 -88
  87. package/test/test_http_import.js +0 -96
  88. package/test/test_http_import.ts +0 -93
  89. package/test/test_http_server.js +0 -214
  90. package/test/test_http_server.ts +0 -211
  91. package/test/test_import_dir.js +0 -4
  92. package/test/test_import_dir.ts +0 -5
  93. package/test/test_ipv6.js +0 -134
  94. package/test/test_ipv6.ts +0 -130
  95. package/test/test_jsx.js +0 -1314
  96. package/test/test_meta_url.js +0 -3
  97. package/test/test_meta_url.ts +0 -4
  98. package/test/test_mupdf_render.js +0 -51
  99. package/test/test_mupdf_render.ts +0 -55
  100. package/test/test_mupdf_twice.js +0 -62
  101. package/test/test_mupdf_twice.ts +0 -65
  102. package/test/test_mupdf_wasm.js +0 -39
  103. package/test/test_mupdf_wasm.ts +0 -32
  104. package/test/test_net_event.js +0 -57
  105. package/test/test_net_event.ts +0 -56
  106. package/test/test_net_fetch.js +0 -384
  107. package/test/test_net_fetch.ts +0 -373
  108. package/test/test_net_websocket.js +0 -180
  109. package/test/test_net_websocket.ts +0 -164
  110. package/test/test_polyfill.js +0 -144
  111. package/test/test_polyfill.ts +0 -159
  112. package/test/test_printer.js +0 -137
  113. package/test/test_printer.ts +0 -148
  114. package/test/test_proc.js +0 -141
  115. package/test/test_proc.ts +0 -163
  116. package/test/test_react_complex.js +0 -18678
  117. package/test/test_react_counter.js +0 -18555
  118. package/test/test_react_flex.js +0 -18871
  119. package/test/test_react_hidden.js +0 -18560
  120. package/test/test_react_listview_link.js +0 -18590
  121. package/test/test_react_notify.js +0 -18797
  122. package/test/test_react_render.js +0 -18550
  123. package/test/test_registry.js +0 -74
  124. package/test/test_registry.ts +0 -95
  125. package/test/test_sysinfo.js +0 -122
  126. package/test/test_sysinfo.ts +0 -141
  127. package/test/test_url.js +0 -173
  128. package/test/test_url.ts +0 -183
  129. package/test/test_wasm_basic.js +0 -85
  130. package/test/test_wasm_basic.ts +0 -73
  131. package/test/test_wasm_import_global.js +0 -41
  132. package/test/test_wasm_import_global.ts +0 -45
  133. package/test/test_wasm_sjlj.js +0 -145
  134. package/test/test_wasm_sjlj.ts +0 -125
  135. package/test/test_wasm_types.js +0 -97
  136. package/test/test_wasm_types.ts +0 -124
  137. package/test/test_wolfssl_read.js +0 -203
  138. package/test/test_wolfssl_read.ts +0 -184
  139. package/test/test_worker.js +0 -21
  140. package/test/test_worker.ts +0 -24
  141. package/test/test_worker_concurrent.js +0 -45
  142. package/test/test_worker_concurrent.ts +0 -56
  143. package/test/test_worker_data_url.js +0 -46
  144. package/test/test_worker_data_url.ts +0 -51
  145. package/test/test_worker_fetch.js +0 -26
  146. package/test/test_worker_fetch.ts +0 -27
  147. package/test/test_worker_net.js +0 -69
  148. package/test/test_worker_net.ts +0 -66
  149. package/test/test_worker_wasm_concurrent.js +0 -44
  150. package/test/test_worker_wasm_concurrent.ts +0 -45
  151. package/test/types.wasm +0 -0
  152. package/test/worker_fetch.js +0 -13
  153. package/test/worker_fetch.ts +0 -13
  154. package/test/worker_helper.js +0 -1
  155. package/test/worker_helper.ts +0 -1
  156. package/test/worker_http.js +0 -18
  157. package/test/worker_http.ts +0 -20
  158. package/test/worker_import_lib.js +0 -12
  159. package/test/worker_import_lib.ts +0 -13
  160. package/test/worker_module.js +0 -16
  161. package/test/worker_module.ts +0 -17
  162. package/test/worker_wasm_concurrent.js +0 -22
  163. package/test/worker_wasm_concurrent.ts +0 -22
@@ -1,291 +0,0 @@
1
- import '../lib/polyfill.js'
2
- import * as gui from 'gui'
3
- import { useState } from 'react'
4
- import {
5
- render, Button, Input, CheckBox, ProgressBar, ComboBox, Tab,
6
- ListView, type Column, ListBox, ScrollView, RadioButton, Slider,
7
- TreeView, type TreeNode, DateTimePicker, Link, Tooltip, PathPicker,
8
- } from '../lib/react-qw/index.js'
9
- import { ShowWindowCmd, WindowStyle, WmMsg } from '../constants'
10
- import { GetClientRect, PostQuitMessage, ShowWindow } from '../lib/windows/user32.js'
11
- import { getScaleFactor } from '../lib/dpi.js'
12
- import { RECT } from '../lib/windows/structs.js'
13
-
14
-
15
- gui.RegisterClass('Gallery', (hwnd, msg, wParam, lParam) => {
16
- if (!hwnd) return gui.DefWindowProc(hwnd, msg, wParam, lParam)
17
- if (msg === WmMsg.DESTROY) {
18
- PostQuitMessage(0)
19
- return 0
20
- }
21
- return gui.DefWindowProc(hwnd, msg, wParam, lParam)
22
- })
23
-
24
- const VISIBLE = WindowStyle.VISIBLE
25
- const CLIPCHILDREN = WindowStyle.CLIPCHILDREN
26
-
27
- interface Fruit {
28
- name: string
29
- color: string
30
- origin: string
31
- }
32
-
33
- const treeData: TreeNode[] = [
34
- {
35
- key: 'fruits', label: 'Fruits',
36
- children: [
37
- { key: 'apple', label: 'Apple' },
38
- { key: 'banana', label: 'Banana' },
39
- { key: 'cherry', label: 'Cherry' },
40
- ],
41
- },
42
- {
43
- key: 'veggies', label: 'Vegetables',
44
- children: [
45
- { key: 'carrot', label: 'Carrot' },
46
- { key: 'broccoli', label: 'Broccoli' },
47
- ],
48
- },
49
- {
50
- key: 'meats', label: 'Meats',
51
- children: [
52
- { key: 'chicken', label: 'Chicken' },
53
- { key: 'beef', label: 'Beef' },
54
- { key: 'pork', label: 'Pork' },
55
- ],
56
- },
57
- ]
58
-
59
- function App({ svW, svH }: { svW: number; svH: number }) {
60
- const [count, setCount] = useState(0)
61
- const [disabled, setDisabled] = useState(true)
62
- const [inputText, setInputText] = useState('')
63
- const [checkA, setCheckA] = useState(true)
64
- const [checkB, setCheckB] = useState(false)
65
- const [progress, setProgress] = useState(30)
66
- const [lbSel, setLbSel] = useState(0)
67
- const [cbSel, setCbSel] = useState(-1)
68
- const [radio, setRadio] = useState('a')
69
- const [sliderVal, setSliderVal] = useState(50)
70
- const [treeSel, setTreeSel] = useState<TreeNode | null>(null)
71
- const [dtDate, setDtDate] = useState<Date | null>(new Date())
72
- const [pickerPath, setPickerPath] = useState('')
73
- const [listData, setListData] = useState<Fruit[]>([
74
- { name: 'Apple', color: 'Red', origin: 'China' },
75
- { name: 'Banana', color: 'Yellow', origin: 'Philippines' },
76
- { name: 'Cherry', color: 'Dark Red', origin: 'USA' },
77
- { name: 'Date', color: 'Brown', origin: 'Middle East' },
78
- { name: 'Elderberry', color: 'Purple', origin: 'Europe' },
79
- { name: 'Fig', color: 'Purple', origin: 'Turkey' },
80
- { name: 'Grape', color: 'Green', origin: 'Italy' },
81
- ])
82
- const [listCols, setListCols] = useState<Column<Fruit>[]>([
83
- { name: 'Name', dataIndex: 'name' },
84
- { name: 'Color', dataIndex: 'color' },
85
- { name: 'Origin', dataIndex: 'origin' },
86
- ])
87
- const lbItems = listData.map(f => f.name)
88
- const cbItems = ['Red', 'Green', 'Blue', 'Yellow', 'Purple', 'Orange']
89
-
90
- return (
91
- <ScrollView style={{width:svW, height:svH}} contentHeight={1600}>
92
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN | WindowStyle.BORDER} style={{flexDirection:'column', gap:8, alignSelf:'stretch', flexGrow:1, padding:8}}>
93
- {/* ===== 三列上半区 ===== */}
94
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:10, height:345}}>
95
-
96
- {/* --- 左列: Buttons + CheckBoxes --- */}
97
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
98
- <w type="STATIC" ws={VISIBLE} text="Buttons" style={{height:24}} />
99
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
100
- <Tooltip text="Click to increment counter" balloon>
101
- <Button onClick={() => setCount(c => c + 1)} style={{flexGrow:1}}>
102
- {`Clicked ${count} times`}
103
- </Button>
104
- </Tooltip>
105
- <Button onClick={() => setCount(0)} style={{width:70}}>
106
- Reset
107
- </Button>
108
- </w>
109
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
110
- <Button onClick={() => setDisabled(d => !d)} style={{flexGrow:1}}>
111
- {`Toggle disabled (${String(disabled)})`}
112
- </Button>
113
- <Button disabled={disabled} style={{width:80}}>
114
- Disabled
115
- </Button>
116
- </w>
117
- <w type="STATIC" ws={VISIBLE} text="CheckBoxes" style={{height:24}} />
118
- <CheckBox checked={checkA} onChange={setCheckA} label={`Option A (${String(checkA)})`} style={{height:26}} />
119
- <CheckBox checked={checkB} onChange={setCheckB} label={`Option B (${String(checkB)})`} style={{height:26}} />
120
- <CheckBox label="Disabled checkbox" disabled style={{height:26}} />
121
- <w type="STATIC" ws={VISIBLE} text={`RadioButtons (${radio})`} style={{height:24}} />
122
- <RadioButton checked={radio === 'a'} onChange={() => setRadio('a')} label="Option A" style={{height:24}} />
123
- <RadioButton checked={radio === 'b'} onChange={() => setRadio('b')} label="Option B" style={{height:24}} />
124
- <RadioButton checked={radio === 'c'} onChange={() => setRadio('c')} label="Option C" style={{height:24}} />
125
- </w>
126
-
127
- {/* --- 中列: Input + ProgressBar --- */}
128
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
129
- <w type="STATIC" ws={VISIBLE} text="Input" style={{height:24}} />
130
- <Input value={inputText} onChange={setInputText} placeholder="Type here..." style={{height:28}} />
131
- <Input placeholder="Password" password style={{height:28}} />
132
- <Input value="Read only" readonly style={{height:28}} />
133
- <w type="STATIC" ws={VISIBLE} text="ProgressBar" style={{height:24}} />
134
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:24}}>
135
- <ProgressBar value={progress} max={100} smooth style={{flexGrow:1}} />
136
- <w type="STATIC" ws={VISIBLE} text={`${progress}%`} style={{width:40}} />
137
- </w>
138
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
139
- <Button onClick={() => setProgress(p => Math.min(100, p + 10))} style={{flexGrow:1}}>
140
- +10
141
- </Button>
142
- <Button onClick={() => setProgress(p => Math.max(0, p - 10))} style={{flexGrow:1}}>
143
- -10
144
- </Button>
145
- <Button onClick={() => setProgress(0)} style={{width:50}}>
146
- 0
147
- </Button>
148
- </w>
149
- <w type="STATIC" ws={VISIBLE} text={`Slider (${sliderVal})`} style={{height:24}} />
150
- <Slider value={sliderVal} onChange={setSliderVal} min={0} max={100} style={{height:30}} />
151
- </w>
152
-
153
- {/* --- 右列: ListBox + ComboBox --- */}
154
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
155
- <w type="STATIC" ws={VISIBLE} text={`ListBox (sel=${lbSel >= 0 ? lbItems[lbSel] : 'none'})`} style={{height:24}} />
156
- <ListBox items={lbItems} selectedIndex={lbSel} onChange={(i) => setLbSel(i)} style={{flexGrow:1}} />
157
- <w type="STATIC" ws={VISIBLE} text="ComboBox" style={{height:24}} />
158
- <ComboBox items={cbItems} selectedIndex={cbSel} onChange={(i) => setCbSel(i)} style={{height:26}} />
159
- <w type="STATIC" ws={VISIBLE}
160
- text={cbSel >= 0 ? `Selected: ${cbItems[cbSel]}` : '(none selected)'}
161
- style={{height:24}} />
162
- </w>
163
- </w>
164
-
165
- {/* ===== Auto-Size ===== */}
166
- <w type="STATIC" ws={VISIBLE} text="Auto-Size" style={{height:24}} />
167
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN | WindowStyle.BORDER} style={{flexDirection:'column', gap:6, alignSelf:'stretch', flexGrow:1}}>
168
- <w type="STATIC" ws={VISIBLE} text="Buttons (auto width)" style={{height:24}} />
169
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:30}}>
170
- <Button style={{width:'auto', height:30}}>OK</Button>
171
- <Button style={{width:'auto', height:30}}>Cancel</Button>
172
- <Button style={{width:'auto', height:30}}>A very long button text</Button>
173
- </w>
174
- <w type="STATIC" ws={VISIBLE} text="Statics (auto width)" style={{height:24}} />
175
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:24}}>
176
- <w type="STATIC" ws={VISIBLE | WindowStyle.BORDER} text="Short" style={{width:'auto', height:24}} />
177
- <w type="STATIC" ws={VISIBLE | WindowStyle.BORDER} text="A much longer label" style={{width:'auto', height:24}} />
178
- </w>
179
- <w type="STATIC" ws={VISIBLE} text="Mixed auto + fixed" style={{height:24}} />
180
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:30}}>
181
- <Button style={{width:150, height:30}}>Fixed 150</Button>
182
- <Button style={{width:'auto', height:30}}>Auto</Button>
183
- </w>
184
- </w>
185
-
186
- {/* ===== Tab Demo ===== */}
187
- <w type="STATIC" ws={VISIBLE} text="Tab" style={{height:24}} />
188
- <Tab
189
- tabs={[
190
- { title: 'Counter', content: (
191
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6}}>
192
- <w type="STATIC" ws={VISIBLE} text={`Count: ${count}`} style={{height:24}} />
193
- <Button onClick={() => setCount(c => c + 1)} style={{width:80}}>+1</Button>
194
- </w>
195
- )},
196
- { title: 'Typing', content: (
197
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6}}>
198
- <Input value={inputText} onChange={setInputText} placeholder="Type here..." style={{height:28}} />
199
- <w type="STATIC" ws={VISIBLE} text={inputText ? `You typed: ${inputText}` : '(empty)'} style={{height:24}} />
200
- </w>
201
- )},
202
- ]}
203
- style={{height:120}}
204
- />
205
-
206
- {/* ===== DateTimePicker ===== */}
207
- <w type="STATIC" ws={VISIBLE} text={`DateTimePicker (${dtDate ? `${dtDate.getFullYear()}-${String(dtDate.getMonth()+1).padStart(2,'0')}-${String(dtDate.getDate()).padStart(2,'0')}` : 'none'})`} style={{height:24}} />
208
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:28}}>
209
- <DateTimePicker value={dtDate} onChange={setDtDate} style={{flexGrow:1}} />
210
- <DateTimePicker value={dtDate} onChange={setDtDate} format="long" style={{flexGrow:1}} />
211
- <DateTimePicker value={dtDate} onChange={setDtDate} format="time" style={{flexGrow:1}} />
212
- </w>
213
-
214
- {/* ===== SysLink ===== */}
215
- <w type="STATIC" ws={VISIBLE} text="SysLink" style={{height:24}} />
216
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:28}}>
217
- <Link href="https://example.com" onClick={(url) => console.log('Link clicked:', url)} style={{flexGrow:1}}>
218
- Example Link
219
- </Link>
220
- <Link href="https://github.com" onClick={(url) => console.log('Link clicked:', url)} style={{flexGrow:1}} />
221
- </w>
222
-
223
- {/* ===== PathPicker ===== */}
224
- <w type="STATIC" ws={VISIBLE} text="PathPicker" style={{height:24}} />
225
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'column', gap:6, height:130}}>
226
- <PathPicker type="file" title="Select a file" style={{height:28}} />
227
- <PathPicker type="folder" title="Select a folder" style={{height:28}} />
228
- <PathPicker type="file" value={pickerPath} onChange={setPickerPath} title="Controlled" style={{height:28}} />
229
- <w type="STATIC" ws={VISIBLE} text={pickerPath ? `Selected: ${pickerPath}` : '(none)'} style={{height:20}} />
230
- </w>
231
-
232
- {/* ===== 下半区: ListView + ScrollView + TreeView ===== */}
233
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:400}}>
234
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
235
- <w type="STATIC" ws={VISIBLE} text={`ListView (${listData.length} items)`} style={{height:24}} />
236
- <w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', flexGrow:1}}>
237
- <ListView<Fruit>
238
- columns={listCols}
239
- data={listData}
240
- style={{flexGrow:1}}
241
- />
242
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, width:100}}>
243
- <Button onClick={() => setListData(d => [...d, { name: 'NewItem ' + String(listData.length + 1), color: '', origin: '' }])} style={{height:28}}>
244
- Add
245
- </Button>
246
- <Button onClick={() => setListCols(cols => [...cols, { name: 'Col' + (listCols.length + 1), dataIndex: 'name' as keyof Fruit }])} style={{height:28}}>
247
- +Column
248
- </Button>
249
- </w>
250
- </w>
251
- </w>
252
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
253
- <w type="STATIC" ws={VISIBLE} text="ScrollView (scrollable)" style={{height:24}} />
254
- <ScrollView style={{flexGrow:1}} contentWidth={500} contentHeight={560}>
255
- {Array.from({ length: 20 }, (_, i) => (
256
- <w type="STATIC" ws={VISIBLE}
257
- key={i}
258
- text={`Item ${i + 1} - ${i === 0 ? 'here is a line so wide that the horizontal scrollbar appears for demonstration' : ''}`}
259
- style={{width: i === 0 ? 500 : 200, height:28}}
260
- />
261
- ))}
262
- </ScrollView>
263
- </w>
264
- <w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
265
- <w type="STATIC" ws={VISIBLE} text={`TreeView (sel=${treeSel?.label ?? 'none'})`} style={{height:24}} />
266
- <TreeView data={treeData} onSelect={setTreeSel} style={{flexGrow:1}} />
267
- </w>
268
- </w>
269
- </w>
270
- </ScrollView>
271
- )
272
- }
273
-
274
- const hwnd = gui.CreateWindow(
275
- 'Gallery', 'Component Gallery',
276
- WindowStyle.OVERLAPPEDWINDOW,
277
- 100, 100, 1400, 1200, null, null
278
- )
279
-
280
- if (hwnd) {
281
- const crBuf = RECT.alloc()
282
- if (!GetClientRect(hwnd, crBuf.ptr)) throw new Error('gallery: GetClientRect failed')
283
- const { left, top, right, bottom } = RECT.decode(crBuf)
284
- const scale = getScaleFactor()
285
- const svW = Math.round((right - left) / scale)
286
- const svH = Math.round((bottom - top) / scale)
287
- render(<App svW={svW} svH={svH} />, hwnd)
288
- setTimeout(() => {
289
- ShowWindow(hwnd, ShowWindowCmd.SHOWNORMAL)
290
- }, 0)
291
- }