[ATSPI] Add CalculateScreenExtents function
[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) 2019 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   RESERVED_PROPERTY_01        = Dali::Actor::Property::RESERVED_PROPERTY_01,
78   DRAW_MODE                   = Dali::Actor::Property::DRAW_MODE,
79   SIZE_MODE_FACTOR            = Dali::Actor::Property::SIZE_MODE_FACTOR,
80   WIDTH_RESIZE_POLICY         = Dali::Actor::Property::WIDTH_RESIZE_POLICY,
81   HEIGHT_RESIZE_POLICY        = Dali::Actor::Property::HEIGHT_RESIZE_POLICY,
82   SIZE_SCALE_POLICY           = Dali::Actor::Property::SIZE_SCALE_POLICY,
83   WIDTH_FOR_HEIGHT            = Dali::Actor::Property::WIDTH_FOR_HEIGHT,
84   HEIGHT_FOR_WIDTH            = Dali::Actor::Property::HEIGHT_FOR_WIDTH,
85   PADDING                     = Dali::Actor::Property::PADDING,
86   MINIMUM_SIZE                = Dali::Actor::Property::MINIMUM_SIZE,
87   MAXIMUM_SIZE                = Dali::Actor::Property::MAXIMUM_SIZE,
88   INHERIT_POSITION            = Dali::Actor::Property::INHERIT_POSITION,
89   CLIPPING_MODE               = Dali::Actor::Property::CLIPPING_MODE,
90   LAYOUT_DIRECTION            = Dali::Actor::Property::LAYOUT_DIRECTION,
91   INHERIT_LAYOUT_DIRECTION    = Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION,
92
93   /**
94    * @brief Sets the sibling order of the actor so depth position can be defined within the same parent.
95    * @details Name "siblingOrder", type Property::INTEGER.
96    * @note The initial value is 0.
97    * @note Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the
98    * sibling order. The values set by this Property will likely change.
99    */
100   SIBLING_ORDER = INHERIT_LAYOUT_DIRECTION + 1,
101
102   /**
103    * @brief The opacity of the actor.
104    * @details Name "opacity", type Property::FLOAT.
105    */
106   OPACITY = INHERIT_LAYOUT_DIRECTION + 2,
107
108   /**
109    * @brief Returns the screen position of the Actor
110    * @details Name "screenPosition", type Property::VECTOR2. Read-only
111    * @note This assumes default camera and default render-task and the Z position is ZERO.
112    * @note The last known frame is used for the calculation. May not match a position value just set.
113    */
114   SCREEN_POSITION = INHERIT_LAYOUT_DIRECTION + 3,
115
116   /**
117    * @brief Determines whether the anchor point should be used to determine the position of the actor.
118    * @details Name "positionUsesAnchorPoint", type Property::BOOLEAN.
119    * @note This is true by default.
120    * @note If false, then the top-left of the actor is used for the position.
121    * @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position.
122    */
123   POSITION_USES_ANCHOR_POINT = INHERIT_LAYOUT_DIRECTION + 4,
124
125   /**
126    * @brief Returns whether the actor is culled or not.
127    * @details Name "culled", type Property::BOOLEAN. Read-only
128    * @note True means that the actor is out of the view frustum.
129    */
130   CULLED = INHERIT_LAYOUT_DIRECTION + 5,
131 };
132
133 } // namespace Property
134
135 namespace VisibilityChange
136 {
137
138 enum Type
139 {
140   SELF,   ///< The visibility of the actor itself has changed.
141   PARENT  ///< The visibility of a parent has changed.
142 };
143
144 } // namespace VisibilityChange
145
146 typedef Signal< void ( Actor, bool, VisibilityChange::Type ) > VisibilityChangedSignalType; ///< Signal type of VisibilityChangedSignalType
147
148 /**
149  * @brief This signal is emitted when the visible property of this or a parent actor is changed.
150  *
151  * A callback of the following type may be connected:
152  * @code
153  *   void YourCallbackName( Actor actor, bool visible, VisibilityChange::Type& type );
154  * @endcode
155  * actor: The actor, or child of actor, whose visibility has changed
156  * visible: Whether the actor is now visible or not
157  * type: Whether the actor's visible property has changed or a parent's.
158  * @return The signal to connect to
159  * @pre The Actor has been initialized.
160  * @note This signal is NOT emitted if the actor becomes transparent (or the reverse), it's only linked with Actor::Property::VISIBLE.
161  */
162 DALI_CORE_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor );
163
164 /**
165  * Calculates screen position and size.
166  *
167  * @return pair of two values, position of top-left corner on screen and size respectively.
168  */
169 DALI_CORE_API Rect<> CalculateScreenExtents( Actor actor );
170
171
172
173 typedef Signal< void (Actor) > ChildChangedSignalType; ///< Called when the actor has a child added or removed
174
175 /**
176  * @brief This signal is emitted when a child is added to this actor.
177  *
178  * A callback of the following type may be connected:
179  * @code
180  *   void MyCallbackName( Actor child );
181  * @endcode
182  * child: The child that has been added.
183  *
184  * @note Use this signal with caution. Changing the parent of the actor
185  * within this callback is possible, but DALi will prevent further signals
186  * being sent.
187  *
188  * @return The signal to connect to
189  * @pre The Actor has been initialized
190  */
191 DALI_CORE_API ChildChangedSignalType& ChildAddedSignal( Actor actor );
192
193 /**
194  * @brief This signal is emitted when a child is removed from this actor.
195  *
196  * A callback of the following type may be connected:
197  * @code
198  *   void MyCallbackName( Actor child );
199  * @endcode
200  * child: The child that has been removed.
201  *
202  * @note Use this signal with caution. Changing the parent of the actor
203  * within this callback is possible, but DALi will prevent further signals
204  * being sent.
205  *
206  * @note If the child actor is moved from one actor to another, then
207  * this signal will be emitted followed immediately by an
208  * ChildAddedSignal() on the new parent.
209  *
210  * @return The signal to connect to
211  * @pre The Actor has been initialized
212  */
213 DALI_CORE_API ChildChangedSignalType& ChildRemovedSignal( Actor actor );
214
215
216 typedef Signal< void (Actor) > ChildOrderChangedSignalType; ///< Used when the actor's children have changed order
217
218 /**
219  * @brief This signal is emitted when an actor's children change their sibling order
220  *
221  * A callback of the following type may be connected:
222  * @code
223  *   void MyCallbackName( Actor parent );
224  * @endcode
225  * parent The parent actor of the moved children
226  *
227  * @return The signal to connect to
228  * @pre The Actor has been initialized
229  */
230 DALI_CORE_API ChildOrderChangedSignalType& ChildOrderChangedSignal( Actor actor );
231
232
233
234 } // namespace DevelActor
235
236 } // namespace Dali
237
238 #endif // DALI_ACTOR_DEVEL_H