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/>.
16 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
20 import Ubuntu.Components 1.3
21 import Unity.Application 0.1
26 width: applicationWindow.width
27 height: (decorationShown ? decoration.height : 0) + applicationWindow.height
29 property alias window: applicationWindow
30 property alias application: applicationWindow.application
31 property alias active: decoration.active
32 property alias title: decoration.title
33 property alias fullscreen: applicationWindow.fullscreen
35 readonly property bool decorationShown: !fullscreen
36 property bool highlightShown: false
37 property real shadowOpacity: 1
39 property alias requestedWidth: applicationWindow.requestedWidth
40 property real requestedHeight
42 property alias minimumWidth: applicationWindow.minimumWidth
43 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
44 property alias maximumWidth: applicationWindow.maximumWidth
45 readonly property int maximumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.maximumHeight
46 property alias widthIncrement: applicationWindow.widthIncrement
47 property alias heightIncrement: applicationWindow.heightIncrement
52 signal decorationPressed()
55 id: selectionHighlight
57 anchors.margins: -units.gu(1)
59 opacity: highlightShown ? 0.15 : 0
63 anchors { left: selectionHighlight.left; right: selectionHighlight.right; bottom: selectionHighlight.bottom; }
65 color: UbuntuColors.orange
66 visible: highlightShown
72 margins: active ? -units.gu(2) : -units.gu(1.5)
74 source: "graphics/dropshadow2gu.sci"
75 opacity: root.shadowOpacity * .3
82 objectName: application ? "appWindowDecoration_" + application.appId : "appWindowDecoration_null"
83 anchors { left: parent.left; top: parent.top; right: parent.right }
87 visible: root.decorationShown
89 onClose: root.close();
90 onMaximize: { root.decorationPressed(); root.maximize(); }
91 onMinimize: root.minimize();
92 onPressed: root.decorationPressed();
97 objectName: application ? "appWindow_" + application.appId : "appWindow_null"
98 anchors.top: parent.top
99 anchors.topMargin: decoration.height
100 anchors.left: parent.left
101 requestedHeight: root.requestedHeight - (root.decorationShown ? decoration.height : 0)