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>
34 * An ordered list of layers.
35 * Layers are not owned by the LayerList; each layer is responsible for registering & unregistering.
36 * This is used by the Stage, to keep track of layer depths.
37 * A separate LayerList is maintained for actors added via the SystemOverlay::Add().
44 * Create a new list of layers.
45 * @param[in] stage A reference to the stage.
46 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
48 static LayerList* New( Stage& stage, bool systemLevel );
51 * Non-virtual destructor; not suitable as a base class.
56 * Query the number of layers.
57 * @return The number of layers.
59 unsigned int GetLayerCount() const;
62 * Retrieve the layer at a specified depth.
63 * @pre depth is less than layer count; see GetLayerCount().
64 * @param[in] depth The depth.
65 * @return The layer found at the given depth.
67 Layer* GetLayer( unsigned int depth ) const;
70 * Gets the depth of a given layer
71 * @param layer which depth to check
73 unsigned int GetDepth( const Layer* layer ) const;
76 * Register a layer with the stage.
77 * The stage determines the relative depth of each layer.
79 void RegisterLayer( Layer& layer );
82 * Unregister a layer from the stage
84 void UnregisterLayer(Layer& layer);
87 * Increment the depth of the layer inside the stage
88 * @pre layer is on stage
90 void RaiseLayer(Layer& layer);
93 * Decrement the depth of the layer inside the stage
94 * @pre layer is on stage
96 void LowerLayer(Layer& layer);
99 * Raises the layer to the top of the stage
100 * @pre layer is on stage
101 * @param layer to move
103 void RaiseLayerToTop( const Layer& layer );
106 * Lowers the layer to the bottom of the stage
107 * @pre layer is on stage
108 * @param layer to move
110 void LowerLayerToBottom( const Layer& layer );
113 * Moves the layer above the target layer on the stage
114 * @pre layer is on stage
115 * @pre target is on stage
116 * @param layer to move
117 * @param target to move above of
119 void MoveLayerAbove( const Layer& layer, const Layer& target );
122 * Moves the layer below the target layer on the stage
123 * @pre layer is on stage
124 * @pre target is on stage
125 * @param layer to move
126 * @param target to move below of
128 void MoveLayerBelow( const Layer& layer, const Layer& target );
133 * Protected constructor; see also LayerList::New().
134 * @param[in] stage A reference to the stage.
135 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
137 LayerList( Stage& stage, bool systemLevel );
140 * A private helper method to set the depth for each layer.
141 * Layers have depth which is the same as their ordinal number in the stage container
142 * This method propagates any changes in the layer depths onto the scene graph side
144 void SetLayerDepths();
150 bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
152 typedef std::vector<Layer*> LayerContainer;
154 // Layers are not owned by the LayerList.
155 // Each layer is responsible for registering & unregistering before the end of its life-time.
156 LayerContainer mLayers;
159 } // namespace Internal
163 #endif // __DALI_INTERNAL_LAYER_LIST_H__