// 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 { LayoutStyle } from "./vertical_layout_base.slint"; export struct CheckBoxStyle { // background_layer border_style: BorderStyle, // check_box element box_style: BorderStyle, // check_box icon box_icon_style: IconStyle, // additional text text_style: TextStyle, // layout layout_style: LayoutStyle } export component CheckBoxBase { // states in property enabled: true; in-out property checked; // styling in property style; // callbacks callback toggled(/* checked */ bool); accessible_role: checkbox; accessible_checkable: true; accessible_checked <=> root.checked; @children protected function toggle() { if !root.enabled { return; } root.checked = !root.checked; root.toggled(root.checked); } }