/* LICENSE BEGIN This file is part of the SixtyFPS Project -- https://sixtyfps.io Copyright (c) 2021 Olivier Goffart Copyright (c) 2021 Simon Hausmann SPDX-License-Identifier: GPL-3.0-only This file is also available under commercial licensing terms. Please contact info@sixtyfps.io for more information. LICENSE END */ /** This file contains the definition off all builtin items It is parsed with the normal .60 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; } export ClippedImage := ImageItem { property source-clip-x; property source-clip-y; property source-clip-width; property source-clip-height; property colorize; //-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: #000; 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 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; callback clicked; //-default_size_binding:expands_to_parent_geometry } export struct KeyboardModifiers := { //-name:sixtyfps::private_api::KeyboardModifiers alt: bool, control: bool, shift: bool, meta: bool, } export struct KeyEvent := { //-name:sixtyfps::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 } export Window := _ { 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: "SixtyFPS Window"; property default_font_family; property default_font_size; property default_font_weight; } 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 TextInput := _ { property text: native_output; property font_family; property font_size; property font_weight; property color: #000; property selection_foreground_color: #000; property selection_background_color: #808080; property horizontal_alignment; property vertical_alignment; 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; property enabled: 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; //-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:sixtyfps::re_exports::PathElement::MoveTo(PathMoveTo{{}}) //-cpp_type:sixtyfps::private_api::PathMoveTo //-is_non_item_type } LineTo := _ { property x; property y; //-rust_type_constructor:sixtyfps::re_exports::PathElement::LineTo(PathLineTo{{}}) //-cpp_type:sixtyfps::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:sixtyfps::re_exports::PathElement::ArcTo(PathArcTo{{}}) //-cpp_type:sixtyfps::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:sixtyfps::re_exports::PathElement::CubicTo(PathCubicTo{{}}) //-cpp_type:sixtyfps::private_api::PathCubicTo //-is_non_item_type } QuadraticTo := _ { property control_x; property control_y; property x; property y; //-rust_type_constructor:sixtyfps::re_exports::PathElement::QuadraticTo(PathQuadraticTo{{}}) //-cpp_type:sixtyfps::private_api::PathQuadraticTo //-is_non_item_type } Close := _ { //-rust_type_constructor:sixtyfps::re_exports::PathElement::Close //-is_non_item_type //-is_non_item_type } export Path := _ { property x; property y; property width; property height; property fill; property fill_color <=> fill; property fill_rule; property stroke; property stroke_color <=> 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 {} } // Note: not a 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 } PropertyAnimation := _ { property duration; property easing; property loop_count; //-is_non_item_type } export struct StandardListViewItem := { //-name:sixtyfps::StandardListViewItem text: string } export struct StateInfo := { //-name:sixtyfps::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 pressed: native_output; callback clicked; property enabled: true; //-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; //-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; //-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 focused: native_output; 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; //-is_internal } export NativeStandardListViewItem := _ { property x; property y; property width; property height; property index; property item; property is_selected: native_output; //-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 global NativeStyleMetrics := { property layout_spacing; property layout_padding; property text_cursor_width; //-is_non_item_type //-is_internal }