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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
export global WindowControls {
callback minimize();
callback maximize();
callback close();
callback drag();
callback double-click();
in-out property <bool> maximized: false;
}
export component Titlebar inherits Rectangle {
in property <string> title: "Application";
in property <image> icon;
height: 32px;
background: transparent;
HorizontalLayout {
padding: 0px;
spacing: 0px;
// Icon + Title + Drag area
drag-area := TouchArea {
horizontal-stretch: 1;
pointer-event(event) => {
if (event.kind == PointerEventKind.down && event.button == PointerEventButton.left) {
WindowControls.drag();
}
}
double-clicked => {
WindowControls.double-click();
}
HorizontalLayout {
padding-left: 12px;
padding-right: 8px;
spacing: 8px;
alignment: start;
if root.icon.width > 0 && root.icon.height > 0: Image {
source: root.icon;
width: 16px;
height: 16px;
vertical-alignment: center;
}
Text {
text: root.title;
font-size: 12px;
vertical-alignment: center;
overflow: elide;
}
}
}
// Window control buttons
minimize-btn := Rectangle {
width: 46px;
background: minimize-touch.has-hover ? #80808030 : transparent;
animate background { duration: 100ms; }
minimize-touch := TouchArea {
clicked => { WindowControls.minimize(); }
}
// Minimize icon (horizontal line)
Rectangle {
width: 10px;
height: 1px;
background: #cccccc;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
}
}
maximize-btn := Rectangle {
width: 46px;
background: maximize-touch.has-hover ? #80808030 : transparent;
animate background { duration: 100ms; }
maximize-touch := TouchArea {
clicked => { WindowControls.maximize(); }
}
if !WindowControls.maximized: Rectangle {
// Maximize icon (square outline)
width: 10px;
height: 10px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
border-width: 1px;
border-color: #cccccc;
background: transparent;
}
if WindowControls.maximized: Rectangle {
// Restore icon (two overlapping squares)
width: 12px;
height: 12px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
// Back square (offset top-right)
Rectangle {
x: 2px;
y: 0px;
width: 10px;
height: 10px;
border-width: 1px;
border-color: #cccccc;
background: transparent;
}
// Front square (offset bottom-left)
Rectangle {
x: 0px;
y: 2px;
width: 10px;
height: 10px;
border-width: 1px;
border-color: #cccccc;
background: #1e1e1e;
}
}
}
close-btn := Rectangle {
width: 46px;
background: close-touch.has-hover ? #c42b1c : transparent;
animate background { duration: 100ms; }
close-touch := TouchArea {
clicked => { WindowControls.close(); }
}
// Close icon (X shape)
Path {
width: 10px;
height: 10px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
stroke: close-touch.has-hover ? #ffffff : #cccccc;
stroke-width: 1px;
animate stroke { duration: 100ms; }
MoveTo { x: 0; y: 0; }
LineTo { x: 1; y: 1; }
MoveTo { x: 1; y: 0; }
LineTo { x: 0; y: 1; }
}
}
}
}