1 #ifndef __DALI_INTERNAL_LAYER_LIST_H__
2 #define __DALI_INTERNAL_LAYER_LIST_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/vector-wrapper.h>
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().
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.
52 static LayerList* New( SceneGraph::UpdateManager& updateManager, bool systemLevel );
55 * Non-virtual destructor; not suitable as a base class.
60 * Query the number of layers.
61 * @return The number of layers.
63 unsigned int GetLayerCount() const;
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.
71 Layer* GetLayer( unsigned int depth ) const;
74 * Gets the depth of a given layer
75 * @param layer which depth to check
77 unsigned int GetDepth( const Layer* layer ) const;
80 * Register a layer with the stage.
81 * The stage determines the relative depth of each layer.
83 void RegisterLayer( Layer& layer );
86 * Unregister a layer from the stage
88 void UnregisterLayer(Layer& layer);
91 * Increment the depth of the layer inside the stage
92 * @pre layer is on stage
94 void RaiseLayer(Layer& layer);
97 * Decrement the depth of the layer inside the stage
98 * @pre layer is on stage
100 void LowerLayer(Layer& layer);
103 * Raises the layer to the top of the stage
104 * @pre layer is on stage
105 * @param layer to move
107 void RaiseLayerToTop( const Layer& layer );
110 * Lowers the layer to the bottom of the stage
111 * @pre layer is on stage
112 * @param layer to move
114 void LowerLayerToBottom( const Layer& layer );
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
123 void MoveLayerAbove( const Layer& layer, const Layer& target );
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
132 void MoveLayerBelow( const Layer& layer, const Layer& target );
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.
141 LayerList( SceneGraph::UpdateManager& updateManager, bool systemLevel );
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
148 void SetLayerDepths();
152 SceneGraph::UpdateManager& mUpdateManager;
154 bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
156 typedef std::vector<Layer*> LayerContainer;
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;
163 } // namespace Internal
167 #endif // __DALI_INTERNAL_LAYER_LIST_H__