Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / devel-api / actors / actor-devel.h
1 #ifndef DALI_ACTOR_DEVEL_H
2 #define DALI_ACTOR_DEVEL_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/math/rect.h>
24
25 namespace Dali
26 {
27
28 namespace DevelActor
29 {
30
31 namespace Property
32 {
33
34 enum Type
35 {
36   PARENT_ORIGIN               = Dali::Actor::Property::PARENT_ORIGIN,
37   PARENT_ORIGIN_X             = Dali::Actor::Property::PARENT_ORIGIN_X,
38   PARENT_ORIGIN_Y             = Dali::Actor::Property::PARENT_ORIGIN_Y,
39   PARENT_ORIGIN_Z             = Dali::Actor::Property::PARENT_ORIGIN_Z,
40   ANCHOR_POINT                = Dali::Actor::Property::ANCHOR_POINT,
41   ANCHOR_POINT_X              = Dali::Actor::Property::ANCHOR_POINT_X,
42   ANCHOR_POINT_Y              = Dali::Actor::Property::ANCHOR_POINT_Y,
43   ANCHOR_POINT_Z              = Dali::Actor::Property::ANCHOR_POINT_Z,
44   SIZE                        = Dali::Actor::Property::SIZE,
45   SIZE_WIDTH                  = Dali::Actor::Property::SIZE_WIDTH,
46   SIZE_HEIGHT                 = Dali::Actor::Property::SIZE_HEIGHT,
47   SIZE_DEPTH                  = Dali::Actor::Property::SIZE_DEPTH,
48   POSITION                    = Dali::Actor::Property::POSITION,
49   POSITION_X                  = Dali::Actor::Property::POSITION_X,
50   POSITION_Y                  = Dali::Actor::Property::POSITION_Y,
51   POSITION_Z                  = Dali::Actor::Property::POSITION_Z,
52   WORLD_POSITION              = Dali::Actor::Property::WORLD_POSITION,
53   WORLD_POSITION_X            = Dali::Actor::Property::WORLD_POSITION_X,
54   WORLD_POSITION_Y            = Dali::Actor::Property::WORLD_POSITION_Y,
55   WORLD_POSITION_Z            = Dali::Actor::Property::WORLD_POSITION_Z,
56   ORIENTATION                 = Dali::Actor::Property::ORIENTATION,
57   WORLD_ORIENTATION           = Dali::Actor::Property::WORLD_ORIENTATION,
58   SCALE                       = Dali::Actor::Property::SCALE,
59   SCALE_X                     = Dali::Actor::Property::SCALE_X,
60   SCALE_Y                     = Dali::Actor::Property::SCALE_Y,
61   SCALE_Z                     = Dali::Actor::Property::SCALE_Z,
62   WORLD_SCALE                 = Dali::Actor::Property::WORLD_SCALE,
63   VISIBLE                     = Dali::Actor::Property::VISIBLE,
64   COLOR                       = Dali::Actor::Property::COLOR,
65   COLOR_RED                   = Dali::Actor::Property::COLOR_RED,
66   COLOR_GREEN                 = Dali::Actor::Property::COLOR_GREEN,
67   COLOR_BLUE                  = Dali::Actor::Property::COLOR_BLUE,
68   COLOR_ALPHA                 = Dali::Actor::Property::COLOR_ALPHA,
69   WORLD_COLOR                 = Dali::Actor::Property::WORLD_COLOR,
70   WORLD_MATRIX                = Dali::Actor::Property::WORLD_MATRIX,
71   NAME                        = Dali::Actor::Property::NAME,
72   SENSITIVE                   = Dali::Actor::Property::SENSITIVE,
73   LEAVE_REQUIRED              = Dali::Actor::Property::LEAVE_REQUIRED,
74   INHERIT_ORIENTATION         = Dali::Actor::Property::INHERIT_ORIENTATION,
75   INHERIT_SCALE               = Dali::Actor::Property::INHERIT_SCALE,
76   COLOR_MODE                  = Dali::Actor::Property::COLOR_MODE,
77   DRAW_MODE                   = Dali::Actor::Property::DRAW_MODE,
78   SIZE_MODE_FACTOR            = Dali::Actor::Property::SIZE_MODE_FACTOR,
79   WIDTH_RESIZE_POLICY         = Dali::Actor::Property::WIDTH_RESIZE_POLICY,
80   HEIGHT_RESIZE_POLICY        = Dali::Actor::Property::HEIGHT_RESIZE_POLICY,
81   SIZE_SCALE_POLICY           = Dali::Actor::Property::SIZE_SCALE_POLICY,
82   WIDTH_FOR_HEIGHT            = Dali::Actor::Property::WIDTH_FOR_HEIGHT,
83   HEIGHT_FOR_WIDTH            = Dali::Actor::Property::HEIGHT_FOR_WIDTH,
84   PADDING                     = Dali::Actor::Property::PADDING,
85   MINIMUM_SIZE                = Dali::Actor::Property::MINIMUM_SIZE,
86   MAXIMUM_SIZE                = Dali::Actor::Property::MAXIMUM_SIZE,
87   INHERIT_POSITION            = Dali::Actor::Property::INHERIT_POSITION,
88   CLIPPING_MODE               = Dali::Actor::Property::CLIPPING_MODE,
89   LAYOUT_DIRECTION            = Dali::Actor::Property::LAYOUT_DIRECTION,
90   INHERIT_LAYOUT_DIRECTION    = Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION,
91   OPACITY                     = Dali::Actor::Property::OPACITY,
92   SCREEN_POSITION             = Dali::Actor::Property::SCREEN_POSITION,
93   POSITION_USES_ANCHOR_POINT  = Dali::Actor::Property::POSITION_USES_ANCHOR_POINT,
94   CULLED                      = Dali::Actor::Property::CULLED,
95   ID                          = Dali::Actor::Property::ID,
96   HIERARCHY_DEPTH             = Dali::Actor::Property::HIERARCHY_DEPTH,
97   IS_ROOT                     = Dali::Actor::Property::IS_ROOT,
98   IS_LAYER                    = Dali::Actor::Property::IS_LAYER,
99   CONNECTED_TO_SCENE          = Dali::Actor::Property::CONNECTED_TO_SCENE,
100   KEYBOARD_FOCUSABLE          = Dali::Actor::Property::KEYBOARD_FOCUSABLE,
101
102   /**
103    * @brief Sets the sibling order of the actor so depth position can be defined within the same parent.
104    * @details Name "siblingOrder", type Property::INTEGER.
105    * @note The initial value is 0.
106    * @note Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the
107    * sibling order. The values set by this Property will likely change.
108    */
109   SIBLING_ORDER,
110
111   /**
112    * @brief Sets the update size hint of the actor.
113    * @details Name "updateSizeHint", type Property::VECTOR2.
114    * @note Overrides the size used for the actor damaged area calculation. Affected by the actor model view matrix.
115    */
116   UPDATE_SIZE_HINT,
117
118   /**
119     * @brief If this actor receives a touch-start event, then all following touch events are sent to this actor until a touch-end.
120     * @details Name "captureAllTouchAfterStart", type Property::BOOLEAN
121     * @note Default is false, i.e. actor under touch event will receive the touch even if touch started on this actor
122     */
123   CAPTURE_ALL_TOUCH_AFTER_START
124 };
125
126 } // namespace Property
127
128 namespace VisibilityChange
129 {
130
131 enum Type
132 {
133   SELF,   ///< The visibility of the actor itself has changed.
134   PARENT  ///< The visibility of a parent has changed.
135 };
136
137 } // namespace VisibilityChange
138
139 using VisibilityChangedSignalType = Signal<void( Actor, bool, VisibilityChange::Type )>; ///< Signal type of VisibilityChangedSignalType
140
141 /**
142  * @brief This signal is emitted when the visible property of this or a parent actor is changed.
143  *
144  * A callback of the following type may be connected:
145  * @code
146  *   void YourCallbackName( Actor actor, bool visible, VisibilityChange::Type& type );
147  * @endcode
148  * actor: The actor, or child of actor, whose visibility has changed
149  * visible: Whether the actor is now visible or not
150  * type: Whether the actor's visible property has changed or a parent's.
151  * @return The signal to connect to
152  * @pre The Actor has been initialized.
153  * @note This signal is NOT emitted if the actor becomes transparent (or the reverse), it's only linked with Actor::Property::VISIBLE.
154  */
155 DALI_CORE_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor );
156
157 /**
158  * Calculates screen position and size.
159  *
160  * @return pair of two values, position of top-left corner on screen and size respectively.
161  */
162 DALI_CORE_API Rect<> CalculateScreenExtents( Actor actor );
163
164 using ChildChangedSignalType = Signal<void( Actor )>; ///< Called when the actor has a child added or removed
165
166 /**
167  * @brief This signal is emitted when a child is added to this actor.
168  *
169  * A callback of the following type may be connected:
170  * @code
171  *   void MyCallbackName( Actor child );
172  * @endcode
173  * child: The child that has been added.
174  *
175  * @note Use this signal with caution. Changing the parent of the actor
176  * within this callback is possible, but DALi will prevent further signals
177  * being sent.
178  *
179  * @return The signal to connect to
180  * @pre The Actor has been initialized
181  */
182 DALI_CORE_API ChildChangedSignalType& ChildAddedSignal( Actor actor );
183
184 /**
185  * @brief This signal is emitted when a child is removed from this actor.
186  *
187  * A callback of the following type may be connected:
188  * @code
189  *   void MyCallbackName( Actor child );
190  * @endcode
191  * child: The child that has been removed.
192  *
193  * @note Use this signal with caution. Changing the parent of the actor
194  * within this callback is possible, but DALi will prevent further signals
195  * being sent.
196  *
197  * @note If the child actor is moved from one actor to another, then
198  * this signal will be emitted followed immediately by an
199  * ChildAddedSignal() on the new parent.
200  *
201  * @return The signal to connect to
202  * @pre The Actor has been initialized
203  */
204 DALI_CORE_API ChildChangedSignalType& ChildRemovedSignal( Actor actor );
205
206 using ChildOrderChangedSignalType = Signal<void( Actor )>; ///< Used when the actor's children have changed order
207
208 /**
209  * @brief This signal is emitted when an actor's children change their sibling order
210  *
211  * A callback of the following type may be connected:
212  * @code
213  *   void MyCallbackName( Actor parent );
214  * @endcode
215  * parent The parent actor of the moved children
216  *
217  * @return The signal to connect to
218  * @pre The Actor has been initialized
219  */
220 DALI_CORE_API ChildOrderChangedSignalType& ChildOrderChangedSignal( Actor actor );
221
222
223
224 } // namespace DevelActor
225
226 } // namespace Dali
227
228 #endif // DALI_ACTOR_DEVEL_H