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.
53 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
55 static LayerList* New( SceneGraph::UpdateManager& updateManager, bool systemLevel );
58 * Non-virtual destructor; not suitable as a base class.
63 * Query the number of layers.
64 * @return The number of layers.
66 uint32_t GetLayerCount() const;
69 * Retrieve the layer at a specified depth.
70 * @pre depth is less than layer count; see GetLayerCount().
71 * @param[in] depth The depth.
72 * @return The layer found at the given depth.
74 Layer* GetLayer( uint32_t depth ) const;
77 * Gets the depth of a given layer
78 * @param layer which depth to check
80 uint32_t GetDepth( const Layer* layer ) const;
83 * Register a layer with the stage.
84 * The stage determines the relative depth of each layer.
86 void RegisterLayer( Layer& layer );
89 * Unregister a layer from the stage
91 void UnregisterLayer(Layer& layer);
94 * Increment the depth of the layer inside the stage
95 * @pre layer is on stage
97 void RaiseLayer(Layer& layer);
100 * Decrement the depth of the layer inside the stage
101 * @pre layer is on stage
103 void LowerLayer(Layer& layer);
106 * Raises the layer to the top of the stage
107 * @pre layer is on stage
108 * @param layer to move
110 void RaiseLayerToTop( const Layer& layer );
113 * Lowers the layer to the bottom of the stage
114 * @pre layer is on stage
115 * @param layer to move
117 void LowerLayerToBottom( const Layer& layer );
120 * Moves the layer above the target layer on the stage
121 * @pre layer is on stage
122 * @pre target is on stage
123 * @param layer to move
124 * @param target to move above of
126 void MoveLayerAbove( const Layer& layer, const Layer& target );
129 * Moves the layer below the target layer on the stage
130 * @pre layer is on stage
131 * @pre target is on stage
132 * @param layer to move
133 * @param target to move below of
135 void MoveLayerBelow( const Layer& layer, const Layer& target );
140 * Protected constructor; see also LayerList::New().
141 * @param[in] updateManager to send messages.
142 * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
144 LayerList( SceneGraph::UpdateManager& updateManager, bool systemLevel );
147 * A private helper method to set the depth for each layer.
148 * Layers have depth which is the same as their ordinal number in the stage container
149 * This method propagates any changes in the layer depths onto the scene graph side
151 void SetLayerDepths();
155 SceneGraph::UpdateManager& mUpdateManager;
157 bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
159 typedef std::vector<Layer*> LayerContainer;
161 // Layers are not owned by the LayerList.
162 // Each layer is responsible for registering & unregistering before the end of its life-time.
163 LayerContainer mLayers;
166 } // namespace Internal
170 #endif // __DALI_INTERNAL_LAYER_LIST_H__