// 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 := _ { in property x; in property y; in property width; in property height; //-default_size_binding:expands_to_parent_geometry //-is_internal } Rectangle := Empty { in property background; in property color <=> background; } BorderRectangle := Rectangle { in property border-width; in property border-radius; in property border-color; //-default_size_binding:expands_to_parent_geometry } export { BorderRectangle as Rectangle } ImageItem := Empty { in property source; in property image-fit; in property image-rendering; } export ClippedImage := ImageItem { in property source-clip-x; in property source-clip-y; in property source-clip-width; in property source-clip-height; in property colorize; //-default_size_binding:implicit_size } export { ClippedImage as Image } export Rotate := Empty { in property rotation-angle; in property rotation-origin-x; in property rotation-origin-y; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Text := Empty { in property text; in property font-family; 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; in property overflow; in property wrap; in property letter-spacing; //-default_size_binding:implicit_size } export struct PointerEvent := { //-name:slint::private_api::PointerEvent button: PointerEventButton, kind: PointerEventKind, } export TouchArea := _ { in property x; in property y; in property width; in property height; 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 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 := _ { in property x; in property y; in property width; in property height; in property enabled: true; out 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 in property viewport-height; in property viewport-width; in-out property viewport-x; in-out property viewport-y; in property interactive: true; //-default_size_binding:expands_to_parent_geometry } WindowItem := _ { in-out property width; in-out property height; in property background; // StyleMetrics.window_background set in apply_default_properties_from_style in property color <=> background; in property title: "Slint Window"; in property no-frame; 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 Window := WindowItem {} export BoxShadow := 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 struct Point := { //-name:slint::private_api::Point x: length, y: length, } export TextInput := _ { in-out property text; in property font-family; in property font-size; in property font-weight; in property color; // StyleMetrics.default-text-color set in apply_default_properties_from_style in property selection-foreground-color: #000; in property selection-background-color: #808080; in property horizontal-alignment; in property vertical-alignment; in property wrap; in property letter-spacing; in property x; in property y; in property width; in property 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(Point); in property enabled: true; in property single-line: true; in property read-only: false; out property preedit-text; //-default_size_binding:expands_to_parent_geometry //-accepts_focus } export Clip := _ { in property x; in property y; in property width; in property height; in property border-radius; in property border-width; in property clip; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Opacity := _ { in property x; in property y; in property width; in property height; in property opacity: 1; //-default_size_binding:expands_to_parent_geometry //-is_internal } export Layer := Empty { in 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 := _ { in property spacing; // Additional accepted child Row { } } export VerticalLayout := _ { in property spacing; in property alignment; } export HorizontalLayout := _ { in property spacing; in property alignment; } 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 } 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 } 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 } 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 } 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 } 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 := _ { in property x; in property y; in property width; in property height; in property fill; in property fill-rule; in property stroke; in property stroke-width; in property commands; in property viewbox-x; in property viewbox-y; in property viewbox-width; in property viewbox-height; in property clip; //-disallow_global_types_as_child_elements MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} //-default_size_binding:expands_to_parent_geometry } export PathLayout := _ { in property x; in property y; in property width; in property height; in property commands; in property offset; MoveTo {} LineTo {} ArcTo {} CubicTo {} QuadraticTo {} Close {} } Tab := _ { in property title; } // Note: not a native class, handled in the lower_tabs pass export TabWidget := _ { in property x; in property y; in property width; in property height; in property current-index; in 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; in property width; in property height; /*property anchor_x; in property anchor_y; in property anchor_height; in property anchor_width;*/ //show() is hardcoded in typeregister.rs } export Dialog := WindowItem {} PropertyAnimation := _ { in property delay; in property duration; in property easing; in 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 := _ { in property x; in property y; in property width; in property height; in property text; in property icon; out property pressed; in property checkable; in-out property checked; out property has-focus; callback clicked; in property enabled: true; in property standard-button-kind; in property is-standard-button; //-is_internal } export NativeCheckBox := _ { in property x; in property y; in property width; in property height; in property enabled: true; in property text; in-out property checked; out property has-focus; callback toggled; //-is_internal } export NativeSpinBox := _ { in property x; in property y; in property width; in property height; in property enabled: true; out property has-focus; in-out property value; in property minimum; in property maximum: 100; //-is_internal } export NativeSlider := _ { in property x; in property y; in property width; in property height; in property enabled: true; in-out property value; in property minimum; in property maximum: 100; callback changed(float); //-is_internal } export NativeGroupBox := _ { in property x; in property y; in property width; in property height; 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 NativeLineEdit := _ { in property x; in property y; in property width; in property height; 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 NativeScrollView := _ { in property x; in property y; in property width; in property height; 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 enabled: true; //-default_size_binding:expands_to_parent_geometry //-is_internal } export NativeStandardListViewItem := _ { in property x; in property y; in property width; in property height; in property index; in property item; in-out property is_selected; in property has_hover; //-is_internal } export NativeComboBox := _ { in property x; in property y; in property width; in property height; in property current_value; in-out property is_open; in property enabled: true; callback open_popup; //-is_internal } export NativeComboBoxPopup := _ { in property x; in property y; in property width; in property height; //-is_internal } export NativeTabWidget := _ { in property x; in property y; 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 NativeTab := _ { in property x; in property y; in property width; in property height; in property title; in property icon; in property enabled : true; out property pressed; 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 }