mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00

Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
63 lines
1.7 KiB
Text
63 lines
1.7 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
import { ComboBoxBase } from "../common/combobox-base.slint";
|
|
|
|
export component ComboBox {
|
|
in property <[string]> model <=> i-base.model;
|
|
in property <bool> enabled <=> i-base.enabled;
|
|
out property <bool> has-focus <=> i-base.has-focus;
|
|
in-out property <int> current-index <=> i-base.current-index;
|
|
in-out property <string> current-value <=> i-base.current-value;
|
|
|
|
callback selected <=> i-base.selected;
|
|
|
|
accessible-role: combobox;
|
|
accessible-value <=> root.current-value;
|
|
forward-focus: i-base;
|
|
|
|
HorizontalLayout {
|
|
i-native := NativeComboBox {
|
|
current-value <=> root.current-value;
|
|
has-focus <=> root.has-focus;
|
|
enabled <=> root.enabled;
|
|
}
|
|
}
|
|
|
|
i-base := ComboBoxBase {
|
|
width: 100%;
|
|
height: 100%;
|
|
show-popup => {
|
|
i-popup.show();
|
|
}
|
|
}
|
|
|
|
i-popup := PopupWindow {
|
|
x: 0;
|
|
y: root.height;
|
|
width: root.width;
|
|
|
|
NativeComboBoxPopup {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
VerticalLayout {
|
|
spacing: 0px;
|
|
|
|
for value[index] in root.model: NativeStandardListViewItem {
|
|
item: { text: value };
|
|
is-selected: root.current-index == index;
|
|
has-hover: ta.has-hover;
|
|
combobox: true;
|
|
|
|
ta := TouchArea {
|
|
clicked => {
|
|
i-base.select(index);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|