// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial /** 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. Or they can have a binding `native_output` which mean that the property can be modified by the native Item. If they don't have that, it is assumed the native item don't write to that property. */ import { _ } from ""; // just to silence many errorin the LSP Rectangle := _ { property background; property color <=> background; property x; property y; property width; property height; } BorderRectangle := Rectangle { property border-width; property border-radius; property border-color; //-default_size_binding:expands_to_parent_geometry } export { BorderRectangle as Rectangle } ImageItem := _ { property source; property x; property y; property width; property height; property image-fit; property image-rendering; } export ClippedImage := ImageItem { property source-clip-x; property source-clip-y; property source-clip-width; property source-clip-height; property colorize; property image-rendering; //-default_size_binding:implicit_size } export { ClippedImage as Image } export Rotate := _ { property angle; property origin-x; property origin-y; property width; property height; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Text := _ { property text; property font-family; property font-size; property font-weight; property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style property horizontal-alignment; property vertical-alignment; property overflow; property wrap; property letter-spacing; property x; property y; property width; property height; //-default_size_binding:implicit_size } export struct PointerEvent := { //-name:slint::private_api::PointerEvent button: PointerEventButton, kind: PointerEventKind, } export TouchArea := _ { property x; property y; property width; property height; property enabled: true; property pressed: native_output; property has_hover: native_output; property mouse_x: native_output; property mouse_y: native_output; property pressed_x: native_output; property pressed_y: native_output; 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 := _ { property x; property y; property width; property height; property has-focus: native_output; callback key_pressed(KeyEvent) -> EventResult; callback key_released(KeyEvent) -> EventResult; //-default_size_binding:expands_to_parent_geometry //-accepts_focus } export Flickable := _ { property x; property y; property width; property height; // These properties are actually going to be forwarded to the viewport by the // code generator property viewport-height; property viewport-width; property viewport-x: native_output; property viewport-y: native_output; property interactive: true; //-default_size_binding:expands_to_parent_geometry } WindowItem := _ { property width: native_output; property height: native_output; property background; // StyleMetrics.window_background set in apply_default_properties_from_style property color <=> background; property title: "Slint Window"; property no-frame; property default-font-family; property default-font-size; property default-font-weight; property icon; } export Window := WindowItem {} export BoxShadow := _ { property x; property y; property width; property height; property border_radius; property offset_x; property offset_y; property color; 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 := _ { property text: native_output; property font-family; property font-size; property font-weight; property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style property selection-foreground-color: #000; property selection-background-color: #808080; property horizontal-alignment; property vertical-alignment; property wrap; property letter-spacing; property x; property y; property width; property height; property text-cursor-width; // StyleMetrics.text-cursor-width set in apply_default_properties_from_style property cursor-position: native_output; property anchor-position: native_output; property has-focus: native_output; callback accepted; callback edited; callback cursor_position_changed(Point); property enabled: true; property single-line: true; //-default_size_binding:expands_to_parent_geometry //-accepts_focus } export Clip := _ { property x; property y; property width; property height; property border-radius; property border-width; property clip; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Opacity := _ { property x; property y; property width; property height; property opacity: 1; //-default_size_binding:expands_to_parent_geometry //-is_internal } Row := _ { //-is_non_item_type } // Note: layouts are not NativeClass, but this is lowerd in lower_layout export GridLayout := _ { property spacing; // Additional accepted child Row { } } export VerticalLayout := _ { property spacing; property alignment; } export HorizontalLayout := _ { property spacing; property alignment; } MoveTo := _ { property x; property y; //-rust_type_constructor:slint::re_exports::PathElement::MoveTo(PathMoveTo{{}}) //-cpp_type:slint::private_api::PathMoveTo //-is_non_item_type } LineTo := _ { property x; property y; //-rust_type_constructor:slint::re_exports::PathElement::LineTo(PathLineTo{{}}) //-cpp_type:slint::private_api::PathLineTo //-is_non_item_type } ArcTo := _ { property x; property y; property radius-x; property radius-y; property x-rotation; property large_arc; property sweep; //-rust_type_constructor:slint::re_exports::PathElement::ArcTo(PathArcTo{{}}) //-cpp_type:slint::private_api::PathArcTo //-is_non_item_type } CubicTo := _ { property control-1-x; property control-1-y; property control-2-x; property control-2-y; property x; property y; //-rust_type_constructor:slint::re_exports::PathElement::CubicTo(PathCubicTo{{}}) //-cpp_type:slint::private_api::PathCubicTo //-is_non_item_type } QuadraticTo := _ { property control-x; property control-y; property x; 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 := _ { property x; property y; property width; property height; property fill; property fill-rule; property stroke; property stroke-width; property commands; property viewbox-x; property viewbox-y; property viewbox-width; property viewbox-height; property clip; //-disallow_global_types_as_child_elements MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} //-default_size_binding:expands_to_parent_geometry } export PathLayout := _ { property x; property y; property width; property height; property commands; property offset; MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} } Tab := _ { property title; } // Note: not a native class, handled in the lower_tabs pass export TabWidget := _ { property x; property y; property width; property height; 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 PopupWindow := _ { //property x; //property y; property width; property height; /*property anchor_x; property anchor_y; property anchor_height; property anchor_width;*/ //show() is hardcoded in typeregister.rs } export Dialog := WindowItem {} PropertyAnimation := _ { property delay; property duration; property easing; 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 := _ { property x; property y; property width; property height; property text; property icon; property pressed: native_output; callback clicked; property enabled: true; property standard-button-kind; property is-standard-button; //-is_internal } export NativeCheckBox := _ { property x; property y; property width; property height; property enabled: true; property text; property checked: native_output; callback toggled; //-is_internal } export NativeSpinBox := _ { property x; property y; property width; property height; property enabled: true; property value: native_output; property minimum; property maximum: 100; //-is_internal } export NativeSlider := _ { property x; property y; property width; property height; property enabled: true; property value: native_output; property minimum; property maximum: 100; callback changed(float); //-is_internal } export NativeGroupBox := _ { property x; property y; property width; property height; property enabled: true; property title; property native-padding-left: native_output; property native-padding-right: native_output; property native-padding-top: native_output; property native-padding-bottom: native_output; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeLineEdit := _ { property x; property y; property width; property height; property native-padding-left: native_output; property native-padding-right: native_output; property native-padding-top: native_output; property native-padding-bottom: native_output; property has-focus; property enabled: true; //-is_internal } export NativeScrollView := _ { property x; property y; property width; property height; property horizontal-max; property horizontal-page-size; property horizontal-value; property vertical-max; property vertical-page-size; property vertical-value: native_output; property native-padding-left: native_output; property native-padding-right: native_output; property native-padding-top: native_output; property native-padding-bottom: native_output; property has_focus: native_output; property enabled: true; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeStandardListViewItem := _ { property x; property y; property width; property height; property index; property item; property is_selected: native_output; property has_hover; //-is_internal } export NativeComboBox := _ { property x; property y; property width; property height; property current_value; property is_open: native_output; property enabled: true; callback open_popup; //-is_internal } export NativeComboBoxPopup := _ { property x; property y; property width; property height; //-is_internal } export NativeTabWidget := _ { property x; property y; property width; property height; property content-x: native_output; property content-y: native_output; property content-height: native_output; property content-width: native_output; property tabbar-x: native_output; property tabbar-y: native_output; property tabbar-height: native_output; property tabbar-width: native_output; property tabbar-preferred-height; property tabbar-preferred-width; property content-min-height; property content-min-width; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeTab := _ { property x; property y; property width; property height; property title; property icon; property enabled : true; property pressed : native_output; property current: native_output; // supposed to be a binding to the tab property tab_index; property num_tabs; //-is_internal } export global NativeStyleMetrics := { property layout-spacing : native_output; property layout-padding : native_output; property text-cursor-width : native_output; property window-background : native_output; property default-text-color : native_output; property textedit-background : native_output; property textedit-text-color : native_output; property textedit-background-disabled : native_output; property textedit-text-color-disabled : native_output; property dark-style : native_output; // specific to the Native one property placeholder-color : native_output; property placeholder-color-disabled : native_output; //-is_non_item_type //-is_internal }