// 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 enum PopupPosition { top, bottom } export struct ComboBoxItemStyle { // background_layer border_style: BorderStyle, // content_layer text_style: TextStyle, // layout layout_style: LayoutStyle } export struct ComboBoxStyle { // background_layer border_style: BorderStyle, // content_layer icon_style: IconStyle, text_style: TextStyle, placeholder_style: TextStyle, // layout layout_style: LayoutStyle, // items item_style: ComboBoxItemStyle, // popup popup_border_style: BorderStyle, } export struct ComboBoxItem { text: string } export component ComboBoxBase { in property enabled: true; in property <[ComboBoxItem]> model; in_out property current_index: -1; out property current_value: root.model[root.current_index]; in property placeholder_text; in property popup_position: PopupPosition.bottom; in property style; callback selected(/* index */ int); accessible_role: combobox; background_layer := Border { style: root.style.border_style; } @children }