Merge "Fixed a problem where text size exceeds maximum texture size." into devel...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / control-devel.h
1 #ifndef DALI_TOOLKIT_CONTROL_DEVEL_H
2 #define DALI_TOOLKIT_CONTROL_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/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 class TransitionData;
31
32 namespace Visual
33 {
34 class Base;
35 }
36
37 namespace DevelControl
38 {
39
40 enum State
41 {
42   NORMAL,
43   FOCUSED,
44   DISABLED
45 };
46
47 namespace Property
48 {
49
50 enum
51 {
52   STYLE_NAME        = Control::Property::STYLE_NAME,
53   BACKGROUND_COLOR  = Control::Property::BACKGROUND_COLOR,
54   BACKGROUND_IMAGE  = Control::Property::BACKGROUND_IMAGE,
55   KEY_INPUT_FOCUS   = Control::Property::KEY_INPUT_FOCUS,
56   BACKGROUND        = Control::Property::BACKGROUND,
57   MARGIN            = Control::Property::MARGIN,
58   PADDING           = Control::Property::PADDING,
59
60   /**
61    * @brief Displays a tooltip when the control is hovered over.
62    * @details Name "tooltip", type Property::STRING, Property::ARRAY or Property::MAP.
63    *          If Property::STRING, then the style specified in the stylesheet is used.
64    *          If Property::ARRAY of Visuals then all are displayed in one row.
65    *          If Property::MAP, then it should be a map of Tooltip properties.
66    * @note The tooltip is only activated if display content is received, i.e. a string (text) or visual to show.
67    *       The rest is used to just build up the style of the tooltip (i.e. background, text color/point-size etc.)
68    * @note When retrieved, a Property::MAP is returned.
69    * @see Toolkit::Tooltip
70    */
71   TOOLTIP = PADDING + 1,
72
73   /**
74    * @brief The current state of the control.
75    * @details Name "state", type DevelControl::State ( Property::INTEGER ) or Property::STRING
76    *
77    * @see DevelControl::State
78    */
79   STATE = PADDING + 2,
80
81   /**
82    * @brief The current sub state of the control.
83    * @details Name "subState", type Property::INTEGER or Property::STRING. The enumeration used is dependent on the derived control.
84    *
85    * @see DevelControl::State
86    */
87   SUB_STATE = PADDING + 3,
88
89   /**
90    * @brief The actor ID of the left focusable control.
91    * @details Name "leftFocusableActorId", type Property::INTEGER.
92    *
93    */
94   LEFT_FOCUSABLE_ACTOR_ID = PADDING + 4,
95
96   /**
97    * @brief The actor ID of the right focusable control.
98    * @details Name "rightFocusableActorId", type Property::INTEGER.
99    *
100    */
101   RIGHT_FOCUSABLE_ACTOR_ID = PADDING + 5,
102
103   /**
104    * @brief The actor ID of the up focusable control.
105    * @details Name "upFocusableActorId", type Property::INTEGER.
106    *
107    */
108   UP_FOCUSABLE_ACTOR_ID = PADDING + 6,
109
110   /**
111    * @brief The actor ID of the down focusable control.
112    * @details Name "downFocusableActorId", type Property::INTEGER.
113    *
114    */
115   DOWN_FOCUSABLE_ACTOR_ID = PADDING + 7
116 };
117
118 } // namespace Property
119
120 /**
121  * @brief Register a visual by Property Index.
122  *
123  * @param[in] control The control
124  * @param[in] index The Property index of the visual, used to reference visual
125  * @param[in] visual The visual to register
126  *
127  * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
128  *       Use below API with enabled set to false if derived class wishes to control when visual is staged.
129  * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
130  * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
131  */
132 DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual );
133
134 /**
135  * @brief Register a visual by Property Index with a depth index.
136  *
137  * @param[in] control The control
138  * @param[in] index The Property index of the visual, used to reference visual
139  * @param[in] visual The visual to register
140  * @param[in] depthIndex The visual's depth-index is set to this
141  *
142  * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
143  *       Use below API with enabled set to false if derived class wishes to control when visual is staged.
144  *
145  * @see Visual::Base::GetDepthIndex()
146  * @see Visual::Base::SetDepthIndex()
147  */
148 DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
149
150 /**
151  * @brief Register a visual by Property Index with the option of enabling/disabling it.
152  *
153  * @param[in] control The control
154  * @param[in] index The Property index of the visual, used to reference visual
155  * @param[in] visual The visual to register
156  * @param[in] enabled false if derived class wants to control when visual is set on stage.
157  *
158  * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
159  * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
160  *
161  * @see EnableVisual()
162  */
163 DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
164
165 /**
166  * @brief Register a visual by Property Index with a depth index with the option of enabling/disabling it.
167  *
168  * @param[in] control The control
169  * @param[in] index The Property index of the visual, used to reference visual
170  * @param[in] visual The visual to register
171  * @param[in] enabled false if derived class wants to control when visual is set on stage.
172  * @param[in] depthIndex The visual's depth-index is set to this
173  *
174  * @see EnableVisual()
175  * @see Visual::Base::GetDepthIndex()
176  * @see Visual::Base::SetDepthIndex()
177  */
178 DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
179
180 /**
181  * @brief Erase the entry matching the given index from the list of registered visuals
182  *
183  * @param[in] control The control
184  * @param[in] index The Property index of the visual, used to reference visual
185  */
186 DALI_IMPORT_API void UnregisterVisual( Internal::Control& control, Dali::Property::Index index );
187
188 /**
189  * @brief Retrieve the visual associated with the given property index.
190  *
191  * @param[in] control The control
192  * @param[in] index The Property index of the visual.
193  * @return The registered visual if exist, otherwise empty handle.
194  * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
195  */
196 DALI_IMPORT_API Toolkit::Visual::Base GetVisual( const Internal::Control& control, Dali::Property::Index index );
197
198 /**
199  * @brief Sets the given visual to be displayed or not when parent staged.
200  *
201  * @param[in] control The control
202  * @param[in] index The Property index of the visual
203  * @param[in] enable flag to set enabled or disabled.
204  */
205 DALI_IMPORT_API void EnableVisual( Internal::Control& control, Dali::Property::Index index, bool enable );
206
207 /**
208  * @brief Queries if the given visual is to be displayed when parent staged.
209  *
210  * @param[in] control The control
211  * @param[in] index The Property index of the visual
212  * @return bool whether visual is enabled or not
213  */
214 DALI_IMPORT_API bool IsVisualEnabled( const Internal::Control& control, Dali::Property::Index index );
215
216 /**
217  * @brief Create a transition effect on the control.
218  *
219  * Only generates an animation if the properties described in the transition
220  * data are staged (e.g. the visual is Enabled and the control is on stage).
221  * Otherwise the target values are stored, and will get set onto the properties
222  * when the visual is next staged.
223  *
224  * @param[in] control The control
225  * @param[in] transitionData The transition data describing the effect to create
226  * @return A handle to an animation defined with the given effect, or an empty
227  * handle if no properties match.
228  */
229 DALI_IMPORT_API Dali::Animation CreateTransition( Internal::Control& control, const Toolkit::TransitionData& transitionData );
230
231 } // namespace DevelControl
232
233 } // namespace Toolkit
234
235 } // namespace Dali
236
237 #endif // DALI_TOOLKIT_CONTROL_DEVEL_H