1 #ifndef __DALI_INTERNAL_LAYER_LIST_H__
2 #define __DALI_INTERNAL_LAYER_LIST_H__
5 * Copyright (c) 2018 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.
44 * A separate LayerList is maintained for actors added via the SystemOverlay::Add().
51 * Create a new list of layers.
52 * @param[in] updateManager A reference to the update manager.
54 static LayerList* New( SceneGraph::UpdateManager& updateManager );
57 * Non-virtual destructor; not suitable as a base class.
62 * Query the number of layers.
63 * @return The number of layers.
65 uint32_t GetLayerCount() const;
68 * Retrieve the layer at a specified depth.
69 * @pre depth is less than layer count; see GetLayerCount().
70 * @param[in] depth The depth.
71 * @return The layer found at the given depth.
73 Layer* GetLayer( uint32_t depth ) const;
76 * Gets the depth of a given layer
77 * @param layer which depth to check
79 uint32_t GetDepth( const Layer* layer ) const;
82 * Register a layer with the stage.
83 * The stage determines the relative depth of each layer.
85 void RegisterLayer( Layer& layer );
88 * Unregister a layer from the stage
90 void UnregisterLayer(Layer& layer);
93 * Increment the depth of the layer inside the stage
94 * @pre layer is on stage
96 void RaiseLayer(Layer& layer);
99 * Decrement the depth of the layer inside the stage
100 * @pre layer is on stage
102 void LowerLayer(Layer& layer);
105 * Raises the layer to the top of the stage
106 * @pre layer is on stage
107 * @param layer to move
109 void RaiseLayerToTop( const Layer& layer );
112 * Lowers the layer to the bottom of the stage
113 * @pre layer is on stage
114 * @param layer to move
116 void LowerLayerToBottom( const Layer& layer );
119 * Moves the layer above the target layer on the stage
120 * @pre layer is on stage
121 * @pre target is on stage
122 * @param layer to move
123 * @param target to move above of
125 void MoveLayerAbove( const Layer& layer, const Layer& target );
128 * Moves the layer below the target layer on the stage
129 * @pre layer is on stage
130 * @pre target is on stage
131 * @param layer to move
132 * @param target to move below of
134 void MoveLayerBelow( const Layer& layer, const Layer& target );
137 * Sets the root layer that this layer list belongs to
138 * @pre the root layer is created
139 * @param rootLayer The root layer
141 void SetRootLayer(Layer* rootLayer);
146 * Protected constructor; see also LayerList::New().
147 * @param[in] updateManager to send messages.
149 LayerList( SceneGraph::UpdateManager& updateManager );
152 * A private helper method to set the depth for each layer.
153 * Layers have depth which is the same as their ordinal number in the stage container
154 * This method propagates any changes in the layer depths onto the scene graph side
156 void SetLayerDepths();
160 SceneGraph::UpdateManager& mUpdateManager;
162 Layer* mRoot; ///< The root layer that this ordered list of layers belong to
164 typedef std::vector<Layer*> LayerContainer;
166 // Layers are not owned by the LayerList.
167 // Each layer is responsible for registering & unregistering before the end of its life-time.
168 LayerContainer mLayers;
171 } // namespace Internal
175 #endif // __DALI_INTERNAL_LAYER_LIST_H__