// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial // 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. */ import { _ } from ""; // just to silence many errors in the LSP Empty := _ { input property x; input property y; input property width; input property height; //-default_size_binding:expands_to_parent_geometry //-is_internal } Rectangle := Empty { input property background; input property color <=> background; } BorderRectangle := Rectangle { input property border-width; input property border-radius; input property border-color; //-default_size_binding:expands_to_parent_geometry } export { BorderRectangle as Rectangle } ImageItem := Empty { input property source; input property image-fit; input property image-rendering; } export ClippedImage := ImageItem { input property source-clip-x; input property source-clip-y; input property source-clip-width; input property source-clip-height; input property colorize; //-default_size_binding:implicit_size } export { ClippedImage as Image } export Rotate := Empty { input property rotation-angle; input property rotation-origin-x; input property rotation-origin-y; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Text := Empty { input property text; input property font-family; input property font-size; input property font-weight; input property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style input property horizontal-alignment; input property vertical-alignment; input property overflow; input property wrap; input property letter-spacing; //-default_size_binding:implicit_size } export struct PointerEvent := { //-name:slint::private_api::PointerEvent button: PointerEventButton, kind: PointerEventKind, } export TouchArea := _ { input property x; input property y; input property width; input property height; input property enabled: true; output property pressed; output property has_hover; output property mouse_x; output property mouse_y; output property pressed_x; output property pressed_y; input property mouse-cursor; callback clicked; callback moved; callback pointer-event(PointerEvent); //-default_size_binding:expands_to_parent_geometry } export struct KeyboardModifiers := { //-name:slint::private_api::KeyboardModifiers alt: bool, control: bool, shift: bool, meta: bool, } export struct KeyEvent := { //-name:slint::private_api::KeyEvent text: string, modifiers: KeyboardModifiers, } export FocusScope := _ { input property x; input property y; input property width; input property height; input property enabled: true; output property has-focus; callback key_pressed(KeyEvent) -> EventResult; callback key_released(KeyEvent) -> EventResult; //-default_size_binding:expands_to_parent_geometry //-accepts_focus } export Flickable := Empty { // These properties are actually going to be forwarded to the viewport by the // code generator input property viewport-height; input property viewport-width; input output property viewport-x; input output property viewport-y; input property interactive: true; //-default_size_binding:expands_to_parent_geometry } WindowItem := _ { input output property width; input output property height; input property background; // StyleMetrics.window_background set in apply_default_properties_from_style input property color <=> background; input property title: "Slint Window"; input property no-frame; input property default-font-family; input property default-font-size; input property default-font-weight; input property icon; } export Window := WindowItem {} export BoxShadow := Empty { input property border_radius; input property offset_x; input property offset_y; input property color; input property blur; //-default_size_binding:expands_to_parent_geometry //-is_internal } export struct Point := { //-name:slint::private_api::Point x: length, y: length, } export TextInput := _ { input output property text; input property font-family; input property font-size; input property font-weight; input property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style input property selection-foreground-color: #000; input property selection-background-color: #808080; input property horizontal-alignment; input property vertical-alignment; input property wrap; input property letter-spacing; input property x; input property y; input property width; input property height; input property text-cursor-width; // StyleMetrics.text-cursor-width set in apply_default_properties_from_style input property input-type; // Internal, undocumented property, only exposed for tests. output property cursor-position_byte-offset; // Internal, undocumented property, only exposed for tests. output property anchor-position-byte-offset; output property has-focus; callback accepted; callback edited; callback cursor_position_changed(Point); input property enabled: true; input property single-line: true; input property read-only: false; output property preedit-text; //-default_size_binding:expands_to_parent_geometry //-accepts_focus } export Clip := _ { input property x; input property y; input property width; input property height; input property border-radius; input property border-width; input property clip; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Opacity := _ { input property x; input property y; input property width; input property height; input property opacity: 1; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Layer := Empty { input property cache-rendering-hint; //-default_size_binding:expands_to_parent_geometry //-is_internal } Row := _ { //-is_non_item_type } // Note: layouts are not NativeClass, but this is lowered in lower_layout export GridLayout := _ { input property spacing; // Additional accepted child Row { } } export VerticalLayout := _ { input property spacing; input property alignment; } export HorizontalLayout := _ { input property spacing; input property alignment; } MoveTo := _ { input property x; input property y; //-rust_type_constructor:slint::re_exports::PathElement::MoveTo(PathMoveTo{{}}) //-cpp_type:slint::private_api::PathMoveTo //-is_non_item_type } LineTo := _ { input property x; input property y; //-rust_type_constructor:slint::re_exports::PathElement::LineTo(PathLineTo{{}}) //-cpp_type:slint::private_api::PathLineTo //-is_non_item_type } ArcTo := _ { input property x; input property y; input property radius-x; input property radius-y; input property x-rotation; input property large_arc; input property sweep; //-rust_type_constructor:slint::re_exports::PathElement::ArcTo(PathArcTo{{}}) //-cpp_type:slint::private_api::PathArcTo //-is_non_item_type } CubicTo := _ { input property control-1-x; input property control-1-y; input property control-2-x; input property control-2-y; input property x; input property y; //-rust_type_constructor:slint::re_exports::PathElement::CubicTo(PathCubicTo{{}}) //-cpp_type:slint::private_api::PathCubicTo //-is_non_item_type } QuadraticTo := _ { input property control-x; input property control-y; input property x; input property y; //-rust_type_constructor:slint::re_exports::PathElement::QuadraticTo(PathQuadraticTo{{}}) //-cpp_type:slint::private_api::PathQuadraticTo //-is_non_item_type } Close := _ { //-rust_type_constructor:slint::re_exports::PathElement::Close //-cpp_type:slint::private_api::PathClose //-is_non_item_type //-is_non_item_type } export Path := _ { input property x; input property y; input property width; input property height; input property fill; input property fill-rule; input property stroke; input property stroke-width; input property commands; input property viewbox-x; input property viewbox-y; input property viewbox-width; input property viewbox-height; input property clip; //-disallow_global_types_as_child_elements MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} //-default_size_binding:expands_to_parent_geometry } export PathLayout := _ { input property x; input property y; input property width; input property height; input property commands; input property offset; MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} } Tab := _ { input property title; } // Note: not a native class, handled in the lower_tabs pass export TabWidget := _ { input property x; input property y; input property width; input property height; input property current-index; input property current-focused; //-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 PopupWindow := _ { //property x; //property y; input property width; input property height; /*property anchor_x; input property anchor_y; input property anchor_height; input property anchor_width;*/ //show() is hardcoded in typeregister.rs } export Dialog := WindowItem {} PropertyAnimation := _ { input property delay; input property duration; input property easing; input property iteration-count: 1.0; //-is_non_item_type } export struct StandardListViewItem := { //-name:slint::private_api::StandardListViewItem text: string } export struct StateInfo := { //-name:slint::private_api::StateInfo current_state: int, previous_state: int, //change_time: duration, //-is_internal } export NativeButton := _ { input property x; input property y; input property width; input property height; input property text; input property icon; output property pressed; input property checkable; input output property checked; output property has-focus; callback clicked; input property enabled: true; input property standard-button-kind; input property is-standard-button; //-is_internal } export NativeCheckBox := _ { input property x; input property y; input property width; input property height; input property enabled: true; input property text; input output property checked; output property has-focus; callback toggled; //-is_internal } export NativeSpinBox := _ { input property x; input property y; input property width; input property height; input property enabled: true; output property has-focus; input output property value; input property minimum; input property maximum: 100; //-is_internal } export NativeSlider := _ { input property x; input property y; input property width; input property height; input property enabled: true; input output property value; input property minimum; input property maximum: 100; callback changed(float); //-is_internal } export NativeGroupBox := _ { input property x; input property y; input property width; input property height; input property enabled: true; input property title; output property native-padding-left; output property native-padding-right; output property native-padding-top; output property native-padding-bottom; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeLineEdit := _ { input property x; input property y; input property width; input property height; output property native-padding-left; output property native-padding-right; output property native-padding-top; output property native-padding-bottom; input property has-focus; input property enabled: true; //-is_internal } export NativeScrollView := _ { input property x; input property y; input property width; input property height; input property horizontal-max; input property horizontal-page-size; input property horizontal-value; input property vertical-max; input property vertical-page-size; input output property vertical-value; output property native-padding-left; output property native-padding-right; output property native-padding-top; output property native-padding-bottom; input property has_focus; input property enabled: true; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeStandardListViewItem := _ { input property x; input property y; input property width; input property height; input property index; input property item; input output property is_selected; input property has_hover; //-is_internal } export NativeComboBox := _ { input property x; input property y; input property width; input property height; input property current_value; input output property is_open; input property enabled: true; callback open_popup; //-is_internal } export NativeComboBoxPopup := _ { input property x; input property y; input property width; input property height; //-is_internal } export NativeTabWidget := _ { input property x; input property y; input property width; input property height; output property content-x; output property content-y; output property content-height; output property content-width; output property tabbar-x; output property tabbar-y; output property tabbar-height; output property tabbar-width; input property tabbar-preferred-height; input property tabbar-preferred-width; input property content-min-height; input property content-min-width; input property current-index; input property current-focused; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeTab := _ { input property x; input property y; input property width; input property height; input property title; input property icon; input property enabled : true; output property pressed; output property current; // supposed to be a binding to the tab input property tab-index; input property current-focused; input property num-tabs; //-is_internal } export global NativeStyleMetrics := { output property layout-spacing; output property layout-padding; output property text-cursor-width; output property window-background; output property default-text-color; output property textedit-background; output property textedit-text-color; output property textedit-background-disabled; output property textedit-text-color-disabled; output property dark-color-scheme; // specific to the Native one output property placeholder-color; output property placeholder-color-disabled; // Tab Bar metrics: output property tab-bar-alignment; //-is_non_item_type //-is_internal }