1 #ifndef DALI_TOOLKIT_CONTROL_DEVEL_H
2 #define DALI_TOOLKIT_CONTROL_DEVEL_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/devel-api/adaptor-framework/input-method-context.h>
24 #include <dali-toolkit/public-api/controls/control.h>
25 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
40 namespace DevelControl
55 STYLE_NAME = Control::Property::STYLE_NAME,
56 RESERVED_PROPERTY_01 = Control::Property::RESERVED_PROPERTY_01,
57 RESERVED_PROPERTY_02 = Control::Property::RESERVED_PROPERTY_02,
58 KEY_INPUT_FOCUS = Control::Property::KEY_INPUT_FOCUS,
59 BACKGROUND = Control::Property::BACKGROUND,
60 MARGIN = Control::Property::MARGIN,
61 PADDING = Control::Property::PADDING,
64 * @brief Displays a tooltip when the control is hovered over.
65 * @details Name "tooltip", type Property::STRING, Property::ARRAY or Property::MAP.
66 * If Property::STRING, then the style specified in the stylesheet is used.
67 * If Property::ARRAY of Visuals then all are displayed in one row.
68 * If Property::MAP, then it should be a map of Tooltip properties.
69 * @note The tooltip is only activated if display content is received, i.e. a string (text) or visual to show.
70 * The rest is used to just build up the style of the tooltip (i.e. background, text color/point-size etc.)
71 * @note When retrieved, a Property::MAP is returned.
72 * @see Toolkit::Tooltip
74 TOOLTIP = PADDING + 1,
77 * @brief The current state of the control.
78 * @details Name "state", type DevelControl::State ( Property::INTEGER ) or Property::STRING
80 * @see DevelControl::State
85 * @brief The current sub state of the control.
86 * @details Name "subState", type Property::INTEGER or Property::STRING. The enumeration used is dependent on the derived control.
88 * @see DevelControl::State
90 SUB_STATE = PADDING + 3,
93 * @brief The actor ID of the left focusable control.
94 * @details Name "leftFocusableActorId", type Property::INTEGER.
97 LEFT_FOCUSABLE_ACTOR_ID = PADDING + 4,
100 * @brief The actor ID of the right focusable control.
101 * @details Name "rightFocusableActorId", type Property::INTEGER.
104 RIGHT_FOCUSABLE_ACTOR_ID = PADDING + 5,
107 * @brief The actor ID of the up focusable control.
108 * @details Name "upFocusableActorId", type Property::INTEGER.
111 UP_FOCUSABLE_ACTOR_ID = PADDING + 6,
114 * @brief The actor ID of the down focusable control.
115 * @details Name "downFocusableActorId", type Property::INTEGER.
118 DOWN_FOCUSABLE_ACTOR_ID = PADDING + 7
121 } // namespace Property
124 * @brief Register a visual by Property Index.
126 * @param[in] control The control
127 * @param[in] index The Property index of the visual, used to reference visual
128 * @param[in] visual The visual to register
130 * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
131 * Use below API with enabled set to false if derived class wishes to control when visual is staged.
132 * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
133 * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
135 DALI_TOOLKIT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual );
138 * @brief Register a visual by Property Index with a depth index.
140 * @param[in] control The control
141 * @param[in] index The Property index of the visual, used to reference visual
142 * @param[in] visual The visual to register
143 * @param[in] depthIndex The visual's depth-index is set to this
145 * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
146 * Use below API with enabled set to false if derived class wishes to control when visual is staged.
148 * @see Visual::Base::GetDepthIndex()
149 * @see Visual::Base::SetDepthIndex()
151 DALI_TOOLKIT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
154 * @brief Register a visual by Property Index with the option of enabling/disabling it.
156 * @param[in] control The control
157 * @param[in] index The Property index of the visual, used to reference visual
158 * @param[in] visual The visual to register
159 * @param[in] enabled false if derived class wants to control when visual is set on stage.
161 * @note If the depth-index is not set on the visual, then it is set to be above the currently registered visuals.
162 * @note If replacing a visual, then the depth-index of the visual being replaced is used for the visual.
164 * @see EnableVisual()
166 DALI_TOOLKIT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
169 * @brief Register a visual by Property Index with a depth index with the option of enabling/disabling it.
171 * @param[in] control The control
172 * @param[in] index The Property index of the visual, used to reference visual
173 * @param[in] visual The visual to register
174 * @param[in] enabled false if derived class wants to control when visual is set on stage.
175 * @param[in] depthIndex The visual's depth-index is set to this
177 * @see EnableVisual()
178 * @see Visual::Base::GetDepthIndex()
179 * @see Visual::Base::SetDepthIndex()
181 DALI_TOOLKIT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
184 * @brief Erase the entry matching the given index from the list of registered visuals
186 * @param[in] control The control
187 * @param[in] index The Property index of the visual, used to reference visual
189 DALI_TOOLKIT_API void UnregisterVisual( Internal::Control& control, Dali::Property::Index index );
192 * @brief Retrieve the visual associated with the given property index.
194 * @param[in] control The control
195 * @param[in] index The Property index of the visual.
196 * @return The registered visual if exist, otherwise empty handle.
197 * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
199 DALI_TOOLKIT_API Toolkit::Visual::Base GetVisual( const Internal::Control& control, Dali::Property::Index index );
202 * @brief Sets the given visual to be displayed or not when parent staged.
204 * @param[in] control The control
205 * @param[in] index The Property index of the visual
206 * @param[in] enable flag to set enabled or disabled.
208 DALI_TOOLKIT_API void EnableVisual( Internal::Control& control, Dali::Property::Index index, bool enable );
211 * @brief Queries if the given visual is to be displayed when parent staged.
213 * @param[in] control The control
214 * @param[in] index The Property index of the visual
215 * @return bool whether visual is enabled or not
217 DALI_TOOLKIT_API bool IsVisualEnabled( const Internal::Control& control, Dali::Property::Index index );
221 * @brief Add a transition effect on the control to the given animation
223 * Only generates an animator if the properties described in the transition
224 * data are staged (e.g. the visual is Enabled and the control is on stage).
225 * Otherwise the target values are stored, and will get set onto the properties
226 * when the visual is next staged.
228 * @param[in] control The control
229 * @param[in] animation The Animation to add valid transitions to
230 * @param[in] transitionData The transition data describing the effect to create
232 DALI_TOOLKIT_API void AddTransitions( Internal::Control& control,
233 Dali::Animation animation,
234 const Toolkit::TransitionData& transitionData );
237 * @brief Create a transition effect on the control.
239 * Only generates an animation if the properties described in the transition
240 * data are staged (e.g. the visual is Enabled and the control is on stage).
241 * Otherwise the target values are stored, and will get set onto the properties
242 * when the visual is next staged.
244 * @param[in] control The control
245 * @param[in] transitionData The transition data describing the effect to create
246 * @return A handle to an animation defined with the given effect, or an empty
247 * handle if no properties match.
249 DALI_TOOLKIT_API Dali::Animation CreateTransition( Internal::Control& control,
250 const Toolkit::TransitionData& transitionData );
253 * @brief Perform an action on a visual registered to this control.
255 * Visuals will have actions, this API is used to perform one of these actions with the given attributes.
257 * @param[in] control The control.
258 * @param[in] visualIndex The Property index of the visual.
259 * @param[in] actionId The action to perform. See Visual to find supported actions.
260 * @param[in] attributes Optional attributes for the action.
262 DALI_TOOLKIT_API void DoAction( Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes );
265 * @brief Set input method context.
267 * @param[in] control The control.
268 * @param[in] inputMethodContext The input method context.
270 DALI_TOOLKIT_API void SetInputMethodContext( Internal::Control& control, InputMethodContext& inputMethodContext );
273 * @brief Visual Event signal type
275 using VisualEventSignalType = Signal< void ( Control, Dali::Property::Index, Dali::Property::Index ) >;
278 * @brief This signal is emitted when a visual has an event to notify.
280 * A callback of the following type may be connected:
282 * void YourCallbackName( Control control, Dali::Property::Index visualIndex, Dali::Property::Index signalId );
284 * @return The signal to connect to
286 DALI_TOOLKIT_API VisualEventSignalType& VisualEventSignal( Control control );
288 } // namespace DevelControl
290 } // namespace Toolkit
294 #endif // DALI_TOOLKIT_CONTROL_DEVEL_H