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 Unity.Application 0.1 // For Mir singleton
19 import Ubuntu.Components 1.3
20 import "../Components"
21 import "../Components/PanelState"
28 property alias title: titleLabel.text
29 property bool active: false
36 onDoubleClicked: root.maximize()
40 property real distanceX
41 property real distanceY
42 property bool dragging
47 var pos = mapToItem(root.target, mouseX, mouseY);
48 priv.distanceX = pos.x;
49 priv.distanceY = pos.y;
52 priv.dragging = false;
59 Mir.cursorName = "grabbing";
60 var pos = mapToItem(root.target.parent, mouseX, mouseY);
61 root.target.x = pos.x - priv.distanceX;
62 root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
68 anchors.bottomMargin: -radius
70 color: theme.palette.normal.background
76 leftMargin: units.gu(1)
77 rightMargin: units.gu(1)
78 topMargin: units.gu(0.5)
79 bottomMargin: units.gu(0.5)
83 WindowControlButtons {
87 onClose: root.close();
88 onMinimize: root.minimize();
89 onMaximize: root.maximize();
94 objectName: "windowDecorationTitle"
95 color: root.active ? "white" : "#5d5d5d"
97 width: parent.width - buttons.width - parent.anchors.rightMargin - parent.anchors.leftMargin
98 verticalAlignment: Text.AlignVCenter
100 font.weight: root.active ? Font.Light : Font.Normal
101 elide: Text.ElideRight