on 01f899f help sign in
unity8/qml/Components/WindowControlButtons.qml
108 lines 3.0 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
27 signal close()
28 signal minimize()
29 signal maximize()
31 MouseArea {
32 id: closeWindowButton
33 objectName: "closeWindowButton"
34 hoverEnabled: true
35 height: parent.height
36 width: height
37 onClicked: root.close()
39 Rectangle {
40 anchors.centerIn: parent
41 width: units.gu(2)
42 height: units.gu(2)
43 radius: height / 2
44 color: "#ed3146"
45 visible: parent.containsMouse
46 }
47 Icon {
48 width: height
49 height: parent.height *.5
50 anchors.centerIn: parent
51 source: "graphics/window-close.svg"
52 color: root.active ? "white" : "#5d5d5d"
53 keyColor: "black"
54 }
55 }
57 MouseArea {
58 id: minimizeWindowButton
59 objectName: "minimizeWindowButton"
60 hoverEnabled: true
61 height: parent.height
62 width: height
63 onClicked: root.minimize()
65 Rectangle {
66 anchors.centerIn: parent
67 width: units.gu(2)
68 height: units.gu(2)
69 radius: height / 2
70 color: "#888888"
71 visible: parent.containsMouse
72 }
73 Icon {
74 width: height
75 height: parent.height *.5
76 anchors.centerIn: parent
77 source: "graphics/window-minimize.svg"
78 color: root.active ? "white" : "#5d5d5d"
79 keyColor: "black"
80 }
81 }
83 MouseArea {
84 id: maximizeWindowButton
85 objectName: "maximizeWindowButton"
86 hoverEnabled: true
87 height: parent.height
88 width: height
89 onClicked: root.maximize()
91 Rectangle {
92 anchors.centerIn: parent
93 width: units.gu(2)
94 height: units.gu(2)
95 radius: height / 2
96 color: "#888888"
97 visible: parent.containsMouse
98 }
99 Icon {
100 width: height
101 height: parent.height *.5
102 anchors.centerIn: parent
103 source: "graphics/window-maximize.svg"
104 color: root.active ? "white" : "#5d5d5d"
105 keyColor: "black"
106 }
107 }