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"
27 property alias title: titleLabel.text
28 property bool active: false
37 property real distanceX
38 property real distanceY
39 property bool dragging
44 var pos = mapToItem(root.target, mouseX, mouseY);
45 priv.distanceX = pos.x;
46 priv.distanceY = pos.y;
48 Mir.cursorName = "grabbing";
50 priv.dragging = false;
56 var pos = mapToItem(root.target.parent, mouseX, mouseY);
57 root.target.x = pos.x - priv.distanceX;
58 root.target.y = pos.y - priv.distanceY;
64 anchors.bottomMargin: -radius
67 GradientStop { color: "#626055"; position: 0 }
68 GradientStop { color: "#3C3B37"; position: 1 }
73 anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }
75 opacity: root.active ? 1 : 0.5
77 WindowControlButtons {
79 onClose: root.close();
80 onMinimize: root.minimize();
81 onMaximize: root.maximize();
86 objectName: "windowDecorationTitle"
89 verticalAlignment: Text.AlignVCenter