i-slint-compiler 1.12.1

Internal Slint Compiler Library
Documentation
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
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

// cSpell: ignore langtype typeregister

/**
   This file contains the definition off all builtin items
   It is parsed with the normal .slint parser, but the semantic.

   `_` means that that this is a langtype::NativeClass with no parent.
   Exported components are added to the as BuiltinElement.

   comments starting by `//-` have some meanings

   Properties with two way bindings (aliases) are deprecated in favor of the property they point to

   Properties can have default binding which must be an expression without any reference to
   another properties. These binding will be then set by the compiler.
   `output` property mean that the property can be modified by the native Item,
   otherwise it is assumed the native item don't write to that property.
 */

component Empty {
    //-is_internal
}

component Rectangle inherits Empty {
    in property <brush> background;
    in property <brush> color <=> background;
}

component BasicBorderRectangle inherits Rectangle {
    in property <length> border-width;
    in property <length> border-radius;
    in property <brush> border-color;
}

component BorderRectangle inherits BasicBorderRectangle {
    in property <length> border-top-left-radius;
    in property <length> border-top-right-radius;
    in property <length> border-bottom-left-radius;
    in property <length> border-bottom-right-radius;
    //-default_size_binding:expands_to_parent_geometry
}

export { BorderRectangle as Rectangle }

component ImageItem inherits Empty {
    in property <length> width;
    in property <length> height;
    in property <image> source;
    in property <ImageFit> image-fit;
    in property <ImageRendering> image-rendering;
    in property <brush> colorize;
}

export component ClippedImage inherits ImageItem {
    in property <int> source-clip-x;
    in property <int> source-clip-y;
    in property <int> source-clip-width;
    in property <int> source-clip-height;
    //-default_size_binding:implicit_size

    in property <ImageHorizontalAlignment> horizontal-alignment;
    in property <ImageVerticalAlignment> vertical-alignment;
    in property <ImageTiling> horizontal-tiling;
    in property <ImageTiling> vertical-tiling;
    // TODO: sets both horizontal-tiling and vertical-tiling at the same time.
    // in property <ImageTiling> tiling;

}

export { ClippedImage as Image }

export component ComponentContainer inherits Empty {
    in property <component-factory> component-factory;
    out property <bool> has-component;

    in-out property <length> width;
    in-out property <length> height;
    //-accepts_focus
}

export component Rotate inherits Empty {
    in property <angle> rotation-angle;
    in property <length> rotation-origin-x;
    in property <length> rotation-origin-y;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

component SimpleText inherits Empty {
    in property <length> width;
    in property <length> height;
    in property <string> text;
    in property <length> font-size;
    in property <int> font-weight;
    in property <brush> color;  // StyleMetrics.default-text-color  set in apply_default_properties_from_style
    in property <TextHorizontalAlignment> horizontal-alignment;
    in property <TextVerticalAlignment> vertical-alignment;
    //-default_size_binding:implicit_size
}

component ComplexText inherits SimpleText {
    in property <string> font-family;
    in property <bool> font-italic;
    in property <TextOverflow> overflow;
    in property <TextWrap> wrap;
    in property <length> letter-spacing;
    in property <brush> stroke;
    in property <length> stroke-width;
    in property <TextStrokeStyle> stroke-style;
    //-default_size_binding:implicit_size
}

export { ComplexText as Text }

export component TouchArea {
    in property <bool> enabled: true;
    out property <bool> pressed;
    out property <bool> has_hover;
    out property <length> mouse_x;
    out property <length> mouse_y;
    out property <length> pressed_x;
    out property <length> pressed_y;
    in property <MouseCursor> mouse-cursor;
    callback clicked;
    callback double-clicked;
    callback moved;
    callback pointer-event(event: PointerEvent);
    callback scroll-event(event: PointerScrollEvent) -> EventResult;
    //-default_size_binding:expands_to_parent_geometry
}

export component FocusScope {
    in property <bool> enabled: true;
    out property <bool> has-focus;
    callback key_pressed(event: KeyEvent) -> EventResult;
    callback key_released(event: KeyEvent) -> EventResult;
    callback focus_changed_event(reason: FocusReason);
    callback focus_gained(reason: FocusReason);
    callback focus_lost(reason: FocusReason);
    //-default_size_binding:expands_to_parent_geometry
    //-accepts_focus
}

export component Flickable inherits Empty {
    in property <length> viewport-height;
    in property <length> viewport-width;
    in-out property <length> viewport-x;
    in-out property <length> viewport-y;
    in property <bool> interactive: true;
    callback flicked();
    //-default_size_binding:expands_to_parent_geometry
}

export component SwipeGestureHandler {
    in property <bool> enabled: true;
    in property <bool> handle-swipe-left;
    in property <bool> handle-swipe-right;
    in property <bool> handle-swipe-up;
    in property <bool> handle-swipe-down;

    // For the future
    //in property <length> swipe-distance-threshold: 8px;
    //in property <duration> swipe-duration-threshold: 500ms;
    // in property <bool> delays-propgataion;
    //in property <duration> propgataion-delay: 100ms;
    // in property <int> required-touch-points: 1;
    //callback swipe-recognized();

    out property <Point> pressed-position;
    out property <Point> current-position;
    out property <bool> swiping;

    callback moved();
    // the cursor is released and so the swipe is finished
    callback swiped();
    // the cursor is released and so the swipe is finished
    callback cancelled();

    // clears state, invokes swipe-cancelled()
    function cancel() {
    }

    //-default_size_binding:expands_to_parent_geometry
}

component MenuItem {
    in property <string> title;
    callback activated();
    in property <bool> enabled: true;
    //-disallow_global_types_as_child_elements
    //-is_non_item_type
}

component MenuSeparator {
    //-disallow_global_types_as_child_elements
    //-is_non_item_type
}

component Menu {
    in property <string> title;
    in property <bool> enabled: true;
    MenuItem {}
    MenuSeparator {}
    Menu {}
    //-disallow_global_types_as_child_elements
    //-is_non_item_type
}

// Lowered in lower_menus pass. See that pass documentation for more info
component MenuBar {
    //-is_non_item_type
    //-disallow_global_types_as_child_elements
    Menu {}
}

// The NativeItem, exported as ContextMenuInternal for the style
component ContextMenu inherits Empty {
    callback activated(entry: MenuEntry);
    callback sub-menu(entry: MenuEntry) -> [MenuEntry];
    callback show(position: Point);
    function close() {
    }
    function is-open() -> bool {
    }
    in property <bool> enabled: true;
}

// Lowered in lower_menus pass.
export component ContextMenuInternal inherits ContextMenu {
    in property <[MenuEntry]> entries;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

// The public ContextMenu which is lowered in the lower_menus pass. See that pass documentation for more info
// Note that this element cannot be named `ContextMenu` because that's the same name as a native item,
// and the load_builtins code doesn't allow that. So use a placeholder name and re-export under `ContextMenu`
export component ContextMenuArea inherits Empty {
    // This is actually function as part of out interface, but a callback as much is the runtime concerned
    callback show(position: Point);
    function close() {
    }
    //-default_size_binding:expands_to_parent_geometry
    Menu { }

    in property <bool> enabled: true;
}

component WindowItem {
    in-out property <length> width;
    in-out property <length> height;
    in property <brush> background; // StyleMetrics.background  set in apply_default_properties_from_style
    in property <brush> color <=> background;
    in property <string> title: "Slint Window";
    in property <bool> no-frame;
    in property <length> resize-border-width;
    in property <bool> always-on-top;
    in-out property <bool> full-screen;
    in property <string> default-font-family;
    in-out property <length> default-font-size; // <=> StyleMetrics.default-font-size  set in apply_default_properties_from_style
    in property <int> default-font-weight;
    in property <image> icon;
}

export component Window inherits WindowItem {
    MenuBar {}
}

export component BoxShadow inherits Empty {
    in property <length> border_radius;
    in property <length> offset_x;
    in property <length> offset_y;
    in property <color> color;
    in property <length> blur;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component TextInput {
    in-out property <string> text;
    in property <string> font-family;
    in property <length> font-size;
    in property <bool> font-italic;
    in property <int> font-weight;
    in property <brush> color; // StyleMetrics.default-text-color  set in apply_default_properties_from_style
    in property <color> selection-foreground-color; // StyleMetrics.selection-foreground set in apply_default_properties_from_style
    in property <color> selection-background-color; // StyleMetrics.selection-background set in apply_default_properties_from_style
    in property <TextHorizontalAlignment> horizontal-alignment;
    in property <TextVerticalAlignment> vertical-alignment;
    in property <TextWrap> wrap;
    in property <length> letter-spacing;
    in property <length> width;
    in property <length> height;
    in property <length> page-height;
    in property <length> text-cursor-width; // StyleMetrics.text-cursor-width  set in apply_default_properties_from_style
    in property <InputType> input-type;
    // Internal, undocumented property, only exposed for tests.
    out property <int> cursor-position_byte-offset;
    // Internal, undocumented property, only exposed for tests.
    out property <int> anchor-position-byte-offset;
    out property <bool> has-focus;
    callback accepted;
    callback edited;
    callback cursor_position_changed(position: Point);
    callback key_pressed(event: KeyEvent) -> EventResult;
    callback key_released(event: KeyEvent) -> EventResult;
    in property <bool> enabled: true;
    in property <bool> single-line: true;
    in property <bool> read-only: false;
    // Internal, undocumented property, only exposed for IME.
    out property <string> preedit-text;
    //-default_size_binding:expands_to_parent_geometry
    //-accepts_focus
    function set-selection-offsets(start: int, end: int) {
    }
    function select-all() {
    }
    function clear-selection() {
    }
    function cut() {
    }
    function copy() {
    }
    function paste() {
    }
}

export component Clip {
    in property <length> border-top-left-radius;
    in property <length> border-top-right-radius;
    in property <length> border-bottom-left-radius;
    in property <length> border-bottom-right-radius;
    in property <length> border-width;
    in property <bool> clip;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component Opacity {
    in property <float> opacity: 1;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component Layer inherits Empty {
    in property <bool> cache-rendering-hint;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

component Row {
    //-is_non_item_type
}

// Note: layouts are not NativeClass, but this is lowered in lower_layout
export component GridLayout {
    in property <length> spacing-horizontal;
    in property <length> spacing-vertical;
    in property <length> spacing;

    // Additional accepted child
    Row { }
}

export component VerticalLayout {
    in property <length> spacing;
    in property <LayoutAlignment> alignment;
}

export component HorizontalLayout {
    in property <length> spacing;
    in property <LayoutAlignment> alignment;
}

component MoveTo {
    in property <float> x;
    in property <float> y;

    //-rust_type_constructor:slint::re_exports::PathElement::MoveTo(PathMoveTo{{}})
    //-cpp_type:slint::private_api::PathMoveTo
    //-is_non_item_type
}

component LineTo {
    in property <float> x;
    in property <float> y;

    //-rust_type_constructor:slint::re_exports::PathElement::LineTo(PathLineTo{{}})
    //-cpp_type:slint::private_api::PathLineTo
    //-is_non_item_type
}

component ArcTo {
    in property <float> x;
    in property <float> y;
    in property <float> radius-x;
    in property <float> radius-y;
    in property <float> x-rotation;
    in property <bool> large_arc;
    in property <bool> sweep;

    //-rust_type_constructor:slint::re_exports::PathElement::ArcTo(PathArcTo{{}})
    //-cpp_type:slint::private_api::PathArcTo
    //-is_non_item_type
}

component CubicTo {
    in property <float> control-1-x;
    in property <float> control-1-y;
    in property <float> control-2-x;
    in property <float> control-2-y;
    in property <float> x;
    in property <float> y;

    //-rust_type_constructor:slint::re_exports::PathElement::CubicTo(PathCubicTo{{}})
    //-cpp_type:slint::private_api::PathCubicTo
    //-is_non_item_type
}

component QuadraticTo {
    in property <float> control-x;
    in property <float> control-y;
    in property <float> x;
    in property <float> y;

    //-rust_type_constructor:slint::re_exports::PathElement::QuadraticTo(PathQuadraticTo{{}})
    //-cpp_type:slint::private_api::PathQuadraticTo
    //-is_non_item_type
}

component Close {
    //-rust_type_constructor:slint::re_exports::PathElement::Close
    //-cpp_type:slint::private_api::PathClose
    //-is_non_item_type
}

export component Path {
    in property <brush> fill;
    in property <FillRule> fill-rule;
    in property <brush> stroke;
    in property <length> stroke-width;
    in property <LineCap> stroke-line-cap;
    in property <string> commands;  // 'fake' hardcoded in typeregister.rs
    in property <float> viewbox-x;
    in property <float> viewbox-y;
    in property <float> viewbox-width;
    in property <float> viewbox-height;
    in property <bool> clip;
    in property <bool> anti-alias: true;

    //-disallow_global_types_as_child_elements
    MoveTo { }

    LineTo { }

    ArcTo { }

    CubicTo { }

    QuadraticTo { }

    Close { }

    //-default_size_binding:expands_to_parent_geometry
}

component Tab {
    in property <string> title;
}

// Note: not a native class, handled in the lower_tabs pass
export component TabWidget {
    in-out property <int> current-index;

    //-disallow_global_types_as_child_elements
    Tab { }
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

// Note: not a native class, handled in the lower_popups pass
export component PopupWindow {
    //property <length> x;
    //property <length> y;
    in property <length> width;
    in property <length> height;
    /*property <length> anchor_x;
    in property <length> anchor_y;
    in property <length> anchor_height;
    in property <length> anchor_width;*/
    in property <bool> close-on-click;
    in property <PopupClosePolicy> close-policy; // constexpr hardcoded in typeregister.rs
    //show() is hardcoded in typeregister.rs
}

// Also not a real Item. Actually not an element at all
export component Timer {
    in property <duration> interval;
    callback triggered;
    in property <bool> running: true;
    //-is_non_item_type
    //-disallow_global_types_as_child_elements
}

export component Dialog inherits WindowItem { }

component PropertyAnimation {
    in property <duration> delay;
    in property <duration> duration;
    in property <AnimationDirection> direction;
    in property <easing> easing;
    in property <float> iteration-count: 1.0;
    //-is_non_item_type
}

export global TextInputInterface {
    in property <bool> text-input-focused;
}

export global Platform {
    out property <OperatingSystemType> os;
    out property <string> style-name;
}

export component NativeButton {
    in property <string> text;
    in property <image> icon;
    out property <bool> pressed;
    in property <bool> checkable;
    in-out property <bool> checked;
    out property <bool> has-focus;
    in property <bool> primary;
    in property <bool> colorize-icon;
    callback clicked;
    in property <bool> enabled: true;
    in property <StandardButtonKind> standard-button-kind;
    in property <bool> is-standard-button;
    //-is_internal
    //-accepts_focus
}

export component NativeCheckBox {
    in property <bool> enabled: true;
    in property <string> text;
    in-out property <bool> checked;
    out property <bool> has-focus;
    callback toggled;
    //-is_internal
    //-accepts_focus
}

export component NativeSpinBox {
    in property <bool> enabled: true;
    out property <bool> has-focus;
    in-out property <int> value;
    in property <int> minimum;
    in property <int> maximum: 100;
    in property <int> step-size: 1;
    in property <TextHorizontalAlignment> horizontal-alignment;
    callback edited(value: int);
    //-is_internal
    //-accepts_focus
}

export component NativeSlider {
    in property <bool> enabled: true;
    out property <bool> has-focus;
    in-out property <float> value;
    in property <float> minimum;
    in property <float> maximum: 100;
    in property <float> step: 1;
    in property <Orientation> orientation: Orientation.horizontal;
    callback changed(value: float);
    callback released(value: float);
    //-is_internal
    //-accepts_focus
}

export component NativeProgressIndicator {
    in property <bool> indeterminate;
    in property <float> progress;
    //-is_internal
}

export component NativeGroupBox {
    in property <bool> enabled: true;
    in property <string> title;
    out property <length> native-padding-left;
    out property <length> native-padding-right;
    out property <length> native-padding-top;
    out property <length> native-padding-bottom;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component NativeLineEdit {
    out property <length> native-padding-left;
    out property <length> native-padding-right;
    out property <length> native-padding-top;
    out property <length> native-padding-bottom;
    in property <bool> has-focus;
    in property <bool> enabled: true;
    //-is_internal
}

export component NativeScrollView {
    in property <length> horizontal-max;
    in property <length> horizontal-page-size;
    in property <length> horizontal-value;
    in property <length> vertical-max;
    in property <length> vertical-page-size;
    in-out property <length> vertical-value;
    out property <length> native-padding-left;
    out property <length> native-padding-right;
    out property <length> native-padding-top;
    out property <length> native-padding-bottom;
    in property <bool> has_focus;
    in property <ScrollBarPolicy> vertical-scrollbar-policy;
    in property <ScrollBarPolicy> horizontal-scrollbar-policy;
    in property <bool> enabled: true;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component NativeStandardListViewItem {
    in property <int> index;
    in property <StandardListViewItem> item;
    in-out property <bool> is_selected;
    in property <bool> has_hover;
    in property <bool> has_focus;
    in property <bool> pressed;
    in property <bool> combobox;
    in property <length> pressed-x;
    in property <length> pressed-y;
    //-is_internal
}

export component NativeTableHeaderSection {
    in property <int> index;
    in property <TableColumn> item;
    in property <bool> has_hover;
    //-is_internal
}

export component NativeComboBox {
    in-out property <string> current_value;
    in property <bool> enabled: true;
    in property <bool> has-focus;
    //-is_internal
}

export component NativeComboBoxPopup {
    //-is_internal
}

export component NativeTabWidget {
    in property <length> width;
    in property <length> height;

    out property <length> content-x;
    out property <length> content-y;
    out property <length> content-height;
    out property <length> content-width;
    out property <length> tabbar-x;
    out property <length> tabbar-y;
    out property <length> tabbar-height;
    out property <length> tabbar-width;
    in property <length> tabbar-preferred-height;
    in property <length> tabbar-preferred-width;
    in property <length> content-min-height;
    in property <length> content-min-width;

    in property <int> current-index;
    in property <int> current-focused;
    //-default_size_binding:expands_to_parent_geometry
    //-is_internal
}

export component NativeTab {
    in property <string> title;
    in property <image> icon;
    in property <bool> enabled: true;
    in-out property <int> current; // supposed to be a binding to the tab
    in property <int> tab-index;
    in property <int> current-focused;
    in property <int> num-tabs;
    //-is_internal
}

export global NativeStyleMetrics {
    out property <length> layout-spacing;
    out property <length> layout-padding;
    out property <length> text-cursor-width;
    out property <color> window-background;
    out property <color> default-text-color;
    out property <length> default-font-size;
    out property <color> textedit-background;
    out property <color> textedit-text-color;
    out property <color> textedit-background-disabled;
    out property <color> textedit-text-color-disabled;

    out property <bool> dark-color-scheme;

    // specific to the Native one
    out property <color> placeholder-color;
    out property <color> placeholder-color-disabled;

    // Tab Bar metrics:
    out property <LayoutAlignment> tab-bar-alignment;

    //-is_non_item_type
    //-is_internal
}

export global NativePalette {
    out property <brush> background;
    out property <brush> foreground;
    out property <brush> alternate-background;
    out property <brush> alternate-foreground;
    out property <brush> control-background;
    out property <brush> control-foreground;
    out property <brush> accent-background;
    out property <brush> accent-foreground;
    out property <brush> selection-background;
    out property <brush> selection-foreground;
    out property <brush> border;
    in-out property <ColorScheme> color-scheme;

    //-is_non_item_type
    //-is_internal
}