1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { SpinBox, Button, CheckBox, Slider, GroupBox, StandardListView } from "std-widgets.slint";
5import { Label, Page, Preview } from "common.slint";
6
7export component FaxPage inherits Page {
8 in-out property <string> fax-number <=> text.text;
9
10 callback fax-number-erase;
11 callback fax-send;
12
13 layout := GridLayout {
14 padding-left: 40px;
15 padding-right: 40px;
16 spacing: 20px;
17 padding-top: 20px;
18 padding-bottom: 20px;
19
20 preview := Preview {
21 rowspan: 5;
22 }
23
24 text := Text {
25 col: 1;
26 colspan: 2;
27 horizontal-alignment: center;
28 font-size: 40px;
29 horizontal-stretch: 1;
30 overflow: elide;
31 min-width: 0;
32 preferred-width: 0;
33 }
34
35 Rectangle {
36 col: 1;
37 row: 2;
38 colspan: 2;
39 background: #333;
40 height: 50%;
41 border-radius: 4px;
42
43 for row-model[r] in [
44 [ 7, 8, 9 ],
45 [ 4, 5, 6 ],
46 [ 1, 2, 3 ],
47 [ 0, -1 ],
48 ] : Rectangle {
49 width: 100%;
50 height: 25% * (parent.height - 5*10px);
51 y: r * (self.height + 10px) + 10px;
52
53 for num[c] in row-model : Rectangle {
54 height: parent.height;
55 width: (parent.width - 4*10px) / 3;
56 x: c * (self.width + 10px) + 10px;
57 border-radius: 4px;
58 background: key-area.pressed ? #566 : #555 ;
59 Text {
60 width: 100%;
61 height: 100%;
62 horizontal-alignment: center;
63 vertical-alignment: center;
64 color: white;
65 text: num >= 0 ? num : "⌫";
66 }
67 key-area := TouchArea {
68 clicked => {
69 if (num >= 0) {
70 root.fax-number += num;
71 } else {
72 root.fax-number-erase();
73 }
74 }
75
76 width: 100%;
77 height: 100%;
78 }
79 }
80 }
81 }
82
83 send := Button {
84 clicked => { root.fax-send(); }
85
86 row: 4;
87 col: 2;
88 text: "Send";
89 }
90 }
91}
92