(Visuals) Split OFFSET_SIZE_MODE into separate properties
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / visual-properties-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_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-toolkit/public-api/visuals/visual-properties.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace DevelVisual
31 {
32
33 /**
34  * @brief All the visual types.
35  */
36 enum Type
37 {
38   BORDER    = Dali::Toolkit::Visual::BORDER,
39   COLOR     = Dali::Toolkit::Visual::COLOR,
40   GRADIENT  = Dali::Toolkit::Visual::GRADIENT,
41   IMAGE     = Dali::Toolkit::Visual::IMAGE,
42   MESH      = Dali::Toolkit::Visual::MESH,
43   PRIMITIVE = Dali::Toolkit::Visual::PRIMITIVE,
44   WIREFRAME = Dali::Toolkit::Visual::WIREFRAME,
45
46   TEXT      = WIREFRAME + 1, ///< Renders text.
47 };
48
49 namespace Property
50 {
51
52 enum Type
53 {
54   TYPE   = Dali::Toolkit::Visual::Property::TYPE,
55   SHADER = Dali::Toolkit::Visual::Property::SHADER,
56
57   /**
58    * @brief The transform used by the visual.
59    * @details Name "transform", type Property::Map.
60    *
61    * @note Optional.
62    * @see DevelVisual::Transform::Property
63    */
64   TRANSFORM = SHADER + 1,
65
66   /**
67    * @brief Enables/disables premultiplied alpha.
68    * The premultiplied alpha is false by default unless this behaviour is modified
69    * by the derived Visual type.
70    *
71    * @details Name "premultipliedAlpha", type Property::Boolean.
72    *
73    * @note Optional.
74    */
75   PREMULTIPLIED_ALPHA = SHADER + 2,
76
77   /**
78    * @brief Mix color is a blend color for any visual.
79    * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4
80    *
81    * @note Optional
82    */
83   MIX_COLOR = SHADER + 3,
84
85   /**
86    * @brief Opacity is the alpha component of the mixColor, above.
87    * @details Name "opacity", type Property::FLOAT
88    *
89    * @note Optional
90    */
91   OPACITY = SHADER + 4
92 };
93
94 } // namespace Property
95
96 namespace Transform
97 {
98
99 /**
100  * @brief Policies used by the transform for the offset or size.
101  */
102 namespace Policy
103 {
104
105 enum Type
106 {
107   RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control).
108   ABSOLUTE = 1    ///< Absolute value in world units.
109 };
110
111 } // namespace Policy
112
113 namespace Property
114 {
115
116 enum Type
117 {
118   /**
119    * @brief Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
120    * @details Name "offset", type Property::VECTOR2
121    * @see OFFSET_POLICY
122    */
123   OFFSET,
124
125   /**
126    * @brief Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
127    * @details Name "size", type Property::VECTOR2
128    * @see SIZE_POLICY
129    */
130   SIZE,
131
132   /**
133    * @brief The origin of the visual within its control area.
134    * @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
135    * @see Toolkit::Align
136    */
137   ORIGIN,
138
139   /**
140    * @brief The anchor-point of the visual
141    * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
142    * @see Toolkit::Align
143    */
144   ANCHOR_POINT,
145
146   /**
147    * @brief Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
148    * @details Name "offsetPolicy", type Vector2 or Property::ARRAY of Property::STRING.
149    *          If Property::ARRAY then 2 strings expected for the x and y.
150    *
151    * C++:
152    * @code
153    * control.SetProperty( ..., // Some visual based property
154    *                      Property::Map().Add( ... ) // Properties to set up visual
155    *                                     .Add( DevelVisual::Property::TRANSFORM,
156    *                                           Property::Array().Add( DevelVisual::Transform::Property::OFFSET_POLICY, Vector2( Policy::ABSOLUTE, Policy::RELATIVE ) ) )
157    *                                                            .Add( DevelVisual::Transform::Property::OFFSET, Vector2( 10, 1.0f ) ) );
158    * @endcode
159    *
160    * JSON:
161    * @code
162    * {
163    *   ...
164    *   "transition":
165    *   {
166    *     "offsetPolicy" : [ "ABSOLUTE", "RELATIVE" ],
167    *     "offset" : [ 10, 1.0 ]
168    *   }
169    *   ...
170    * }
171    *
172    * @endcode
173    * @see Policy::Type
174    * @note By default, both the x and the y offset is RELATIVE.
175    */
176   OFFSET_POLICY,
177
178   /**
179    * @brief Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
180    * @details Name "sizePolicy", type Vector2 or Property::ARRAY of Property::STRING.
181    *          If Property::ARRAY then 2 strings expected for the width and height.
182    *
183    * @see Policy::Type
184    * @see OFFSET_POLICY for example
185    * @note By default, both the width and the height is RELATIVE to the control's size.
186    */
187   SIZE_POLICY,
188 };
189
190 } // namespace Property
191
192 } // namespace Transform
193
194 } // namespace DevelVisual
195
196 } // namespace Toolkit
197
198 } // namespace Dali
199
200 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H