1 #ifndef DALI_INTERNAL_LAYER_LIST_H
2 #define DALI_INTERNAL_LAYER_LIST_H
5 * Copyright (c) 2019 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 <cstdint> // uint32_t
25 #include <dali/public-api/common/vector-wrapper.h>
41 * An ordered list of layers.
42 * Layers are not owned by the LayerList; each layer is responsible for registering & unregistering.
43 * This is used by the Stage, to keep track of layer depths.
50 * Create a new list of layers.
51 * @param[in] updateManager A reference to the update manager.
53 static LayerList* New( SceneGraph::UpdateManager& updateManager );
56 * Non-virtual destructor; not suitable as a base class.
61 * Query the number of layers.
62 * @return The number of layers.
64 uint32_t GetLayerCount() const;
67 * Retrieve the layer at a specified depth.
68 * @pre depth is less than layer count; see GetLayerCount().
69 * @param[in] depth The depth.
70 * @return The layer found at the given depth.
72 Layer* GetLayer( uint32_t depth ) const;
75 * Gets the depth of a given layer
76 * @param layer which depth to check
78 uint32_t GetDepth( const Layer* layer ) const;
81 * Register a layer with the stage.
82 * The stage determines the relative depth of each layer.
84 void RegisterLayer( Layer& layer );
87 * Unregister a layer from the stage
89 void UnregisterLayer(Layer& layer);
92 * Increment the depth of the layer inside the stage
93 * @pre layer is on stage
95 void RaiseLayer(Layer& layer);
98 * Decrement the depth of the layer inside the stage
99 * @pre layer is on stage
101 void LowerLayer(Layer& layer);
104 * Raises the layer to the top of the stage
105 * @pre layer is on stage
106 * @param layer to move
108 void RaiseLayerToTop( const Layer& layer );
111 * Lowers the layer to the bottom of the stage
112 * @pre layer is on stage
113 * @param layer to move
115 void LowerLayerToBottom( const Layer& layer );
118 * Moves the layer above the target layer on the stage
119 * @pre layer is on stage
120 * @pre target is on stage
121 * @param layer to move
122 * @param target to move above of
124 void MoveLayerAbove( const Layer& layer, const Layer& target );
127 * Moves the layer below the target layer on the stage
128 * @pre layer is on stage
129 * @pre target is on stage
130 * @param layer to move
131 * @param target to move below of
133 void MoveLayerBelow( const Layer& layer, const Layer& target );
136 * Sets the root layer that this layer list belongs to
137 * @pre the root layer is created
138 * @param rootLayer The root layer
140 void SetRootLayer(Layer* rootLayer);
145 * Protected constructor; see also LayerList::New().
146 * @param[in] updateManager to send messages.
148 LayerList( SceneGraph::UpdateManager& updateManager );
151 * A private helper method to set the depth for each layer.
152 * Layers have depth which is the same as their ordinal number in the stage container
153 * This method propagates any changes in the layer depths onto the scene graph side
155 void SetLayerDepths();
159 SceneGraph::UpdateManager& mUpdateManager;
161 Layer* mRoot; ///< The root layer that this ordered list of layers belong to
163 typedef std::vector<Layer*> LayerContainer;
165 // Layers are not owned by the LayerList.
166 // Each layer is responsible for registering & unregistering before the end of its life-time.
167 LayerContainer mLayers;
170 } // namespace Internal
174 #endif // DALI_INTERNAL_LAYER_LIST_H