2 * Copyright (C) 2015-2016 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 Ubuntu.Components 1.3
19 import GlobalShortcut 1.0
25 // Controls to be set from outside
26 property QtObject applicationManager
27 property QtObject topLevelSurfaceList
28 property bool altTabPressed
29 property url background
30 property bool beingResized
31 property int dragAreaWidth
32 property real dragProgress // How far left the stage has been dragged, used externally by tutorial code
33 property bool interactive
34 property real inverseProgress // This is the progress for left edge drags, in pixels.
35 property bool keepDashRunning: true
36 property real maximizedAppTopMargin
37 property real nativeHeight
38 property real nativeWidth
39 property QtObject orientations
40 property int shellOrientation
41 property int shellOrientationAngle
42 property bool spreadEnabled: true // If false, animations and right edge will be disabled
43 property bool suspended
44 // A Stage should paint a wallpaper etc over its full size but not use the margins for window placement
45 property int leftMargin: 0
46 property alias paintBackground: background.visible
47 property bool oskEnabled: false
49 // To be read from outside
50 property var mainApp: null
51 property int mainAppWindowOrientationAngle: 0
52 property bool orientationChangesEnabled
53 property int supportedOrientations: Qt.PortraitOrientation
54 | Qt.LandscapeOrientation
55 | Qt.InvertedPortraitOrientation
56 | Qt.InvertedLandscapeOrientation
58 property Item itemConfiningMouseCursor: null
61 signal stageAboutToBeUnloaded
62 signal itemSnapshotRequested(Item item)
64 // Shared code for use in stage implementations
66 id: lifecycleExceptions
67 schema.id: "com.canonical.qtmir"
70 function isExemptFromLifecycle(appId) {
71 var shortAppId = appId.split('_')[0];
72 for (var i = 0; i < lifecycleExceptions.lifecycleExemptAppids.length; i++) {
73 if (shortAppId === lifecycleExceptions.lifecycleExemptAppids[i]) {
86 // shared Alt+F4 functionality
87 function closeFocusedDelegate() {} // to be implemented by stages
90 shortcut: Qt.AltModifier|Qt.Key_F4
91 onTriggered: closeFocusedDelegate()