on d996949 help sign in
unity8/qml/Components/WindowControlButtons.qml
110 lines 3.2 kB history raw
1/*
2 * Copyright (C) 2014-2015 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17import QtQuick 2.4
18import Ubuntu.Components 1.3
20Row {
21 id: root
22 spacing: units.gu(1)
24 // to be set from outside
25 property bool active: false
26 property bool closeButtonShown: true
28 signal close()
29 signal minimize()
30 signal maximize()
32 MouseArea {
33 id: closeWindowButton
34 objectName: "closeWindowButton"
35 hoverEnabled: true
36 height: parent.height
37 width: height
38 onClicked: root.close()
39 visible: root.closeButtonShown
41 Rectangle {
42 anchors.centerIn: parent
43 width: units.gu(2)
44 height: units.gu(2)
45 radius: height / 2
46 color: UbuntuColors.red
47 visible: parent.containsMouse
48 }
49 Icon {
50 width: height
51 height: parent.height *.5
52 anchors.centerIn: parent
53 source: "graphics/window-close.svg"
54 color: root.active ? "white" : UbuntuColors.slate
55 keyColor: "black"
56 }
57 }
59 MouseArea {
60 id: minimizeWindowButton
61 objectName: "minimizeWindowButton"
62 hoverEnabled: true
63 height: parent.height
64 width: height
65 onClicked: root.minimize()
67 Rectangle {
68 anchors.centerIn: parent
69 width: units.gu(2)
70 height: units.gu(2)
71 radius: height / 2
72 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
73 visible: parent.containsMouse
74 }
75 Icon {
76 width: height
77 height: parent.height *.5
78 anchors.centerIn: parent
79 source: "graphics/window-minimize.svg"
80 color: root.active ? "white" : UbuntuColors.slate
81 keyColor: "black"
82 }
83 }
85 MouseArea {
86 id: maximizeWindowButton
87 objectName: "maximizeWindowButton"
88 hoverEnabled: true
89 height: parent.height
90 width: height
91 onClicked: root.maximize()
93 Rectangle {
94 anchors.centerIn: parent
95 width: units.gu(2)
96 height: units.gu(2)
97 radius: height / 2
98 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
99 visible: parent.containsMouse
100 }
101 Icon {
102 width: height
103 height: parent.height *.5
104 anchors.centerIn: parent
105 source: "graphics/window-maximize.svg"
106 color: root.active ? "white" : UbuntuColors.slate
107 keyColor: "black"
108 }
109 }