// SPDX-FileCopyrightText: 2024 vivi developers // SPDX-License-Identifier: MIT import { BorderStyle, Border } from "./border.slint"; import { IconStyle } from "./icon_base.slint"; import { TextStyle } from "./text_base.slint"; import { FocusTouchArea } from "./focus_touch_area.slint"; import { LayoutStyle } from "./vertical_layout_base.slint"; export struct ButtonStyle { // background_layer border_style: BorderStyle, // content_layer icon_style: IconStyle, text_style: TextStyle, placeholder_style: TextStyle, // layout layout_style: LayoutStyle } export component ButtonBase { // states in property enabled <=> touch_area.enabled; out property has_hover <=> touch_area.has_hover; out property has_focus <=> touch_area.has_focus; out property pressed <=> touch_area.pressed; out property enter_pressed <=> touch_area.enter_pressed; // styling in property style; in property mouse_cursor <=> touch_area.mouse_cursor; // callbacks callback clicked <=> touch_area.clicked; forward_focus: touch_area; accessible_role: button; accessible_action_default => { touch_area.clicked(); } touch_area := FocusTouchArea { width: 100%; height: 100%; } background_layer := Border { style: root.style.border_style; } @children }