2 import Unity.Application 0.1
3 import Ubuntu.Components 1.3
9 property int itemIndex: 0
10 property int nextInStack: 0
11 property int sceneWidth: 0
12 property int sideStageWidth: 0
13 property int sideStageX: sceneWidth
14 property bool animateX: false
16 property int stage: ApplicationInfoInterface.MainStage
17 property var thisDelegate: null
18 property var mainStageDelegate: null
19 property var sideStageDelegate: null
23 // We need to shuffle z ordering a bit in order to keep side stage apps above main stage apps.
24 // We don't want to really reorder them in the model because that allows us to keep track
25 // of the last focused order.
26 readonly property int itemZ: {
27 // only shuffle when we've got a main and side stage
28 if (!sideStageDelegate) return itemIndex;
30 // don't shuffle indexes greater than "actives or next"
31 if (itemIndex > 2) return itemIndex;
33 if (thisDelegate == mainStageDelegate) {
34 // Active main stage always at 0
38 if (nextInStack > 0) {
39 var stageOfNextInStack = appRepeater.itemAt(nextInStack).stage;
41 if (itemIndex === nextInStack) {
42 // this is the next app in stack.
44 if (stage === ApplicationInfoInterface.SideStage) {
45 // if the next app in stack is a sidestage app, it must order on top of other side stage app
46 return Math.min(2, topLevelSurfaceList.count-1);
50 if (stageOfNextInStack === ApplicationInfoInterface.SideStage) {
51 // if the next app in stack is a sidestage app, it must order on top of other side stage app
54 return Math.min(2, topLevelSurfaceList.count-1);
56 return Math.min(index+1, topLevelSurfaceList.count-1);
61 if (mainStageDelegate == thisDelegate) {
64 if (sideStageDelegate == thisDelegate) {
69 Behavior on itemX { enabled: root.animateX; UbuntuNumberAnimation {} }
71 readonly property int itemWidth: stage == ApplicationInfoInterface.MainStage ?
72 sideStageDelegate != null ? sideStageX : sceneWidth :
73 stage == ApplicationInfoInterface.SideStage ? sideStageWidth : sceneWidth