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.1
21 import Unity.Application 0.1
26 property alias window: applicationWindow
27 property alias application: applicationWindow.application
28 property alias active: decoration.active
30 property bool decorationShown: true
31 property bool highlightShown: false
32 property real shadowOpacity: 1
34 property int windowWidth: width
35 property int windowHeight: height
54 target: applicationWindow
55 itemScale: Math.max(root.width / root.windowWidth, root.height / root.windowHeight)
70 source: "graphics/dropshadow2gu.sci"
71 opacity: root.shadowOpacity * .3
75 id: selectionHighlight
77 anchors.margins: -units.gu(1)
79 opacity: highlightShown ? 0.15 : 0
83 anchors { left: selectionHighlight.left; right: selectionHighlight.right; bottom: selectionHighlight.bottom; }
85 color: UbuntuColors.orange
86 visible: root.highlightShown
91 objectName: application ? "appWindowDecoration_" + application.appId : "appWindowDecoration_null"
92 anchors { left: parent.left; top: parent.top; right: parent.right }
95 onClose: root.close();
96 onMaximize: root.maximize();
97 onMinimize: root.minimize();
98 visible: decorationShown
106 id: applicationWindow
107 objectName: application ? "appWindow_" + application.appId : "appWindow_null"
108 anchors.top: parent.top
109 anchors.topMargin: root.decorationShown ? decoration.height : 0
110 anchors.left: parent.left
111 width: root.windowWidth
112 height: root.windowHeight - (root.decorationShown ? decoration.height : 0)
116 property real itemScale: 1
119 origin.x: 0; origin.y: 0
120 xScale: applicationWindow.itemScale
121 yScale: applicationWindow.itemScale