-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlibui-napi.d.ts
1247 lines (1074 loc) · 28.5 KB
/
libui-napi.d.ts
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
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare enum textWeight {
minimum,
thin,
ultraLight,
light,
book,
normal,
medium,
semiBold,
bold,
ultraBold,
heavy,
ultraHeavy,
maximum
}
declare enum textItalic { normal, oblique, italic }
declare enum textStretch {
ultraCondensed,
extraCondensed,
condensed,
semiCondensed,
normal,
semiExpanded,
expanded,
extraExpanded,
ultraExpanded
}
declare enum textAttributeType {
family,
size,
weight,
italic,
stretch,
color,
background,
underline,
underlineColor,
features
}
declare enum textUnderline { none, single, double, suggestion }
declare enum textUnderlineColor { custom, spelling, grammar, auxiliary }
/**
* An object that contains information on a system font.
*/
export class FontDescriptor {
/**
* Create a new FontDescriptor object.
* @param family - the name of the font, e.g. "Helvetica". `object` type is for
* internal use
* @param size - size in point of the font
* @param weight - weight of the font
* @param italic - 1 if the font is italic, otherwise 0
* @param stretch - horizontal stretch value for the font
*/
constructor(family: string|object, size: number, weight: number, italic: number,
stretch: number);
/**
* Return the name of the font, e.g. "Helvetica".
*/
readonly family: string;
/**
* Return the size in point of the font.
*/
readonly size: number;
/**
* Return weight of the font.
*/
readonly weight: textWeight;
/**
* Return `1` if the font is italic, otherwise `0`.
*/
readonly italic: textItalic;
/**
* Return horizontal stretch value for the font.
*/
readonly stretch: number;
}
/**
* Stop Libui event loop
*/
export function stopLoop(): void;
/**
* Start Libui event loop
*/
export function startLoop(): void;
export function startTimer(): void;
export function onShouldQuit(cb: () => void): void;
export class FontAttribute {
constructor(other: FontAttribute);
static newFamily(v: string): FontAttribute;
static newSize(v: number): FontAttribute;
static newWeight(v: textWeight): FontAttribute;
static newItalic(v: textItalic): FontAttribute;
static newStretch(v: textStretch): FontAttribute;
static newColor(c: Color): FontAttribute;
static newBackgroundColor(c: Color): FontAttribute;
static newUnderline(v: textUnderline): FontAttribute;
static newUnderlineColor(type: textUnderlineColor, color?: Color): FontAttribute;
static newOTFeatures(otf: OpenTypeFeatures): FontAttribute;
static getFamily(): string|null;
static getSize(): number|null;
static getWeight(): textWeight|null;
static getItalic(): textItalic|null;
static getStretch(): textStretch|null;
static getColor(): Color|null;
static getUnderline(): textUnderline|null;
static getUnderlineColor(): {type: textAttributeType; color: Color | null;}|null;
static getOTFeatures(): OpenTypeFeatures|null;
static readonly weight = textWeight;
static readonly italic = textItalic;
static readonly stretch = textStretch;
static readonly underline = textUnderline;
static readonly underlineColor = textUnderlineColor;
}
export class OpenTypeFeatures {
add(tag: string, value: number): void;
remove(tag: string): void;
get(tag: string): number;
forEach(cb: (feat: OpenTypeFeatures, str: string, val: number) => boolean): void;
clone(): OpenTypeFeatures;
}
export class Color {
r: number;
g: number;
b: number;
a: number;
constructor(r: number, g: number, b: number, a: number);
constructor(other: Color);
}
export class Point {
x: number;
y: number;
constructor(x: number, y: number);
constructor(other: Point);
}
export class Size {
w: number;
h: number;
constructor(w: number, h: number);
}
export class BrushGradientStop {
pos: number;
color: Color;
constructor(pos: number, color: Color);
}
export class AttributedString {
constructor(str: string);
toString(): string;
toStringLen(): number;
appendAttributed(str: string, ...attribute: FontAttribute[]): void;
appendUnattributed(str: string): void;
insertAttributed(str: string, start: number, ...attribute: FontAttribute[]): void;
insertUnattributed(str: string, at: number): void;
deleteString(start: number, end: number): void;
setAttribute(attr: FontAttribute, start: number, end: number): void;
forEach(cb: (str: AttributedString, attr: FontAttribute, start: number,
end: number) => boolean): void;
numGraphemes(): number;
byteIndexToGrapheme(pos: number): number;
graphemeToByteIndex(pos: number): number;
}
/**
* The UiWindow class is responsible for showing and managing native windows.
* A UiWindow instance can contain only one child. If you need
* more than one, you have to use [Containers](containers.md).
*/
export class UiWindow {
/**
* Create a new UiWindow object.
*
* @param title - text to show in window title bar.
* @param width - width of window in pixels.
* @param height - height of window in pixels.
* @param hasMenubar - whether this window has a menu bar.
* See [Menu](#menubar).
*/
constructor(title: string, width: number, height: number, hasMenubar: boolean);
/**
* Show the window.
* LibUi always returns null
*/
show(): void;
/**
* Add a listener to the `closing` event. This event is emitted when the OS
* window close button is clicked. You are responsible for closing the
* window in response to this event.
*
* @param callback - callback to execute when the event is fired.
*/
onClosing(callback: () => any): void;
/**
* Add a listener to the `contentSizeChanged` event. This event is emitted
* when window content size change.
*
* @param callback - callback to execute when the event is fired.
*/
onContentSizeChanged(callback: Function): void;
/**
* Close the window.
*/
close(): void;
/**
* Set or return the text to show in window title bar.
*/
title: string;
/**
* Set or return the size in pixel of the content area of the window
* (excluding the size of the window decoration). This mean that if you set window
* size to 0,0 you still see title bar and OS window buttons.
*/
contentSize: {width: number; height: number};
/**
* Set the control to show in this window content area.
* UiWindow instances can contain only one child. If you need
* more, you have to use [Containers](containers.md).
*
* @param control - the control to add as child.
* @param stretchy - whever the control should fill all the available space.
*/
setChild(control: UiControl): void;
/**
* When true, an internal margin is added to the window.
*/
margined: boolean;
/**
* When true, the window is displayed without a border.
*/
borderless: boolean;
/**
* When true, the window is displayed in full screen mode.
*/
fullscreen: boolean;
}
/**
* Base class of all controls except UiWindow
*/
export abstract class UiControl {
/**
* Set or return whether the control is enabled.
*/
enabled: boolean;
/**
* Set or return whether the control is visible.
*/
visible: boolean;
/**
* Set or return whether the control is a top level one.
*/
toplevel: boolean;
/**
* Create a new UiControl object.
*/
constructor(handle: any);
}
/**
* An area to draw on.
*/
export class UiArea extends UiControl {
/**
* Create a new scrolling UiArea object.
* @param draw - callback to draw onto area
* @param mouse - callback for mouse events
* @param mouseCrossed - callback for entering or leaving the area
* @param dragBroken - callback
* @param keyEvent - callback for key events
*/
constructor(
// TODO params
draw: (uiArea: UiArea, p: any) => any,
mouse: (uiArea: UiArea, evt: UiAreaMouseEvent) => any,
mouseCrossed: (uiArea: UiArea, evt: UiAreaMouseEvent) => any,
dragBroken: (uiArea: UiArea) => any,
key: (uiArea: UiArea, evt: UiAreaKeyEvent) => any);
/**
* Create a new UiArea object.
* @param draw - callback to draw onto area
* @param mouse - callback for mouse events
* @param mouseCrossed - callback for entering or leaving the area
* @param dragBroken - callback
* @param keyEvent - callback for key events
* @param width Width of this UiArea
* @param height height of this UiArea
*/
constructor(
// TODO params
draw: (uiArea: UiArea, p: any) => any,
mouse: (uiArea: UiArea, evt: UiAreaMouseEvent) => any,
mouseCrossed: (uiArea: UiArea, evt: UiAreaMouseEvent) => any,
dragBroken: (uiArea: UiArea) => any,
key: (uiArea: UiArea, evt: UiAreaKeyEvent) => any, width: number, height: number);
/**
* Force a redraw of the area (calls draw callback).
*/
queueRedrawAll(): void;
/**
* Let the mouse move the window (only callable in the draw callback)
*/
beginWindowMove(): void;
/**
* Let the mouse resize the window (only callable in the draw callback)
* @param edge - the size which is held by the mouse
*/
beginWindowResize(edge: number): void;
setSize(w: number, h: number): void;
scrollTo(x: number, y: number, w: number, h: number): void;
}
export class UiAreaMouseEvent {
constructor(x: number, y: number, areaWidth: number, areaHeight: number,
down: boolean, up: boolean, count: number, modifiers: any,
held1To64: any);
readonly x: number;
readonly y: number;
readonly areaWidth: number;
readonly areaHeight: number;
readonly down: number;
readonly up: number;
readonly count: number;
readonly modifiers: number;
readonly held1To64: number;
}
declare enum modifierKeys { ctrl, alt, shift, super }
declare enum extKeys {
escape,
insert, // equivalent to "Help" on Apple keyboards
delete,
home,
end,
pageUp,
pageDown,
up,
down,
left,
right,
f1, // F1..F12 are guaranteed to be consecutive
f2,
f3,
f4,
f5,
f6,
f7,
f8,
f9,
f10,
f11,
f12,
n0, // numpad keys; independent of Num Lock state
n1, // N0..N9 are guaranteed to be consecutive
n2,
n3,
n4,
n5,
n6,
n7,
n8,
n9,
nDot,
nEnter,
nAdd,
nSubtract,
nMultiply,
nDivide
}
export class UiAreaKeyEvent {
constructor(key: number, extKey: number, modifier: string, modifiers: any,
up: boolean);
key: string;
extKey: extKeys;
modifier: modifierKeys;
modifiers: number;
up: number;
static readonly modifierKeys = modifierKeys;
static readonly extKeys = extKeys;
}
export const UiDialogs: {
openFile(parent: UiWindow): string|null; saveFile(parent: UiWindow): string | null;
msgBox(parent: UiWindow, title: string, description: string): void;
msgBoxError(parent: UiWindow, title: string, description: string): void;
};
declare enum brushType { solid, linearGradient, radialGradient }
declare enum lineCap { flat, round, square }
declare enum lineJoin { miter, round, bevel }
/**
* A draw brush
*/
export class DrawBrush {
constructor();
color: Color;
type: brushType;
/**
* The gradient stops
*/
stops: BrushGradientStop[];
/**
* Set the start position of the gradient
* (Radial gradients: the inner circle's center)
* @param pos - the coordinates
*/
start: Point;
/**
* The end position of the gradient
* (Radial gradients: the outer circle's center)
*/
end: Point;
/**
* The radius of the gradient's outer circle (radial gradients only)
*/
outerRadius: number;
}
declare enum fillMode { winding, alternate }
export class UiDrawPath {
constructor(mode?: fillMode);
addRectangle(x: number, y: number, width: number, height: number): void;
newFigure(x: number, y: number): void;
newFigureWithArc(xCenter: number, yCenter: number, radius: number, startAngle: number,
sweep: number, negative: number): void;
lineTo(x: number, y: number): void;
arcTo(xCenter: number, yCenter: number, radius: number, startAngle: number,
sweep: number, negative: boolean): void;
bezierTo(c1x: number, c1y: number, c2x: number, c2y: number, endX: number,
endY: number): void;
closeFigure(): void;
end(): void;
}
export class DrawStrokeParams {
static readonly lineCap = lineCap;
static readonly lineJoin = lineJoin;
thickness: number;
cap: lineCap;
join: lineJoin;
miterLimit: number;
dashes: number[];
dashPhase: number;
}
export class UiDrawMatrix {
constructor();
setIdentity(): void;
scale(xCenter: number, yCenter: number, x: number, y: number): void;
translate(x: number, y: number): void;
rotate(x: number, y: number, amount: number): void;
skew(x: number, y: number, xAmount: number, yAmount: number): void;
multiply(m: number): void;
invertible(m: number): void;
/**
* returns true it it worked
*/
invert(m: number): boolean;
set(i: number, j: number, v: number): void;
get(i: number, j: number): number;
readonly 0: [number];
readonly 1: [number];
readonly 2: [number];
}
declare enum textAlign { left, center, right }
export class DrawTextLayout {
constructor(str: AttributedString, font: FontDescriptor, width: number,
align: textAlign);
readonly extents: Size;
}
/**
* A static text label.
*/
export class UiLabel extends UiControl {
constructor(label?: string);
text: any;
}
/**
* A container that organizes children as labeled fields.
*/
export class UiForm extends UiControl {
/**
* Create a new UiForm object.
*/
constructor();
/**
* If true, the container inserts some space between children.
*/
padded: boolean;
/**
* Append a new child control as the last field with the specified label.
* @param label - the text to use as label of the field.
* @param control - the control to add as child.
* @param stretchy - whether the control should fill all the available space.
*/
append(label: string, control: UiControl, stretchy?: boolean): void;
/**
* Remove a child control at the specified position.
* @param index - the index of the control to remove
*/
deleteAt(index: number): void;
}
/**
* A base class for text related entries.
*/
export abstract class UiEntryBase extends UiControl {
/**
* Set or return the the content of the entry.
*/
text: string;
/**
* Whether the user is allowed to change the entry's contents.
*/
readOnly: boolean;
/**
* Add a listener to the `changed` event. Emitted whenever the entry contents
* changed.
* @param callback - callback to execute when the event is fired.
*/
onChanged(callback: () => any): void;
}
/**
* A simple, single line text entry control.
*/
export class UiEntry extends UiEntryBase {
constructor();
}
/**
* A multiline text entry.
*/
export class UiMultilineEntry extends UiControl {
/**
* Create a new UiMultilineEntry object.
* @param wrapping - whether the multiline entry wrap text. Defaults to false.
*/
constructor(wrapping?: boolean);
/**
* Set or return the the content of the multiline entry.
*/
text: string;
/**
* Whether the user is allowed to change the entry's contents.
*/
readOnly: boolean;
/**
* Append the specified text to the entry's contents.
* @param text - the text to append.
*/
append(text: string): void;
/**
* Add a listener to the `changed` event. Emitted whenever the entry's contents
* changed.
*
* @param callback - callback to execute when the event is fired.
*/
onChanged(callback: () => any): void;
}
/**
* A single line text entry control that hides the input, useful for passwords
* and other sensible data.
*/
export class UiPasswordEntry extends UiEntryBase {
/**
* Create a new UiPasswordEntry object.
*/
constructor();
}
/**
* A single line text entry control to search text.
*/
export class UiSearchEntry extends UiEntryBase {
/**
* Create a new UiSearchEntry object.
*/
constructor();
}
/**
* Base class for vertical and horizontal boxes
*/
export abstract class UiBox extends UiControl {
/**
* If true, the container inserts some space between children.
*/
padded: boolean;
/**
* Append a new child control as the last child.
* @param control - the control to add as a child.
* @param stretchy - whever the control should fill all the available space.
*/
append(control: UiControl, stretchy?: boolean): void;
/**
* Remove a child control at specified position.
* @param index - the index of the control to remove
*/
deleteAt(index: number): void;
}
/**
* A container that stacks its chidren horizontally.
*/
export class UiHorizontalBox extends UiBox {
constructor();
}
/**
* A container that stacks its children vertically.
*/
export class UiVerticalBox extends UiBox {
constructor();
}
/**
* A container for a single control that provides a caption and visually groups
* it's child.
*/
export class UiGroup extends UiControl {
/**
* Create a new UiGroup object.
*
* @param title - text to show in Group title bar. Default is `''`
*/
constructor(title?: string);
/**
* Set or return the text to show in group caption.
*/
title: string;
/**
* Set the control to show in this group content area.
* UiGroup instances can contain only one control. If you need
* more, you have to use [Containers](containers.md).
*
* @param control - the control to add as child.
*/
setChild(control: UiControl): void;
/**
* When true, an internal margin is added to the group.
*/
margined: boolean;
}
declare enum GridAlign { fill, start, center, end }
declare enum GridAt { leading, top, trailing, bottom }
/**
* A powerful container that allow to specify size and position of each children.
*/
export class UiGrid extends UiControl {
/**
* Create a new UiGrid object.
*/
constructor();
/**
* Enum defining the alignment of a control
*/
static readonly align = GridAlign;
/**
* Enum defining the position where to insert a control into a grid
*/
static readonly at = GridAt;
/**
* If true, the container inserts some space between children.
*/
padded: boolean;
/**
* Insert a new child control before specified control.
* @param child - the control to insert
* @param before - the control will be inserted before this position
* @param at [description]
* @param xspan - How many columns the component takes off.
* @param yspan - How many rows the component takes off.
* @param hexpand - whether the component can expand horizontally.
* @param halign - whether the component is aligned with the other components in the
* column.
* @param vexpand - whether the component can expand vertically.
* @param valign - whether the component is aligned with the other components in the
* row.
*/
insertAt(child: UiControl, before: UiControl, at: GridAt, xspan: number,
yspan: number, hexpand: number, halign: GridAlign, vexpan,
valign: GridAlign): void;
/**
* Insert a new child control.
*
* > UIGrid expand does not work correctly when both align horizontal and align
* vertical are set. You must choose one so libui knows which direction to expand.
*
* @param child - the control to add as child.
* @param left - What column the component resides in.
* @param top - What row the component resides in.
* @param xspan - How many columns the component takes off.
* @param yspan - How many rows the component takes off.
* @param hexpand - whether the component can expand horizontally.
* @param halign - whether the component is aligned with the other components in the
* column.
* @param vexpand - whether the component can expand vertically.
* @param valign - whether the component is aligned with the other components in the
* row.
*/
append(child: UiControl, left: number, top: number, xspan: number, yspan: number,
hexpand: number, halign: GridAlign, vexpand: number, valign: GridAlign): void;
}
/**
* A container that show each chidren in a separate tab.
*/
export class UiTab extends UiControl {
constructor();
/**
* Return whether an internal margin is added to a page of the tab.
* @param index - the index of the page to check.
* @return `true` - whether the page has margins
*/
getMargined(index: number): boolean;
/**
* Add an internal margin to a page of the Tab.
* @param index - the index of the page to set the margin on.
* @param value - whether to enable or disable the margin.
*/
setMargined(index: number, value: boolean): void;
/**
* Append a new child control as last tab page.
* @param label - the text to show for the new page caption.
* @param control - the control to add as a child.
*/
append(label: string, control: UiControl): void;
/**
* Insert a new child control before specified position.
* @param label - the text to show for the new page caption.
* @param before - the control will be inserted before this position
* @param control - the control to insert
*/
insertAt(label: string, before: number, control: UiControl): void;
/**
* Return the total number of tab pages contained in the control.
*/
numPages(): number;
/**
* Remove the tab and control at specified position.
* @param index - the index of the tab to remove.
*/
deleteAt(index: number): void;
}
/**
* A simple button.
*/
export class UiButton extends UiControl {
/**
* Create a new UiButton object.
*/
constructor(label?: string);
/**
* Set or return the text of the button.
*/
text: string;
/**
* Emitted when the button is clicked
*
* @param callback - callback to execute when the event is fired.
*/
onClicked(callback: () => any): void;
}
/**
* A control that represents a group of single-choise options.
*/
export class UiRadioButtons extends UiControl {
/**
* Number of items in this radio buttons set
*/
itemsCount: number;
/**
* Create a new UiRadioButtons object.
*/
constructor();
/**
* Return or set the currently selected item by index.
*/
selected: string;
/**
* Append a new radio option as the last item with the specified text.
* @param text - the text to append.
*/
append(text: string): void;
/**
* Add a listener to the `selected` event. Emitted whenever the selected option
* changes.
*
* @param callback - callback to execute when the event is fired.
*/
onSelected(callback: () => void): void;
}
/**
* A button that opens a color palette popup.
*/
export class UiColorButton extends UiControl {
/**
* Create a new UiColorButton object.
*/
constructor();
/**
* Set or return the ColorButton color value.
*/
color: Color;
/**
* Add a listener to the `changed` event. Emitted whenever the user
* changed the selected color.
*
* @param callback - callback to execute when the event is fired.
*/
onChanged(callback: () => void): void;
}
/**
* A button that opens a popup to choose a font.
*/
export class UiFontButton extends UiControl {
/**
* Create a new UiFontButton object.
*/
constructor();
/**
* Return the FontButton font value.
*/
readonly font: FontDescriptor;
/**
* Add a listener to the `changed` event. Emitted whenever the user changed the
* selected font.
*
* @param {Function} callback - callback to execute when the event is fired.
*/
onChanged(callback: () => void): void;
}
/**
* Horizontal slider to set numerical values.
*/
export class UiSlider extends UiControl {
/**
* Create a new UiSlider object.
* @param min - minimum value of the slider. default to `0`
* @param max - maximum value of the slider. default to `100`
*/
constructor(min?: number, max?: number);
/**
* Set or return the the content of the slider.
*/
value: number;
/**
* Add a listener to the `changed` event. Emitted whenever the slider value changed.
*
* @param callback - callback to execute when the event is fired.
*/
onChanged(callback: () => void): void;
}
/**
* An entry control for numerical values.
*/
export class UiSpinbox extends UiControl {
/**
* Create a new UiSpinbox object.
* @param min - minimum value of the spinbox. defaults to `0`
* @param max - maximum value of the spinbox. defaults to `100`
*/
constructor(min?: number, max?: number);
/**
* Set or return the the content of spinbox.
*/
value: number;
/**
* Add a listener to the `changed` event. Emitted whenever the spinbox value changed.
*
* @param callback - callback to execute when the event is fired.
*/
onChanged(callback: () => void): void;
}
/**
* A checkbox control.
*/
export class UiCheckbox extends UiControl {
/**