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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/common/vector-wrapper.h>
33 * An ordered list of layers.
34 * Layers are not owned by the LayerList; each layer is responsible for registering & unregistering.
35 * This is used by the Stage, to keep track of layer depths.
36 * A separate LayerList is maintained for actors added via the SystemOverlay::Add().
43 * Create a new list of layers.
44 * @param[in] stage A reference to the stage.
45 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
47 static LayerList* New( Stage& stage, bool systemLevel );
50 * Non-virtual destructor; not suitable as a base class.
55 * Query the number of layers.
56 * @return The number of layers.
58 unsigned int GetLayerCount() const;
61 * Retrieve the layer at a specified depth.
62 * @pre depth is less than layer count; see GetLayerCount().
63 * @param[in] depth The depth.
64 * @return The layer found at the given depth.
66 Layer* GetLayer( unsigned int depth ) const;
69 * Gets the depth of a given layer
70 * @param layer which depth to check
72 unsigned int GetDepth( const Layer* layer ) const;
75 * Register a layer with the stage.
76 * The stage determines the relative depth of each layer.
78 void RegisterLayer( Layer& layer );
81 * Unregister a layer from the stage
83 void UnregisterLayer(Layer& layer);
86 * Increment the depth of the layer inside the stage
87 * @pre layer is on stage
89 void RaiseLayer(Layer& layer);
92 * Decrement the depth of the layer inside the stage
93 * @pre layer is on stage
95 void LowerLayer(Layer& layer);
98 * Raises the layer to the top of the stage
99 * @pre layer is on stage
100 * @param layer to move
102 void RaiseLayerToTop( const Layer& layer );
105 * Lowers the layer to the bottom of the stage
106 * @pre layer is on stage
107 * @param layer to move
109 void LowerLayerToBottom( const Layer& layer );
112 * Moves the layer above the target layer on the stage
113 * @pre layer is on stage
114 * @pre target is on stage
115 * @param layer to move
116 * @param target to move above of
118 void MoveLayerAbove( const Layer& layer, const Layer& target );
121 * Moves the layer below the target layer on the stage
122 * @pre layer is on stage
123 * @pre target is on stage
124 * @param layer to move
125 * @param target to move below of
127 void MoveLayerBelow( const Layer& layer, const Layer& target );
132 * Protected constructor; see also LayerList::New().
133 * @param[in] stage A reference to the stage.
134 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
136 LayerList( Stage& stage, bool systemLevel );
139 * A private helper method to set the depth for each layer.
140 * Layers have depth which is the same as their ordinal number in the stage container
141 * This method propagates any changes in the layer depths onto the scene graph side
143 void SetLayerDepths();
149 bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
151 typedef std::vector<Layer*> LayerContainer;
153 // Layers are not owned by the LayerList.
154 // Each layer is responsible for registering & unregistering before the end of its life-time.
155 LayerContainer mLayers;
158 } // namespace Internal
162 #endif // __DALI_INTERNAL_LAYER_LIST_H__