forked from parro-it/libui-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.js
756 lines (658 loc) · 24.5 KB
/
docs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
'use strict';
/* eslint-disable indent, operator-linebreak */
const resolve = require('path').resolve;
const writeFileSync = require('fs').writeFileSync;
const existsSync = require('fs').existsSync;
const bs = '```js';
const be = '```';
const t = '`';
let readme = `# libui-node
These pages document the ${t}libui-node${t} classes.
If you are new to the framework, you should start reading basic documentation on how it work:
* [Initialization & Event Loop](initialization.md) - explains how to initialize the framework and how the event loop works.
* [Properties](properties.md) - explains how widgets properties are implemented by ${t}libui-node${t}.
* [Events](events.md) - explains how widgets events are implemented by ${t}libui-node${t}.
* [Containers](containers.md) - explains how you can group widgets in tree hierarchies using different layout strategies.
* [Attributed Strings](attributedstring.md) - explains how you can style text (font, color, underline, ...)
`;
const readmePath = resolve(__dirname, 'docs/readme.md');
function writeFile(name, description, ...contents) {
const filename = name.slice(2).toLowerCase() + '.md';
const path = resolve(__dirname, 'docs', filename);
const imagePath = resolve(__dirname, 'docs/media/', name + '.png');
const imageMd = `![${name} example](media/${name}.png)`;
const image = existsSync(imagePath) ? imageMd : '';
readme += `
* [${name}](${filename}) - ${description}`;
const code = `var libui = require('libui');
var win = new libui.UiWindow('${name} example', 640, 480, true);
var widget = new libui.${name}();
win.setChild(widget);
win.onClosing(function () {
win.close();
libui.stopLoop();
});
win.show();
libui.startLoop();
`;
const template = `
# ${name.slice(2)}
> ${description}
${image}
${bs}
${code}
${be}
---
# Constructor
> new libui.${name}()
Create a new ${name} object.
---
# Properties
See [properties implementation](properties.md) for generic details on how properties are implemented.
${contents.filter(c => c.type === 'property').map(c => c.content).join('\n')}
---
# Methods
${contents.filter(c => c.type === 'method').map(c => c.content).join('\n')}
${contents.filter(c => c.type === 'property').map(c => c.methods).join('\n')}
${contents.filter(c => c.type === 'event').length === 0 ? '' : `---
# Events
See [events implementation](events.md) for generic details on how events are implemented.
${contents.filter(c => c.type === 'event').map(c => c.content).join('\n')}
`}
`;
writeFileSync(path, template);
// ? writeFileSync(resolve(__dirname, 'show' + name + '.js'), code.replace(`require('libui')`, `require('../index')`));
// ? require('./show' + name + '.js');
}
function property(name, type, description, addSetter) {
addSetter = addSetter === undefined ? true : addSetter;
const getterName = 'get' + name[0].toUpperCase() + name.slice(1);
const setterName = 'set' + name[0].toUpperCase() + name.slice(1);
return {
type: 'property',
methods: `
${addSetter ? `## ${setterName}
Set the value of property ${t}${name}${t}
**Arguments**
* value: ${type} - The new value for ${t}${name}${t} property.
`
: ''}
## ${getterName}
Return the value of property ${t}${name}${t}
`,
content: `
### ${name}: ${type}
${description}
`
};
}
function event(name, property, description) {
return {
type: 'event',
content: `
### ${name}
${description || `
Emitted whenever property ${t}${property}${t} change.
`}
`
};
}
function method(name, description, args) {
return {
type: 'method',
content: `
## ${name}
${description}
${args ? `
**Arguments**
* ${args.join('\n* ')}
`
: ''}
`
};
}
readme += '## Containers widgets\n';
readme += '* [UiWindow](window.md) - explains how to create and manage OS windows.';
writeFile(
'UiForm',
'A container that organize children as labeled fields.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'padded',
'Boolean',
'If true, the container insert some space between children. \nDefaults to false.'),
method(
'append',
'Append a new child widget as last field with specified label.',
[
'label: String - the text to use as label of the field.',
'control: UiControl - the control to append.',
'stretchy: Boolean - whether the child should expand to use all available size.'
]),
method(
'deleteAt',
'Remove a child widget and albel at specified position.',
['index: Number - the index of the control to remove.']),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiGrid',
'A powerful container that allow to specify size and position of each children.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'padded',
'Boolean',
'If true, the container insert some space between children. \nDefaults to false.'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiVerticalBox',
'A container that stack its chidren vertically.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'padded',
'Boolean',
'If true, the container insert some space between children. \nDefaults to false.'),
method('append', 'Append a new child widget as last one.', [
'control: UiControl - the control to append.',
'stretchy: Boolean - whether the child should expand to use all available size.'
]),
method('deleteAt', 'Remove a child widget at specified position.', [
'index: Number - the index of the control to remove.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiTab',
'A container that show each chidren in a separate tab.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('append', 'Append a new child widget as last tab.', [
'label: String - the text to show in the new tab caption.',
'control: UiControl - the control to append.'
]),
method('insertAt', 'Insert a new child widget before specified position.', [
'label: String - the text to show in the new tab caption.',
'before: Number - the control will be inserted before this position',
'control: UiControl - the control to insert.'
]),
method('deleteAt', 'Remove the tab and widget at specified position.', [
'index: Number - the index of the tab to remove.'
]),
method('setMargined', 'Specifies that a tab should use a margin around its content.', [
'page: Number - the index of the tab.',
'margined: Boolean - whether to display a margin or not.'
]),
method('getMargined', 'Return a boolean that indicate if a tab is displaying a margin around its content.', ['page: Number - the index of the tab.']), method('numPages', 'Return the total number of tab pages contained in the widgets.'), method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiHorizontalBox',
'A container that stack its chidren horizontally.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'padded',
'Boolean',
'If true, the container insert some space between children. \nDefaults to false.'),
method('append', 'Append a new child widget as last one.', [
'control: UiControl - the control to append.',
'stretchy: Boolean - whether the child should expand to use all available size.'
]),
method('deleteAt', 'Remove a child widget at specified position.', [
'index: Number - the index of the control to remove.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiGroup',
`A container for a single widget that provide a caption and visually group it's children.`,
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'margined',
'Boolean',
'This property specify if the group content area should have a margin or not.\nDefaults to false.'),
property(
'title',
'String',
'This property specify the caption of the group.\nDefaults to empty string.'),
method('setChild', 'Set the child widget of the group.', [
'control: UiControl - the control to append.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
readme += '\n## Data entry widgets\n';
writeFile(
'UiEntry',
'A simple, single line text entry widget.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'readOnly',
'Boolean',
'Whether the user is allowed to change the entry text. \nRead write.\nDefaults to `true`.'),
property('text', 'String', 'The current text of the entry.\nRead write.'),
event('onChanged', 'text'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiPasswordEntry',
'A single line text entry widget that mask the input, useful to edit passwords or other sensible data.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'readOnly',
'Boolean',
'Whether the user is allowed to change the entry text. \nRead write.\nDefaults to `true`.'),
property('text', 'String', 'The current text of the entry.\nRead write.'),
event('onChanged', 'text'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiSearchEntry',
'A single line text entry widget to search text.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'readOnly',
'Boolean',
'Whether the user is allowed to change the entry text. \nRead write.\nDefaults to `true`.'),
property('text', 'String', 'The current text of the entry.\nRead write.'),
event('onChanged', 'text'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiMultilineEntry',
'A multiline text entry widget.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'readOnly',
'Boolean',
'Whether the user is allowed to change the entry text. \nRead write.\nDefaults to `true`.'),
property(
'text',
'String',
'The current text of the multiline entry.\nRead write.'),
event('onChanged', 'text'),
method('append', 'Append specified text to the entry content.', [
'text: String - the text to append.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiDatePicker',
'A widgets to edit dates.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiTimePicker',
'A widgets to edit times.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiDateTimePicker',
'A widgets to edit date/times.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiCheckbox',
'A checkbox widget.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'checked',
'Boolean',
'Whether the checkbox is checked or unchecked.\nRead write.\nDefaults to false'),
property('text', 'String', 'The static text of the button.\nRead write.'),
event('onToggled', 'checked'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiSpinbox',
'An entry widget for numerical values.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'value',
'Number',
'The current numeric value of the spinbox.\nRead write.'),
event('onChanged', 'value'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiSlider',
'Horizontal slide to set numerical values.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'value',
'Number',
'The current numeric value of the slider.\nRead write.'),
event('onChanged', 'value'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiCombobox',
'A drop down combo box that allow list selection only.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'selected',
'Number',
'Return or set the current selected item by index.'),
event('onSelected', 'selected'),
method('append', 'Append a new text item to the drop down list.', [
'text: String - the text item to append.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiRadioButtons',
'A widget that represent a group of radio options.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'selected',
'Number',
'Return or set the current choosed option by index.'),
event('onSelected', 'selected'),
method(
'append',
'Append a new radio option as last one with specified text.',
['text: String - the text to show as radio widget label.']),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiEditableCombobox',
'A drop down combo box that allow selection from list or free text entry.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'text',
'String',
'Return or set the current selected text or the text value of the selected item in the list.'),
event('onChanged', 'text'),
method('append', 'Append a new text item to the drop down list.', [
'text: String - the text item to append.'
]),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
readme += '\n\n## Static widgets\n';
writeFile(
'UiLabel',
'A static text label.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property('text', 'String', 'The static text of the label.\nRead write.'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiVerticalSeparator',
'A vertical line to visually separate widgets.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiHorizontalSeparator',
'An horizontal line to visually separate widgets.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiProgressBar',
'Progress bar widget.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property(
'value',
'Number',
'The current position of the progress bar. Could be setted to -1 to create an indeterminate progress bar.\nRead write.'),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
readme += '\n\n## Buttons\n';
writeFile(
'UiButton',
'A simple button.',
property(
'visible',
'Boolean',
'Whether the widget should be visible or hidden. \nRead write.\nDefaults to `true`.'),
property(
'enabled',
'Boolean',
'Whether the widget should be enabled or disabled. \nRead write.\nDefaults to `true`.'),
property('text', 'String', 'The static text of the button.\nRead write.'),
method('destroy', 'Destroy and free the control.'), method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'), event('onClicked', null, 'Emitted when the button is clicked'));
writeFile(
'UiColorButton',
'A button that opens a color palette popup.',
property('color', 'Color', 'Return or set the currently selected color'),
event('onChanged', 'color'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFile(
'UiFontButton',
'A button that opens a font chooser.',
property('font', 'FontDescriptor', 'Return or set the currently selected font (see [FontDescriptor](attributedstring.md#fontdescriptor)', false),
event('onChanged', 'font'),
method('destroy', 'Destroy and free the control.'),
method('setParent', 'Change the parent of the control', [
'parent: UiControl - the new parent of the widget or null to detach it.'
]),
method('toplevel', 'Return whether the control is a top level one or not.'));
writeFileSync(readmePath, readme + '\n');