2 * Copyright (C) 2014-2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Lomiri.Components 1.3
22 spacing: overlayShown ? units.gu(2) : windowIsMaximized ? 0 : units.gu(1)
24 LomiriNumberAnimation {}
27 // to be set from outside
28 property bool active: false
29 property bool windowIsMaximized: false
30 property bool closeButtonShown: true
31 property bool maximizeButtonShown: true
32 property bool minimizeButtonVisible: true
33 property bool overlayShown
36 signal minimizeClicked()
37 signal maximizeClicked()
38 signal maximizeVerticallyClicked()
39 signal maximizeHorizontallyClicked()
43 objectName: "closeWindowButton"
47 onClicked: root.closeClicked()
48 visible: root.closeButtonShown
52 anchors.margins: windowIsMaximized ? units.dp(3) : 0
54 color: theme.palette.normal.negative
55 visible: parent.containsMouse && !overlayShown
59 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
60 source: "graphics/window-close.svg"
61 color: root.active ? "white" : LomiriColors.slate
66 id: minimizeWindowButton
67 objectName: "minimizeWindowButton"
71 onClicked: root.minimizeClicked()
72 visible: root.minimizeButtonVisible
76 anchors.margins: windowIsMaximized ? units.dp(3) : 0
78 color: root.active ? LomiriColors.graphite : LomiriColors.ash
79 visible: parent.containsMouse && !overlayShown
83 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
84 source: "graphics/window-minimize.svg"
85 color: root.active ? "white" : LomiriColors.slate
90 id: maximizeWindowButton
91 objectName: "maximizeWindowButton"
95 visible: root.maximizeButtonShown
96 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
98 if (mouse.button == Qt.LeftButton) {
99 root.maximizeClicked();
100 } else if (mouse.button == Qt.RightButton) {
101 root.maximizeHorizontallyClicked();
102 } else if (mouse.button == Qt.MiddleButton) {
103 root.maximizeVerticallyClicked();
109 anchors.margins: windowIsMaximized ? units.dp(3) : 0
111 color: root.active ? LomiriColors.graphite : LomiriColors.ash
112 visible: parent.containsMouse && !overlayShown
116 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
117 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"
118 color: root.active ? "white" : LomiriColors.slate