Added property of layout direction for RTL/LTR support
[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) 2017 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
24 namespace Dali
25 {
26
27 namespace DevelActor
28 {
29
30 namespace Property
31 {
32
33 enum Type
34 {
35   PARENT_ORIGIN        = Dali::Actor::Property::PARENT_ORIGIN,
36   PARENT_ORIGIN_X      = Dali::Actor::Property::PARENT_ORIGIN_X,
37   PARENT_ORIGIN_Y      = Dali::Actor::Property::PARENT_ORIGIN_Y,
38   PARENT_ORIGIN_Z      = Dali::Actor::Property::PARENT_ORIGIN_Z,
39   ANCHOR_POINT         = Dali::Actor::Property::ANCHOR_POINT,
40   ANCHOR_POINT_X       = Dali::Actor::Property::ANCHOR_POINT_X,
41   ANCHOR_POINT_Y       = Dali::Actor::Property::ANCHOR_POINT_Y,
42   ANCHOR_POINT_Z       = Dali::Actor::Property::ANCHOR_POINT_Z,
43   SIZE                 = Dali::Actor::Property::SIZE,
44   SIZE_WIDTH           = Dali::Actor::Property::SIZE_WIDTH,
45   SIZE_HEIGHT          = Dali::Actor::Property::SIZE_HEIGHT,
46   SIZE_DEPTH           = Dali::Actor::Property::SIZE_DEPTH,
47   POSITION             = Dali::Actor::Property::POSITION,
48   POSITION_X           = Dali::Actor::Property::POSITION_X,
49   POSITION_Y           = Dali::Actor::Property::POSITION_Y,
50   POSITION_Z           = Dali::Actor::Property::POSITION_Z,
51   WORLD_POSITION       = Dali::Actor::Property::WORLD_POSITION,
52   WORLD_POSITION_X     = Dali::Actor::Property::WORLD_POSITION_X,
53   WORLD_POSITION_Y     = Dali::Actor::Property::WORLD_POSITION_Y,
54   WORLD_POSITION_Z     = Dali::Actor::Property::WORLD_POSITION_Z,
55   ORIENTATION          = Dali::Actor::Property::ORIENTATION,
56   WORLD_ORIENTATION    = Dali::Actor::Property::WORLD_ORIENTATION,
57   SCALE                = Dali::Actor::Property::SCALE,
58   SCALE_X              = Dali::Actor::Property::SCALE_X,
59   SCALE_Y              = Dali::Actor::Property::SCALE_Y,
60   SCALE_Z              = Dali::Actor::Property::SCALE_Z,
61   WORLD_SCALE          = Dali::Actor::Property::WORLD_SCALE,
62   VISIBLE              = Dali::Actor::Property::VISIBLE,
63   COLOR                = Dali::Actor::Property::COLOR,
64   COLOR_RED            = Dali::Actor::Property::COLOR_RED,
65   COLOR_GREEN          = Dali::Actor::Property::COLOR_GREEN,
66   COLOR_BLUE           = Dali::Actor::Property::COLOR_BLUE,
67   COLOR_ALPHA          = Dali::Actor::Property::COLOR_ALPHA,
68   WORLD_COLOR          = Dali::Actor::Property::WORLD_COLOR,
69   WORLD_MATRIX         = Dali::Actor::Property::WORLD_MATRIX,
70   NAME                 = Dali::Actor::Property::NAME,
71   SENSITIVE            = Dali::Actor::Property::SENSITIVE,
72   LEAVE_REQUIRED       = Dali::Actor::Property::LEAVE_REQUIRED,
73   INHERIT_ORIENTATION  = Dali::Actor::Property::INHERIT_ORIENTATION,
74   INHERIT_SCALE        = Dali::Actor::Property::INHERIT_SCALE,
75   COLOR_MODE           = Dali::Actor::Property::COLOR_MODE,
76   POSITION_INHERITANCE = Dali::Actor::Property::POSITION_INHERITANCE,
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
90   /**
91    * @brief Sets the sibling order of the actor so depth position can be defined within the same parent.
92    * @details Name "siblingOrder", type Property::INTEGER.
93    * @note The initial value is 0.
94    * @note Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the
95    * sibling order. The values set by this Property will likely change.
96    */
97   SIBLING_ORDER = CLIPPING_MODE + 1,
98
99   /**
100    * @brief The opacity of the actor.
101    * @details Name "opacity", type Property::FLOAT.
102    */
103   OPACITY = CLIPPING_MODE + 2,
104
105   /**
106    * @brief Returns the screen position of the Actor
107    * @details Name "screenPosition", type Property::VECTOR2. Read-only
108    * @note This assumes default camera and default render-task and the Z position is ZERO.
109    */
110   SCREEN_POSITION = CLIPPING_MODE + 3,
111
112   /**
113    * @brief Determines whether the anchor point should be used to determine the position of the actor.
114    * @details Name "positionUsesAnchorPoint", type Property::BOOLEAN.
115    * @note This is true by default.
116    * @note If false, then the top-left of the actor is used for the position.
117    * @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position.
118    */
119   POSITION_USES_ANCHOR_POINT = CLIPPING_MODE + 4,
120
121   /**
122    * @brief The direction of layout.
123    * @details Name "layoutDirection", type Property::STRING.
124    */
125   LAYOUT_DIRECTION = CLIPPING_MODE + 5,
126
127   /**
128    * @brief Determines whether child actors inherit the layout direction from a parent.
129    * @details Name "layoutDirectionInheritance", type Property::BOOLEAN.
130    */
131   LAYOUT_DIRECTION_INHERITANCE = CLIPPING_MODE + 6
132 };
133
134 } // namespace Property
135
136 namespace VisibilityChange
137 {
138
139 enum Type
140 {
141   SELF,   ///< The visibility of the actor itself has changed.
142   PARENT  ///< The visibility of a parent has changed.
143 };
144
145 } // namespace VisibilityChange
146
147 namespace LayoutDirection
148 {
149
150 enum Type
151 {
152   LTR,   ///< Left to Right direction (Default).
153   RTL    ///< Right to Left direction.
154 };
155
156 } // namespace
157
158 typedef Signal< void ( Actor, bool, VisibilityChange::Type ) > VisibilityChangedSignalType; ///< Signal type of VisibilityChangedSignal
159
160 /**
161  * @brief Raise actor above the next highest level of actor(s).
162  *
163  * @param[in] actor The Actor to raise
164  * @note Sibling order of actors within the parent will be updated automatically.
165  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
166  * Initially actors added to a parent will have the same sibling order and shown in relation to insertion order.
167  * Raising this actor above actors with the same sibling order as each other will raise this actor above them.
168  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
169  *
170  */
171 DALI_IMPORT_API void Raise( Actor actor );
172
173 /**
174  * @brief Lower the actor to underneath the level below actor(s).
175  *
176  * @param[in] actor The Actor to lower
177  * @note Sibling order of actors within the parent will be updated automatically.
178  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
179  * Lowering this actor below actors with the same sibling order as each other will lower this actor above them.
180  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
181  */
182 DALI_IMPORT_API void Lower( Actor actor );
183
184 /**
185  * @brief Raise actor above all other actors.
186  *
187  * @param[in] actor The Actor to raise to the top
188  * @note Sibling order of actors within the parent will be updated automatically.
189  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
190  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
191  */
192 DALI_IMPORT_API void RaiseToTop( Actor actor );
193
194 /**
195  * @brief Lower actor to the bottom of all actors.
196  *
197  * @param[in] actor The Actor to lower to the bottom
198  * @note Sibling order of actors within the parent will be updated automatically.
199  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
200  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
201  */
202 DALI_IMPORT_API void LowerToBottom( Actor actor );
203
204 /**
205  * @brief Raise the actor to above the target actor.
206  *
207  * @param[in] actor The actor to raise
208  * @param[in] target Will be raised above this actor
209  * @note Sibling order of actors within the parent will be updated automatically.
210  * Actors on the level above the target actor will still be shown above this actor.
211  * Raising this actor above actors with the same sibling order as each other will raise this actor above them.
212  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
213  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
214  */
215 DALI_IMPORT_API void RaiseAbove( Actor actor, Dali::Actor target );
216
217 /**
218  * @brief Lower the actor to below the target actor.
219  *
220  * @param[in] actor The Actor to lower
221  * @param[in] target Will be lowered below this actor
222  * @note Sibling order of actors within the parent will be updated automatically.
223  * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
224  * Lowering this actor below actors with the same sibling order as each other will lower this actor above them.
225  * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
226  */
227 DALI_IMPORT_API void LowerBelow( Actor actor, Dali::Actor target );
228
229 /**
230  * @brief This signal is emitted when the visible property of this or a parent actor is changed.
231  *
232  * A callback of the following type may be connected:
233  * @code
234  *   void YourCallbackName( Actor actor, bool visible, VisibilityChange::Type& type );
235  * @endcode
236  * actor: The actor, or child of actor, whose visibility has changed
237  * visible: Whether the actor is now visible or not
238  * type: Whether the actor's visible property has changed or a parent's.
239  * @return The signal to connect to
240  * @pre The Actor has been initialized.
241  * @note This signal is NOT emitted if the actor becomes transparent (or the reverse), it's only linked with Actor::Property::VISIBLE.
242  */
243 DALI_IMPORT_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor );
244
245 } // namespace DevelActor
246
247 } // namespace Dali
248
249 #endif // DALI_ACTOR_DEVEL_H