mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-10 05:39:16 +00:00

* Text only StandardTableView with column and rows * Text editing of cells * Sort by column ascending and descending * Variants of the TableView for native, fluent and material
45 lines
No EOL
1.3 KiB
Text
45 lines
No EOL
1.3 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
|
|
|
import { StateLayer } from "comp-state-layer.slint";
|
|
import { md } from "md.slint";
|
|
|
|
// A selectable item that is used by `StandardListView` and `ComboBox`.
|
|
export component Item inherits Rectangle {
|
|
callback clicked <=> state-layer.clicked;
|
|
|
|
in property<bool> selected;
|
|
in property<string> text;
|
|
|
|
// background: md.sys.color.background;
|
|
height: 48px;
|
|
|
|
state-layer := StateLayer {
|
|
checked: root.selected;
|
|
background: md.sys.color.primary;
|
|
selection-background: md.sys.color.secondary-container;
|
|
ripple-color: md.sys.color.primary-ripple;
|
|
has-ripple: true;
|
|
}
|
|
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
|
|
label := Text {
|
|
text: root.text;
|
|
color: md.sys.color.on-surface;
|
|
vertical-alignment: center;
|
|
// FIXME after Roboto font can be loaded
|
|
//font-family: md.sys.typescale.label-large.font;
|
|
font-size: md.sys.typescale.label-large.size;
|
|
font-weight: md.sys.typescale.label-large.weight;
|
|
}
|
|
}
|
|
|
|
states [
|
|
selected when root.selected : {
|
|
state-layer.background: md.sys.color.secondary-container;
|
|
}
|
|
]
|
|
} |