Refactored out actor render container
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-parent.h
1 #ifndef DALI_INTERNAL_ACTOR_PARENT_H
2 #define DALI_INTERNAL_ACTOR_PARENT_H
3 /*
4  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 // INTERNAL INCLUDES
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>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 /**
29  * Interface that enables parenting of actors and managing child sibling order.
30  */
31 class ActorParent
32 {
33 protected:
34   /**
35    * Constructor, not to be directly instantiated
36    */
37   ActorParent() = default;
38
39   /**
40    * Virtual destructor. No deletion through this interface.
41    */
42   virtual ~ActorParent() = default;
43
44 public:
45   /**
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.
52    */
53   virtual void Add(Actor& child, bool notify = true) = 0;
54
55   /**
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.
61    */
62   virtual void Remove(Actor& child, bool notify = true) = 0;
63
64   /**
65    * Retrieve the number of children held by the actor.
66    * @return The number of children
67    */
68   virtual uint32_t GetChildCount() const = 0;
69
70   /**
71    * @copydoc Dali::Actor::GetChildAt
72    */
73   virtual ActorPtr GetChildAt(uint32_t index) const = 0;
74
75   /**
76    * @copydoc Dali::Actor::FindChildByName
77    */
78   virtual ActorPtr FindChildByName(ConstString actorName) = 0;
79
80   /**
81    * @copydoc Dali::Actor::FindChildById
82    */
83   virtual ActorPtr FindChildById(const uint32_t id) = 0;
84
85   /**
86    * @brief Unparent all the children
87    */
88   virtual void UnparentChildren() = 0;
89
90   /**
91    * @brief Change the sibling order of the given child.
92    *
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
96    */
97   virtual void SetSiblingOrderOfChild(Actor& child, uint32_t order) = 0;
98
99   /**
100    * @brief Get the sibling order of the given actor.
101    *
102    * @param[in] child The actor to query
103    * @return the order in the sibling array of the actor
104    */
105   virtual uint32_t GetSiblingOrderOfChild(const Actor& child) const = 0;
106
107   /**
108    * @brief Raise the actor within the siblings list by one
109
110    * @param[in] child The actor to move
111    * @return true if order has been modified
112    */
113   virtual void RaiseChild(Actor& child) = 0;
114
115   /**
116    * @brief Lower the actor within the siblings list by one
117
118    * @param[in] child The actor to move
119    * @return true if order has been modified
120    */
121   virtual void LowerChild(Actor& child) = 0;
122
123   /**
124    * @brief Raise the actor to the top of the siblings list.
125    *
126    * @param[in] child The actor to move
127    * @return true if order has been modified
128    */
129   virtual void RaiseChildToTop(Actor& child) = 0;
130
131   /**
132    * @brief Lower the actor to the bottom of the siblings list.
133    *
134    * @param[in] child The actor to move
135    * @return true if order has been modified
136    */
137   virtual void LowerChildToBottom(Actor& child) = 0;
138
139   /**
140    * @brief Raise the actor above the target actor within the siblings list.
141    *
142    * @param[in] child The actor to move
143    * @param[in] target The target actor
144    * @return true if order has been modified
145    */
146   virtual void RaiseChildAbove(Actor& child, Actor& target) = 0;
147
148   /**
149    * @brief Lower the actor below the target actor within the siblings list.
150    *
151    * @param[in] child The actor to move
152    * @param[in] target The target actor
153    * @return true if order has been modified
154    */
155   virtual void LowerChildBelow(Actor& child, Actor& target) = 0;
156 };
157
158 } // namespace Internal
159
160 } // namespace Dali
161
162 #endif