Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / layer-list.h
1 #ifndef __DALI_INTERNAL_LAYER_LIST_H__
2 #define __DALI_INTERNAL_LAYER_LIST_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace SceneGraph
31 {
32 class UpdateManager;
33 }
34
35 class Layer;
36
37 /**
38  * An ordered list of layers.
39  * Layers are not owned by the LayerList; each layer is responsible for registering & unregistering.
40  * This is used by the Stage, to keep track of layer depths.
41  * A separate LayerList is maintained for actors added via the SystemOverlay::Add().
42  */
43 class LayerList
44 {
45 public:
46
47   /**
48    * Create a new list of layers.
49    * @param[in] updateManager A reference to the update manager.
50    * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
51    */
52   static LayerList* New( SceneGraph::UpdateManager& updateManager, bool systemLevel );
53
54   /**
55    * Non-virtual destructor; not suitable as a base class.
56    */
57   ~LayerList();
58
59   /**
60    * Query the number of layers.
61    * @return The number of layers.
62    */
63   unsigned int GetLayerCount() const;
64
65   /**
66    * Retrieve the layer at a specified depth.
67    * @pre depth is less than layer count; see GetLayerCount().
68    * @param[in] depth The depth.
69    * @return The layer found at the given depth.
70    */
71   Layer* GetLayer( unsigned int depth ) const;
72
73   /**
74    * Gets the depth of a given layer
75    * @param layer which depth to check
76    */
77   unsigned int GetDepth( const Layer* layer ) const;
78
79   /**
80    * Register a layer with the stage.
81    * The stage determines the relative depth of each layer.
82    */
83   void RegisterLayer( Layer& layer );
84
85   /**
86    * Unregister a layer from the stage
87    */
88   void UnregisterLayer(Layer& layer);
89
90   /**
91    * Increment the depth of the layer inside the stage
92    * @pre layer is on stage
93    */
94   void RaiseLayer(Layer& layer);
95
96   /**
97    * Decrement the depth of the layer inside the stage
98    * @pre layer is on stage
99    */
100   void LowerLayer(Layer& layer);
101
102   /**
103    * Raises the layer to the top of the stage
104    * @pre layer is on stage
105    * @param layer to move
106    */
107   void RaiseLayerToTop( const Layer& layer );
108
109   /**
110    * Lowers the layer to the bottom of the stage
111    * @pre layer is on stage
112    * @param layer to move
113    */
114   void LowerLayerToBottom( const Layer& layer );
115
116   /**
117    * Moves the layer above the target layer on the stage
118    * @pre layer is on stage
119    * @pre target is on stage
120    * @param layer to move
121    * @param target to move above of
122    */
123   void MoveLayerAbove( const Layer& layer, const Layer& target );
124
125   /**
126    * Moves the layer below the target layer on the stage
127    * @pre layer is on stage
128    * @pre target is on stage
129    * @param layer to move
130    * @param target to move below of
131    */
132   void MoveLayerBelow( const Layer& layer, const Layer& target );
133
134 private:
135
136   /**
137    * Protected constructor; see also LayerList::New().
138    * @param[in] updateManager to send messages.
139    * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
140    */
141   LayerList( SceneGraph::UpdateManager& updateManager, bool systemLevel );
142
143   /**
144    * A private helper method to set the depth for each layer.
145    * Layers have depth which is the same as their ordinal number in the stage container
146    * This method propagates any changes in the layer depths onto the scene graph side
147    */
148   void SetLayerDepths();
149
150 private:
151
152   SceneGraph::UpdateManager& mUpdateManager;
153
154   bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
155
156   typedef std::vector<Layer*> LayerContainer;
157
158   // Layers are not owned by the LayerList.
159   // Each layer is responsible for registering & unregistering before the end of its life-time.
160   LayerContainer mLayers;
161 };
162
163 } // namespace Internal
164
165 } // namespace Dali
166
167 #endif // __DALI_INTERNAL_LAYER_LIST_H__