2 * Copyright (C) 2014-2015 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
24 // to be set from outside
25 property bool active: false
26 property bool closeButtonShown: true
29 signal minimizeClicked()
30 signal maximizeClicked()
31 signal maximizeVerticallyClicked()
32 signal maximizeHorizontallyClicked()
36 objectName: "closeWindowButton"
40 onClicked: root.closeClicked()
41 visible: root.closeButtonShown
44 anchors.centerIn: parent
48 color: theme.palette.normal.negative
49 visible: parent.containsMouse
53 height: parent.height *.5
54 anchors.centerIn: parent
55 source: "graphics/window-close.svg"
56 color: root.active ? "white" : UbuntuColors.slate
62 id: minimizeWindowButton
63 objectName: "minimizeWindowButton"
67 onClicked: root.minimizeClicked()
70 anchors.centerIn: parent
74 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
75 visible: parent.containsMouse
79 height: parent.height *.5
80 anchors.centerIn: parent
81 source: "graphics/window-minimize.svg"
82 color: root.active ? "white" : UbuntuColors.slate
88 id: maximizeWindowButton
89 objectName: "maximizeWindowButton"
93 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
95 if (mouse.button == Qt.LeftButton) {
96 root.maximizeClicked();
97 } else if (mouse.button == Qt.RightButton) {
98 root.maximizeHorizontallyClicked();
99 } else if (mouse.button == Qt.MiddleButton) {
100 root.maximizeVerticallyClicked();
105 anchors.centerIn: parent
109 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
110 visible: parent.containsMouse
114 height: parent.height *.5
115 anchors.centerIn: parent
116 source: "graphics/window-maximize.svg"
117 color: root.active ? "white" : UbuntuColors.slate