1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/7guis"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: MIT
4
5import { LineEdit, Button, Slider, StandardListView, GridBox, HorizontalBox } from "std-widgets.slint";
6
7export component MainWindow inherits Window {
8 in property <[StandardListViewItem]> names-list;
9 out property <int> current-item: list.current-item;
10 out property <string> name;
11 out property <string> surname;
12 out property <string> prefix;
13 callback prefixEdited();
14 callback createClicked();
15 callback updateClicked();
16 callback deleteClicked();
17
18 GridBox {
19 Text {
20 text: "Filter prefix:";
21 vertical-alignment: center;
22 horizontal-alignment: right;
23 }
24
25 LineEdit {
26 text <=> root.prefix;
27 edited => { root.prefixEdited() }
28 }
29
30 list := StandardListView {
31 row: 1;
32 rowspan: 3;
33 colspan: 2;
34 model: root.names-list;
35 }
36
37 Text {
38 col: 2;
39 row: 1;
40 text: "Name: ";
41 vertical-alignment: center;
42 horizontal-alignment: right;
43 }
44
45 LineEdit { text <=> root.name; }
46
47 Text {
48 col: 2;
49 row: 2;
50 text: "Surname: ";
51 vertical-alignment: center;
52 horizontal-alignment: right;
53 }
54
55 LineEdit { text <=> root.surname; }
56
57 HorizontalBox {
58 padding-left: 0;
59 padding-bottom: 0;
60 row: 4;
61 alignment: start;
62
63 Button {
64 clicked => { root.createClicked() }
65
66 text: "Create";
67 }
68 Button {
69 clicked => { root.updateClicked() }
70
71 text: "Update";
72 enabled: list.current-item != -1 && list.current-item < root.names-list.length;
73
74 }
75 Button {
76 clicked => { root.deleteClicked() }
77
78 text: "Delete";
79 enabled: list.current-item != -1 && list.current-item < root.names-list.length;
80 }
81 }
82 }
83}
84}
85