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/>.
18 import Ubuntu.Components 1.3
22 spacing: overlayShown ? units.gu(2) : units.gu(1)
24 UbuntuNumberAnimation {}
27 // to be set from outside
29 property bool active: false
30 property bool windowIsMaximized: false
31 property bool closeButtonShown: true
32 property bool overlayShown
35 signal minimizeClicked()
36 signal maximizeClicked()
37 signal maximizeVerticallyClicked()
38 signal maximizeHorizontallyClicked()
42 objectName: "closeWindowButton"
46 onClicked: root.closeClicked()
47 visible: root.closeButtonShown
52 color: theme.palette.normal.negative
53 visible: parent.containsMouse && !overlayShown
57 anchors.margins: units.dp(3)
58 source: "graphics/window-close.svg"
59 color: root.active ? "white" : UbuntuColors.slate
64 id: minimizeWindowButton
65 objectName: "minimizeWindowButton"
69 onClicked: root.minimizeClicked()
74 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
75 visible: parent.containsMouse && !overlayShown
79 anchors.margins: units.dp(3)
80 source: "graphics/window-minimize.svg"
81 color: root.active ? "white" : UbuntuColors.slate
86 id: maximizeWindowButton
87 objectName: "maximizeWindowButton"
91 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
93 if (mouse.button == Qt.LeftButton) {
94 root.maximizeClicked();
95 } else if (mouse.button == Qt.RightButton) {
96 root.maximizeHorizontallyClicked();
97 } else if (mouse.button == Qt.MiddleButton) {
98 root.maximizeVerticallyClicked();
105 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
106 visible: parent.containsMouse && !overlayShown
110 anchors.margins: units.dp(3)
111 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"
112 color: root.active ? "white" : UbuntuColors.slate