forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.60
79 lines (72 loc) · 2.21 KB
/
todo.60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <[email protected]>
Copyright (c) 2020 Simon Hausmann <[email protected]>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact [email protected] for more information.
LICENSE END */
import { SpinBox, Button, CheckBox, Slider, LineEdit, ScrollView, ListView } from "sixtyfps_widgets.60";
export TodoItem := {
property <string> title;
property <bool> checked;
}
MainWindow := Window {
width: 400lx;
height: 600lx;
signal todo_added(string);
signal remove_done();
property <[TodoItem]> todo_model: [
{ title: "Implement the .60 file", checked: true },
{ title: "Do the rust part", checked: false },
{ title: "Make the C++ code", checked: false },
{ title: "???", checked: false },
{ title: "Profit", checked: false },
];
GridLayout {
Row {
text_edit := LineEdit {
text: "Something to do";
accepted(text) => {
todo_added(text);
}
}
btn := Button {
text: "Add Todo";
clicked => {
todo_added(text_edit.text);
}
}
}
spacing := Rectangle {
height: 15lx;
maximum_height: 15lx;
minimum_height: 15lx;
row: 1;
rowspan: 2;
}
list_view := ListView {
rowspan: 2;
row: 2;
for todo in todo_model: Rectangle {
height: 20lx;
GridLayout {
CheckBox {
text: todo.title;
checked: todo.checked;
toggled => {
todo.checked = checked;
}
}
}
}
}
Row {
Button {
col: 1;
text: "Remove done items!";
clicked => { root.remove_done(); }
}
}
}
}