1 #ifndef DALI_INTERNAL_ACTOR_PARENT_H
2 #define DALI_INTERNAL_ACTOR_PARENT_H
4 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use actor file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include <dali/devel-api/actors/actor-devel.h>
21 #include <dali/internal/common/const-string.h>
22 #include <dali/internal/event/actors/actor-declarations.h>
29 * Interface that enables parenting of actors and managing child sibling order.
35 * Constructor, not to be directly instantiated
37 ActorParent() = default;
40 * Virtual destructor. No deletion through this interface.
42 virtual ~ActorParent() = default;
46 * Adds a child Actor to this Actor.
47 * @pre The child actor is not the same as the parent actor.
48 * @pre The child actor does not already have a parent.
49 * @param [in] child The child.
50 * @param [in] notify Emits notification if set to true. Default is true.
51 * @post The child will be referenced by its parent.
53 virtual void Add(Actor& child, bool notify = true) = 0;
56 * Removes a child Actor from this Actor.
57 * @param [in] child The child.
58 * @param [in] notify Emits notification if set to true. Default is true.
59 * @post The child will be unreferenced.
60 * @note If notify is false, Add() method must be called after this method.
62 virtual void Remove(Actor& child, bool notify = true) = 0;
65 * Retrieve the number of children held by the actor.
66 * @return The number of children
68 virtual uint32_t GetChildCount() const = 0;
71 * @copydoc Dali::Actor::GetChildAt
73 virtual ActorPtr GetChildAt(uint32_t index) const = 0;
76 * @copydoc Dali::Actor::FindChildByName
78 virtual ActorPtr FindChildByName(ConstString actorName) = 0;
81 * @copydoc Dali::Actor::FindChildById
83 virtual ActorPtr FindChildById(const uint32_t id) = 0;
86 * @brief Unparent all the children
88 virtual void UnparentChildren() = 0;
91 * @brief Change the sibling order of the given child.
93 * @param[in] child The actor to change
94 * @param[in] order The new order for the actor
95 * @return true if order has been modified
97 virtual void SetSiblingOrderOfChild(Actor& child, uint32_t order) = 0;
100 * @brief Get the sibling order of the given actor.
102 * @param[in] child The actor to query
103 * @return the order in the sibling array of the actor
105 virtual uint32_t GetSiblingOrderOfChild(const Actor& child) const = 0;
108 * @brief Raise the actor within the siblings list by one
110 * @param[in] child The actor to move
111 * @return true if order has been modified
113 virtual void RaiseChild(Actor& child) = 0;
116 * @brief Lower the actor within the siblings list by one
118 * @param[in] child The actor to move
119 * @return true if order has been modified
121 virtual void LowerChild(Actor& child) = 0;
124 * @brief Raise the actor to the top of the siblings list.
126 * @param[in] child The actor to move
127 * @return true if order has been modified
129 virtual void RaiseChildToTop(Actor& child) = 0;
132 * @brief Lower the actor to the bottom of the siblings list.
134 * @param[in] child The actor to move
135 * @return true if order has been modified
137 virtual void LowerChildToBottom(Actor& child) = 0;
140 * @brief Raise the actor above the target actor within the siblings list.
142 * @param[in] child The actor to move
143 * @param[in] target The target actor
144 * @return true if order has been modified
146 virtual void RaiseChildAbove(Actor& child, Actor& target) = 0;
149 * @brief Lower the actor below the target actor within the siblings list.
151 * @param[in] child The actor to move
152 * @param[in] target The target actor
153 * @return true if order has been modified
155 virtual void LowerChildBelow(Actor& child, Actor& target) = 0;
158 } // namespace Internal