// Copyright © SixtyFPS GmbH // 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 background; in property color <=> background; } component BasicBorderRectangle inherits Rectangle { in property border-width; in property border-radius; in property border-color; } component BorderRectangle inherits BasicBorderRectangle { in property border-top-left-radius; in property border-top-right-radius; in property border-bottom-left-radius; in property border-bottom-right-radius; //-default_size_binding:expands_to_parent_geometry } export { BorderRectangle as Rectangle } component ImageItem inherits Empty { in property width; in property height; in property source; in property image-fit; in property image-rendering; in property colorize; } export component ClippedImage inherits ImageItem { in property source-clip-x; in property source-clip-y; in property source-clip-width; in property source-clip-height; //-default_size_binding:implicit_size in property horizontal-alignment; in property vertical-alignment; in property horizontal-tiling; in property vertical-tiling; // TODO: sets both horizontal-tiling and vertical-tiling at the same time. // in property tiling; } export { ClippedImage as Image } export component ComponentContainer inherits Empty { in property component-factory; out property has-component; in-out property width; in-out property height; //-accepts_focus } export component Rotate inherits Empty { in property rotation-angle; in property rotation-origin-x; in property rotation-origin-y; //-default_size_binding:expands_to_parent_geometry //-is_internal } component SimpleText inherits Empty { in property width; in property height; in property text; in property font-size; in property font-weight; in property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style in property horizontal-alignment; in property vertical-alignment; //-default_size_binding:implicit_size } component ComplexText inherits SimpleText { in property font-family; in property font-italic; in property overflow; in property wrap; in property letter-spacing; in property stroke; in property stroke-width; in property stroke-style; //-default_size_binding:implicit_size } export { ComplexText as Text } export component TouchArea { in property enabled: true; out property pressed; out property has_hover; out property mouse_x; out property mouse_y; out property pressed_x; out property pressed_y; in property 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 enabled: true; out property 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 viewport-height; in property viewport-width; in-out property viewport-x; in-out property viewport-y; in property interactive: true; callback flicked(); //-default_size_binding:expands_to_parent_geometry } export component SwipeGestureHandler { in property enabled: true; in property handle-swipe-left; in property handle-swipe-right; in property handle-swipe-up; in property handle-swipe-down; // For the future //in property swipe-distance-threshold: 8px; //in property swipe-duration-threshold: 500ms; // in property delays-propgataion; //in property propgataion-delay: 100ms; // in property required-touch-points: 1; //callback swipe-recognized(); out property pressed-position; out property current-position; out property 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 } export component DragArea { in property enabled: true; //out property dragging; in property mime-type; in property data; //-default_size_binding:expands_to_parent_geometry } export component DropArea { in property enabled: true; callback can-drop(event: DropEvent) -> bool; callback dropped(event: DropEvent); out property contains-drag; //-default_size_binding:expands_to_parent_geometry } component MenuItem { in property title; callback activated(); in property enabled: true; in property icon; //-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 title; in property enabled: true; in property icon; 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 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 enabled: true; } component WindowItem { in-out property width; in-out property height; in property background; // StyleMetrics.background set in apply_default_properties_from_style in property color <=> background; in property title: "Slint Window"; in property no-frame; in property resize-border-width; in property always-on-top; in-out property full-screen; in property default-font-family; in-out property default-font-size; // <=> StyleMetrics.default-font-size set in apply_default_properties_from_style in property default-font-weight; in property icon; } export component Window inherits WindowItem { MenuBar {} } export component BoxShadow inherits Empty { in property border_radius; in property offset_x; in property offset_y; in property color; in property blur; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component TextInput { in-out property text; in property font-family; in property font-size; in property font-italic; in property font-weight; in property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style in property selection-foreground-color; // StyleMetrics.selection-foreground set in apply_default_properties_from_style in property selection-background-color; // StyleMetrics.selection-background set in apply_default_properties_from_style in property horizontal-alignment; in property vertical-alignment; in property wrap; in property letter-spacing; in property width; in property height; in property page-height; in property text-cursor-width; // StyleMetrics.text-cursor-width set in apply_default_properties_from_style in property input-type; // Internal, undocumented property, only exposed for tests. out property cursor-position_byte-offset; // Internal, undocumented property, only exposed for tests. out property anchor-position-byte-offset; out property 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 enabled: true; in property single-line: true; in property read-only: false; // Internal, undocumented property, only exposed for IME. out property 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 border-top-left-radius; in property border-top-right-radius; in property border-bottom-left-radius; in property border-bottom-right-radius; in property border-width; in property clip; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component Opacity { in property opacity: 1; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component Layer inherits Empty { in property 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 spacing-horizontal; in property spacing-vertical; in property spacing; // Additional accepted child Row { } } export component VerticalLayout { in property spacing; in property alignment; } export component HorizontalLayout { in property spacing; in property alignment; } component MoveTo { in property x; in property y; //-rust_type_constructor:slint::re_exports::PathElement::MoveTo(PathMoveTo{{}}) //-cpp_type:slint::private_api::PathMoveTo //-is_non_item_type } component LineTo { in property x; in property y; //-rust_type_constructor:slint::re_exports::PathElement::LineTo(PathLineTo{{}}) //-cpp_type:slint::private_api::PathLineTo //-is_non_item_type } component ArcTo { in property x; in property y; in property radius-x; in property radius-y; in property x-rotation; in property large_arc; in property sweep; //-rust_type_constructor:slint::re_exports::PathElement::ArcTo(PathArcTo{{}}) //-cpp_type:slint::private_api::PathArcTo //-is_non_item_type } component CubicTo { in property control-1-x; in property control-1-y; in property control-2-x; in property control-2-y; in property x; in property y; //-rust_type_constructor:slint::re_exports::PathElement::CubicTo(PathCubicTo{{}}) //-cpp_type:slint::private_api::PathCubicTo //-is_non_item_type } component QuadraticTo { in property control-x; in property control-y; in property x; in property 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 fill; in property fill-rule; in property stroke; in property stroke-width; in property stroke-line-cap; in property commands; // 'fake' hardcoded in typeregister.rs in property viewbox-x; in property viewbox-y; in property viewbox-width; in property viewbox-height; in property clip; in property 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 title; } // Note: not a native class, handled in the lower_tabs pass export component TabWidget { in-out property 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 x; //property y; in property width; in property height; /*property anchor_x; in property anchor_y; in property anchor_height; in property anchor_width;*/ in property close-on-click; in property 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 interval; callback triggered; in property running: true; //-is_non_item_type //-disallow_global_types_as_child_elements } export component Dialog inherits WindowItem { } component PropertyAnimation { in property delay; in property duration; in property direction; in property easing; in property iteration-count: 1.0; //-is_non_item_type } export global TextInputInterface { in property text-input-focused; } export global Platform { out property os; out property style-name; } export component NativeButton { in property text; in property icon; out property pressed; in property checkable; in-out property checked; out property has-focus; in property primary; in property colorize-icon; callback clicked; in property enabled: true; in property standard-button-kind; in property is-standard-button; //-is_internal //-accepts_focus } export component NativeCheckBox { in property enabled: true; in property text; in-out property checked; out property has-focus; callback toggled; //-is_internal //-accepts_focus } export component NativeSpinBox { in property enabled: true; out property has-focus; in-out property value; in property minimum; in property maximum: 100; in property step-size: 1; in property horizontal-alignment; callback edited(value: int); //-is_internal //-accepts_focus } export component NativeSlider { in property enabled: true; out property has-focus; in-out property value; in property minimum; in property maximum: 100; in property step: 1; in property orientation: Orientation.horizontal; callback changed(value: float); callback released(value: float); //-is_internal //-accepts_focus } export component NativeProgressIndicator { in property indeterminate; in property progress; //-is_internal } export component NativeGroupBox { in property enabled: true; in property title; out property native-padding-left; out property native-padding-right; out property native-padding-top; out property native-padding-bottom; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component NativeLineEdit { out property native-padding-left; out property native-padding-right; out property native-padding-top; out property native-padding-bottom; in property has-focus; in property enabled: true; //-is_internal } export component NativeScrollView { in property horizontal-max; in property horizontal-page-size; in property horizontal-value; in property vertical-max; in property vertical-page-size; in-out property vertical-value; out property native-padding-left; out property native-padding-right; out property native-padding-top; out property native-padding-bottom; in property has_focus; in property vertical-scrollbar-policy; in property horizontal-scrollbar-policy; in property enabled: true; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component NativeStandardListViewItem { in property index; in property item; in-out property is_selected; in property has_hover; in property has_focus; in property pressed; in property combobox; in property pressed-x; in property pressed-y; //-is_internal } export component NativeTableHeaderSection { in property index; in property item; in property has_hover; //-is_internal } export component NativeComboBox { in-out property current_value; in property enabled: true; in property has-focus; //-is_internal } export component NativeComboBoxPopup { //-is_internal } export component NativeTabWidget { in property width; in property height; out property content-x; out property content-y; out property content-height; out property content-width; out property tabbar-x; out property tabbar-y; out property tabbar-height; out property tabbar-width; in property tabbar-preferred-height; in property tabbar-preferred-width; in property content-min-height; in property content-min-width; in property current-index; in property current-focused; //-default_size_binding:expands_to_parent_geometry //-is_internal } export component NativeTab { in property title; in property icon; in property enabled: true; in-out property current; // supposed to be a binding to the tab in property tab-index; in property current-focused; in property num-tabs; //-is_internal } export global NativeStyleMetrics { out property layout-spacing; out property layout-padding; out property text-cursor-width; out property window-background; out property default-text-color; out property default-font-size; out property textedit-background; out property textedit-text-color; out property textedit-background-disabled; out property textedit-text-color-disabled; out property dark-color-scheme; // specific to the Native one out property placeholder-color; out property placeholder-color-disabled; // Tab Bar metrics: out property tab-bar-alignment; //-is_non_item_type //-is_internal } export global NativePalette { out property background; out property foreground; out property alternate-background; out property alternate-foreground; out property control-background; out property control-foreground; out property accent-background; out property accent-foreground; out property selection-background; out property selection-foreground; out property border; in-out property color-scheme; //-is_non_item_type //-is_internal }