ssui 1.0.0__tar.gz
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.
- ssui-1.0.0/Cargo.lock +353 -0
- ssui-1.0.0/Cargo.toml +10 -0
- ssui-1.0.0/PKG-INFO +18 -0
- ssui-1.0.0/core/Cargo.toml +46 -0
- ssui-1.0.0/core/examples/clear_screen.rs +191 -0
- ssui-1.0.0/core/src/lib.rs +9 -0
- ssui-1.0.0/core/src/platform/dpi.rs +9 -0
- ssui-1.0.0/core/src/platform/mod.rs +4 -0
- ssui-1.0.0/core/src/platform/window.rs +499 -0
- ssui-1.0.0/core/src/render/canvas.rs +326 -0
- ssui-1.0.0/core/src/render/device.rs +4353 -0
- ssui-1.0.0/core/src/render/mod.rs +7 -0
- ssui-1.0.0/core/src/render/types.rs +125 -0
- ssui-1.0.0/core/src/theme.rs +76 -0
- ssui-1.0.0/core/src/tree/css.rs +339 -0
- ssui-1.0.0/core/src/tree/mod.rs +2895 -0
- ssui-1.0.0/pyproject.toml +29 -0
- ssui-1.0.0/python/Cargo.toml +18 -0
- ssui-1.0.0/python/examples/depth_demo.py +37 -0
- ssui-1.0.0/python/examples/depth_raise.py +37 -0
- ssui-1.0.0/python/examples/fonts.py +61 -0
- ssui-1.0.0/python/examples/glass.py +32 -0
- ssui-1.0.0/python/examples/live.css +16 -0
- ssui-1.0.0/python/examples/showcase.py +597 -0
- ssui-1.0.0/python/examples/test.png +0 -0
- ssui-1.0.0/python/examples/widgets.py +281 -0
- ssui-1.0.0/python/src/lib.rs +2854 -0
ssui-1.0.0/Cargo.lock
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "ahash"
|
|
7
|
+
version = "0.8.12"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"cfg-if",
|
|
12
|
+
"once_cell",
|
|
13
|
+
"version_check",
|
|
14
|
+
"zerocopy",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "allocator-api2"
|
|
19
|
+
version = "0.2.21"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "autocfg"
|
|
25
|
+
version = "1.5.1"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "cfg-if"
|
|
31
|
+
version = "1.0.4"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "hashbrown"
|
|
37
|
+
version = "0.14.5"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
|
40
|
+
dependencies = [
|
|
41
|
+
"ahash",
|
|
42
|
+
"allocator-api2",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[package]]
|
|
46
|
+
name = "heck"
|
|
47
|
+
version = "0.5.0"
|
|
48
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "indoc"
|
|
53
|
+
version = "2.0.7"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
56
|
+
dependencies = [
|
|
57
|
+
"rustversion",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[[package]]
|
|
61
|
+
name = "libc"
|
|
62
|
+
version = "0.2.186"
|
|
63
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
64
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
65
|
+
|
|
66
|
+
[[package]]
|
|
67
|
+
name = "memoffset"
|
|
68
|
+
version = "0.9.1"
|
|
69
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
71
|
+
dependencies = [
|
|
72
|
+
"autocfg",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[[package]]
|
|
76
|
+
name = "once_cell"
|
|
77
|
+
version = "1.21.4"
|
|
78
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
79
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
80
|
+
|
|
81
|
+
[[package]]
|
|
82
|
+
name = "portable-atomic"
|
|
83
|
+
version = "1.13.1"
|
|
84
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
86
|
+
|
|
87
|
+
[[package]]
|
|
88
|
+
name = "proc-macro2"
|
|
89
|
+
version = "1.0.106"
|
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
91
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
92
|
+
dependencies = [
|
|
93
|
+
"unicode-ident",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "pyo3"
|
|
98
|
+
version = "0.23.5"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
|
|
101
|
+
dependencies = [
|
|
102
|
+
"cfg-if",
|
|
103
|
+
"indoc",
|
|
104
|
+
"libc",
|
|
105
|
+
"memoffset",
|
|
106
|
+
"once_cell",
|
|
107
|
+
"portable-atomic",
|
|
108
|
+
"pyo3-build-config",
|
|
109
|
+
"pyo3-ffi",
|
|
110
|
+
"pyo3-macros",
|
|
111
|
+
"unindent",
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
[[package]]
|
|
115
|
+
name = "pyo3-build-config"
|
|
116
|
+
version = "0.23.5"
|
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
118
|
+
checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
|
|
119
|
+
dependencies = [
|
|
120
|
+
"once_cell",
|
|
121
|
+
"target-lexicon",
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
[[package]]
|
|
125
|
+
name = "pyo3-ffi"
|
|
126
|
+
version = "0.23.5"
|
|
127
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
128
|
+
checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
|
|
129
|
+
dependencies = [
|
|
130
|
+
"libc",
|
|
131
|
+
"pyo3-build-config",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "pyo3-macros"
|
|
136
|
+
version = "0.23.5"
|
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
+
checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
|
|
139
|
+
dependencies = [
|
|
140
|
+
"proc-macro2",
|
|
141
|
+
"pyo3-macros-backend",
|
|
142
|
+
"quote",
|
|
143
|
+
"syn",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "pyo3-macros-backend"
|
|
148
|
+
version = "0.23.5"
|
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
+
checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
|
|
151
|
+
dependencies = [
|
|
152
|
+
"heck",
|
|
153
|
+
"proc-macro2",
|
|
154
|
+
"pyo3-build-config",
|
|
155
|
+
"quote",
|
|
156
|
+
"syn",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
[[package]]
|
|
160
|
+
name = "quote"
|
|
161
|
+
version = "1.0.46"
|
|
162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
+
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
|
164
|
+
dependencies = [
|
|
165
|
+
"proc-macro2",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "rustversion"
|
|
170
|
+
version = "1.0.23"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "ssui-core"
|
|
176
|
+
version = "1.0.0"
|
|
177
|
+
dependencies = [
|
|
178
|
+
"hashbrown",
|
|
179
|
+
"windows",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[[package]]
|
|
183
|
+
name = "ssui-python"
|
|
184
|
+
version = "1.0.0"
|
|
185
|
+
dependencies = [
|
|
186
|
+
"pyo3",
|
|
187
|
+
"ssui-core",
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
[[package]]
|
|
191
|
+
name = "syn"
|
|
192
|
+
version = "2.0.118"
|
|
193
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
194
|
+
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
|
195
|
+
dependencies = [
|
|
196
|
+
"proc-macro2",
|
|
197
|
+
"quote",
|
|
198
|
+
"unicode-ident",
|
|
199
|
+
]
|
|
200
|
+
|
|
201
|
+
[[package]]
|
|
202
|
+
name = "target-lexicon"
|
|
203
|
+
version = "0.12.16"
|
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
205
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
206
|
+
|
|
207
|
+
[[package]]
|
|
208
|
+
name = "unicode-ident"
|
|
209
|
+
version = "1.0.24"
|
|
210
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
211
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
212
|
+
|
|
213
|
+
[[package]]
|
|
214
|
+
name = "unindent"
|
|
215
|
+
version = "0.2.4"
|
|
216
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
218
|
+
|
|
219
|
+
[[package]]
|
|
220
|
+
name = "version_check"
|
|
221
|
+
version = "0.9.5"
|
|
222
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|
224
|
+
|
|
225
|
+
[[package]]
|
|
226
|
+
name = "windows"
|
|
227
|
+
version = "0.62.2"
|
|
228
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
229
|
+
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
|
|
230
|
+
dependencies = [
|
|
231
|
+
"windows-collections",
|
|
232
|
+
"windows-core",
|
|
233
|
+
"windows-future",
|
|
234
|
+
"windows-numerics",
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "windows-collections"
|
|
239
|
+
version = "0.3.2"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
|
|
242
|
+
dependencies = [
|
|
243
|
+
"windows-core",
|
|
244
|
+
]
|
|
245
|
+
|
|
246
|
+
[[package]]
|
|
247
|
+
name = "windows-core"
|
|
248
|
+
version = "0.62.2"
|
|
249
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
250
|
+
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
|
251
|
+
dependencies = [
|
|
252
|
+
"windows-implement",
|
|
253
|
+
"windows-interface",
|
|
254
|
+
"windows-link",
|
|
255
|
+
"windows-result",
|
|
256
|
+
"windows-strings",
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
[[package]]
|
|
260
|
+
name = "windows-future"
|
|
261
|
+
version = "0.3.2"
|
|
262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
+
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
|
|
264
|
+
dependencies = [
|
|
265
|
+
"windows-core",
|
|
266
|
+
"windows-link",
|
|
267
|
+
"windows-threading",
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "windows-implement"
|
|
272
|
+
version = "0.60.2"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
|
275
|
+
dependencies = [
|
|
276
|
+
"proc-macro2",
|
|
277
|
+
"quote",
|
|
278
|
+
"syn",
|
|
279
|
+
]
|
|
280
|
+
|
|
281
|
+
[[package]]
|
|
282
|
+
name = "windows-interface"
|
|
283
|
+
version = "0.59.3"
|
|
284
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
285
|
+
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
|
286
|
+
dependencies = [
|
|
287
|
+
"proc-macro2",
|
|
288
|
+
"quote",
|
|
289
|
+
"syn",
|
|
290
|
+
]
|
|
291
|
+
|
|
292
|
+
[[package]]
|
|
293
|
+
name = "windows-link"
|
|
294
|
+
version = "0.2.1"
|
|
295
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
296
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
297
|
+
|
|
298
|
+
[[package]]
|
|
299
|
+
name = "windows-numerics"
|
|
300
|
+
version = "0.3.1"
|
|
301
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
302
|
+
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
|
|
303
|
+
dependencies = [
|
|
304
|
+
"windows-core",
|
|
305
|
+
"windows-link",
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
[[package]]
|
|
309
|
+
name = "windows-result"
|
|
310
|
+
version = "0.4.1"
|
|
311
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
312
|
+
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
|
313
|
+
dependencies = [
|
|
314
|
+
"windows-link",
|
|
315
|
+
]
|
|
316
|
+
|
|
317
|
+
[[package]]
|
|
318
|
+
name = "windows-strings"
|
|
319
|
+
version = "0.5.1"
|
|
320
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
321
|
+
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
|
322
|
+
dependencies = [
|
|
323
|
+
"windows-link",
|
|
324
|
+
]
|
|
325
|
+
|
|
326
|
+
[[package]]
|
|
327
|
+
name = "windows-threading"
|
|
328
|
+
version = "0.2.1"
|
|
329
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
330
|
+
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
|
|
331
|
+
dependencies = [
|
|
332
|
+
"windows-link",
|
|
333
|
+
]
|
|
334
|
+
|
|
335
|
+
[[package]]
|
|
336
|
+
name = "zerocopy"
|
|
337
|
+
version = "0.8.54"
|
|
338
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
339
|
+
checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19"
|
|
340
|
+
dependencies = [
|
|
341
|
+
"zerocopy-derive",
|
|
342
|
+
]
|
|
343
|
+
|
|
344
|
+
[[package]]
|
|
345
|
+
name = "zerocopy-derive"
|
|
346
|
+
version = "0.8.54"
|
|
347
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
348
|
+
checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"
|
|
349
|
+
dependencies = [
|
|
350
|
+
"proc-macro2",
|
|
351
|
+
"quote",
|
|
352
|
+
"syn",
|
|
353
|
+
]
|
ssui-1.0.0/Cargo.toml
ADDED
ssui-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ssui
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
9
|
+
Classifier: Programming Language :: Rust
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
14
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
License-File: AUTHORS
|
|
17
|
+
Author: Sergievskiy Sergey
|
|
18
|
+
Requires-Python: >=3.11
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "ssui-core"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
description = "Нативное ядро SSUI (Windows, Direct3D 11)."
|
|
7
|
+
repository = "https://github.com/golden777ace/SSUI"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[lib]
|
|
11
|
+
name = "ssui_core"
|
|
12
|
+
|
|
13
|
+
[dependencies]
|
|
14
|
+
hashbrown = "0.14"
|
|
15
|
+
|
|
16
|
+
[target.'cfg(windows)'.dependencies.windows]
|
|
17
|
+
|
|
18
|
+
version = "0.62"
|
|
19
|
+
features = [
|
|
20
|
+
"Win32_Foundation",
|
|
21
|
+
"Win32_Graphics_Direct3D",
|
|
22
|
+
"Win32_Graphics_Direct3D11",
|
|
23
|
+
"Win32_Graphics_Dxgi",
|
|
24
|
+
"Win32_Graphics_Dxgi_Common",
|
|
25
|
+
"Win32_Graphics_Gdi",
|
|
26
|
+
"Win32_Graphics_Direct2D",
|
|
27
|
+
"Win32_Graphics_Direct2D_Common",
|
|
28
|
+
"Win32_Graphics_DirectWrite",
|
|
29
|
+
"Win32_Graphics_DirectComposition",
|
|
30
|
+
"Win32_Graphics_Imaging",
|
|
31
|
+
"Win32_System_Com",
|
|
32
|
+
"Win32_System_LibraryLoader",
|
|
33
|
+
"Win32_System_DataExchange",
|
|
34
|
+
"Win32_System_Memory",
|
|
35
|
+
"Win32_System_Ole",
|
|
36
|
+
"Win32_System_Threading",
|
|
37
|
+
"Win32_UI_WindowsAndMessaging",
|
|
38
|
+
"Win32_UI_Input_KeyboardAndMouse",
|
|
39
|
+
"Win32_UI_Input_Ime",
|
|
40
|
+
"Win32_UI_HiDpi",
|
|
41
|
+
"Win32_UI_Shell",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[[example]]
|
|
45
|
+
name = "clear_screen"
|
|
46
|
+
path = "examples/clear_screen.rs"
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
use std::cell::Cell;
|
|
2
|
+
use std::rc::Rc;
|
|
3
|
+
|
|
4
|
+
use ssui_core::platform::{dpi, Window};
|
|
5
|
+
use ssui_core::render::Color;
|
|
6
|
+
use ssui_core::tree::{Axis, NodeKind, Props, Style, TextState, Tree};
|
|
7
|
+
|
|
8
|
+
fn label(text: &str) -> NodeKind {
|
|
9
|
+
NodeKind::Label {
|
|
10
|
+
text: text.encode_utf16().collect(),
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fn utf16(text: &str) -> Vec<u16> {
|
|
15
|
+
text.encode_utf16().collect()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fn main() -> windows::core::Result<()> {
|
|
19
|
+
dpi::enable_dpi_awareness();
|
|
20
|
+
|
|
21
|
+
let mut tree = Tree::new();
|
|
22
|
+
let root = tree.root();
|
|
23
|
+
tree.set_props(
|
|
24
|
+
root,
|
|
25
|
+
Props {
|
|
26
|
+
axis: Axis::Vertical,
|
|
27
|
+
padding: 24.0,
|
|
28
|
+
gap: 16.0,
|
|
29
|
+
..Default::default()
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
let panel = tree.add_child(
|
|
34
|
+
root,
|
|
35
|
+
NodeKind::Frame { radius: 16.0 },
|
|
36
|
+
Props {
|
|
37
|
+
axis: Axis::Vertical,
|
|
38
|
+
padding: 20.0,
|
|
39
|
+
gap: 12.0,
|
|
40
|
+
..Default::default()
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
let count_label = tree.add_child(
|
|
45
|
+
panel,
|
|
46
|
+
label("Clicks: 0"),
|
|
47
|
+
Props {
|
|
48
|
+
height: Some(40.0),
|
|
49
|
+
..Default::default()
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
let row = tree.add_child(
|
|
54
|
+
panel,
|
|
55
|
+
NodeKind::Container,
|
|
56
|
+
Props {
|
|
57
|
+
axis: Axis::Horizontal,
|
|
58
|
+
gap: 12.0,
|
|
59
|
+
height: Some(48.0),
|
|
60
|
+
..Default::default()
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
let minus = tree.add_child(
|
|
64
|
+
row,
|
|
65
|
+
NodeKind::Button {
|
|
66
|
+
label: utf16("-"),
|
|
67
|
+
radius: 10.0,
|
|
68
|
+
},
|
|
69
|
+
Props {
|
|
70
|
+
width: Some(64.0),
|
|
71
|
+
..Default::default()
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
tree.set_style(
|
|
75
|
+
minus,
|
|
76
|
+
Style {
|
|
77
|
+
fill: Some(Color::hex(0xE5484D)),
|
|
78
|
+
text: Some(Color::hex(0xFFFFFF)),
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
let plus = tree.add_child(
|
|
82
|
+
row,
|
|
83
|
+
NodeKind::Button {
|
|
84
|
+
label: utf16("+"),
|
|
85
|
+
radius: 10.0,
|
|
86
|
+
},
|
|
87
|
+
Props {
|
|
88
|
+
width: Some(64.0),
|
|
89
|
+
..Default::default()
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
tree.set_style(
|
|
93
|
+
plus,
|
|
94
|
+
Style {
|
|
95
|
+
fill: Some(Color::hex(0x2FBF71)),
|
|
96
|
+
text: Some(Color::hex(0xFFFFFF)),
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
tree.add_child(
|
|
101
|
+
panel,
|
|
102
|
+
NodeKind::Checkbox {
|
|
103
|
+
label: utf16("Enable feature"),
|
|
104
|
+
checked: false,
|
|
105
|
+
},
|
|
106
|
+
Props {
|
|
107
|
+
height: Some(28.0),
|
|
108
|
+
..Default::default()
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
tree.add_child(
|
|
113
|
+
panel,
|
|
114
|
+
label("Type in the box:"),
|
|
115
|
+
Props {
|
|
116
|
+
height: Some(24.0),
|
|
117
|
+
..Default::default()
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
tree.add_child(
|
|
121
|
+
panel,
|
|
122
|
+
NodeKind::TextBox {
|
|
123
|
+
state: TextState::new(),
|
|
124
|
+
},
|
|
125
|
+
Props {
|
|
126
|
+
height: Some(44.0),
|
|
127
|
+
width: Some(280.0),
|
|
128
|
+
..Default::default()
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
tree.add_child(
|
|
133
|
+
panel,
|
|
134
|
+
label("Press Space to cycle themes"),
|
|
135
|
+
Props {
|
|
136
|
+
height: Some(28.0),
|
|
137
|
+
..Default::default()
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
let value_label = tree.add_child(
|
|
141
|
+
panel,
|
|
142
|
+
label("Value: 50%"),
|
|
143
|
+
Props {
|
|
144
|
+
height: Some(28.0),
|
|
145
|
+
..Default::default()
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
let slider = tree.add_child(
|
|
149
|
+
panel,
|
|
150
|
+
NodeKind::Slider { value: 0.5 },
|
|
151
|
+
Props {
|
|
152
|
+
height: Some(40.0),
|
|
153
|
+
width: Some(240.0),
|
|
154
|
+
..Default::default()
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
let progress = tree.add_child(
|
|
158
|
+
panel,
|
|
159
|
+
NodeKind::Progress { value: 0.5 },
|
|
160
|
+
Props {
|
|
161
|
+
height: Some(24.0),
|
|
162
|
+
width: Some(240.0),
|
|
163
|
+
..Default::default()
|
|
164
|
+
},
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
let counter = Rc::new(Cell::new(0i32));
|
|
168
|
+
{
|
|
169
|
+
let counter = counter.clone();
|
|
170
|
+
tree.set_on_click(plus, move |t| {
|
|
171
|
+
counter.set(counter.get() + 1);
|
|
172
|
+
t.set_label_text(count_label, utf16(&format!("Clicks: {}", counter.get())));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
{
|
|
176
|
+
let counter = counter.clone();
|
|
177
|
+
tree.set_on_click(minus, move |t| {
|
|
178
|
+
counter.set(counter.get() - 1);
|
|
179
|
+
t.set_label_text(count_label, utf16(&format!("Clicks: {}", counter.get())));
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
tree.set_on_change(slider, move |t, v| {
|
|
183
|
+
let percent = (v * 100.0).round() as i32;
|
|
184
|
+
t.set_label_text(value_label, utf16(&format!("Value: {}%", percent)));
|
|
185
|
+
t.set_progress_value(progress, v);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
let window = Window::new("SSUI Demo", 1280, 720, tree)?;
|
|
189
|
+
window.run();
|
|
190
|
+
Ok(())
|
|
191
|
+
}
|