1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { HorizontalBox, VerticalBox, StandardTableView, GroupBox} from "std-widgets.slint";
5import { GallerySettings } from "../gallery_settings.slint";
6import { Page } from "page.slint";
7
8export global TableViewPageAdapter {
9 in property <[[StandardListViewItem]]> row_data: [
10 [ { text: "Item 1.1" }, { text: "Item 1.2" }, { text: "Item 1.3" }, { text: "Item 1.4" }, ],
11 [ { text: "Item 2.1" }, { text: "Item 2.2" }, { text: "Item 2.3" }, { text: "Item 2.4" }, ],
12 [ { text: "Item 3.1" }, { text: "Item 3.2" }, { text: "Item 3.3" }, { text: "Item 3.4" }, ],
13 [ { text: "Item 4.1" }, { text: "Item 4.2" }, { text: "Item 4.3" }, { text: "Item 4.4" }, ],
14 [ { text: "Item 5.1" }, { text: "Item 5.2" }, { text: "Item 5.3" }, { text: "Item 5.4" }, ],
15 [ { text: "Item 6.1" }, { text: "Item 6.2" }, { text: "Item 6.3" }, { text: "Item 6.4" }, ],
16 ];
17
18 callback sort_ascending(int);
19 callback sort_descending(int);
20}
21
22export component TableViewPage inherits Page {
23 title: @tr("TableView");
24 show-enable-switch: false;
25 description: @tr("StandardTableView can be used to display a list of text elements in columns and rows. It can be imported from \"std-widgets.slint\"");
26
27 HorizontalBox {
28 vertical-stretch: 1;
29
30 GroupBox {
31 title: @tr("StandardTableView");
32 vertical-stretch: 0;
33
34 StandardTableView {
35 sort-ascending(index) => {
36 TableViewPageAdapter.sort_ascending(index);
37 }
38
39 sort-descending(index) => {
40 TableViewPageAdapter.sort-descending(index);
41 }
42
43 columns: [
44 { title: @tr("Header 1") },
45 { title: @tr("Header 2") },
46 { title: @tr("Header 3") },
47 { title: @tr("Header 4") },
48 ];
49 rows: TableViewPageAdapter.row_data;
50 }
51 }
52 }
53}
54