1 #ifndef __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
2 #define __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
5 * Copyright (c) 2016 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.
22 #include <dali-toolkit/public-api/controls/control.h>
30 namespace Internal DALI_INTERNAL
36 * @addtogroup dali_widget_view
41 * @brief WidgetView is a class for displaying the widget image and controlling the widget.
42 * Input events that WidgetView gets are delivered to the widget.
46 class DALI_IMPORT_API WidgetView : public Toolkit::Control
51 * @brief Create widget view.
55 * @privilege %http://tizen.org/privilege/widget.viewer
56 * @param[in] widgetId The widget id.
57 * @param[in] contentInfo Contents that will be given to the widget instance.
58 * @param[in] width The widget width.
59 * @param[in] height The widget height.
60 * @param[in] updatePeriod The period of updating contents of the widget.
61 * @return A handle to WidgetView.
63 static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
66 * @brief Downcast a handle to WidgetView handle.
68 * If the BaseHandle points is a WidgetView the downcast returns a valid handle.
69 * If not the returned handle is left empty.
72 * @param[in] handle Handle to an object
73 * @return handle to a WidgetView or an empty handle
75 static WidgetView DownCast( BaseHandle handle );
78 * @brief Creates an empty handle.
84 * @brief Copy constructor.
87 * @param[in] handle The handle to copy from.
89 WidgetView( const WidgetView& handle );
92 * @brief Assignment operator.
95 * @param[in] handle The handle to copy from.
96 * @return A reference to this.
98 WidgetView& operator=( const WidgetView& handle );
103 * This is non-virtual since derived Handle types must not contain data or virtual methods.
109 * @brief Pauses a given widget.
113 * @privilege %http://tizen.org/privilege/widget.viewer
114 * @return true on success, false otherwise.
119 * @brief Resume a given widget.
123 * @privilege %http://tizen.org/privilege/widget.viewer
124 * @return true on success, false otherwise.
129 * @brief Get the id of the widget.
133 * @privilege %http://tizen.org/privilege/widget.viewer
134 * @return The widget id on success, otherwise an empty string.
136 const std::string& GetWidgetId() const;
139 * @brief Get the instance id of the widget.
143 * @privilege %http://tizen.org/privilege/widget.viewer
144 * @return The instance id on success, otherwise an empty string.
146 const std::string& GetInstanceId() const;
149 * @brief Get the content string of the widget.
150 * This string can be used for creating contents of widget again after reboot a device or recovered from crash(abnormal status).
154 * @privilege %http://tizen.org/privilege/widget.viewer
155 * @return The content string to be recognize content of the widget or an empty string if there is no specific content string.
157 const std::string& GetContentInfo();
160 * @brief Get the summarized string of the widget content for accessibility.
161 * If the accessibility feature is turned on, a viewer can use this text to describe the widget.
165 * @privilege %http://tizen.org/privilege/widget.viewer
166 * @return The title string to be used for summarizing the widget or an empty string if there is no summarized text for content of given widget.
168 const std::string& GetTitle();
171 * @brief Get the update period of the widget content.
175 * @privilege %http://tizen.org/privilege/widget.viewer
176 * @return The update period of the widget content.
178 double GetUpdatePeriod() const;
181 * @brief Shows the widget.
185 * @privilege %http://tizen.org/privilege/widget.viewer
186 * @note Use this function instead of Dali::Actor::SetVisible() to restart updating widget content.
191 * @brief Hides the widget.
195 * @privilege %http://tizen.org/privilege/widget.viewer
196 * @note Use this function instead of Dali::Actor::SetVisible() to stop updating widget content.
201 * @brief Cancels touch event procedure.
202 * If you call this function after feed the touch down event, the widget will get ON_HOLD events.
203 * If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event.
207 * @privilege %http://tizen.org/privilege/widget.viewer
208 * @return true on success, false otherwise.
210 bool CancelTouchEvent();
213 * @brief Sets whether to enable or disable the preview of the widget
217 * @privilege %http://tizen.org/privilege/widget.viewer
218 * @param[in] enable Whether to enable the preview of the widget or not
220 void SetPreviewEnabled( bool enabled );
223 * @brief Checks if the preview of the widget has been enabled or not.
227 * @privilege %http://tizen.org/privilege/widget.viewer
228 * @return Whether the preview of the widget is enabled
230 bool GetPreviewEnabled() const;
233 * @brief Sets whether to enable or disable the state message of the widget
237 * @privilege %http://tizen.org/privilege/widget.viewer
238 * @param[in] enable Whether to enable the state message of the widget or not
240 void SetStateTextEnabled( bool enabled );
243 * @brief Checks if the state message of the widget has been enabled or not.
247 * @privilege %http://tizen.org/privilege/widget.viewer
248 * @return Whether the state message of the widget is enabled
250 bool GetStateTextEnabled() const;
253 * @brief Activate a widget in faulted state.
254 * A widget in faulted state MUST be activated before adding the widget.
258 * @privilege %http://tizen.org/privilege/widget.viewer
260 void ActivateFaultedWidget();
263 * @brief Check whether the widget is faulted.
267 * @privilege %http://tizen.org/privilege/widget.viewer
268 * @return true for faulted state, otherwise false.
270 bool IsWidgetFaulted();
273 * @brief Set the deletion mode.
277 * @privilege %http://tizen.org/privilege/widget.viewer
278 * @param[in] permanentDelete Pass true if you want to delete this widget instance permanently, or pass false if you want to keep it and it will be re-created soon.
280 void SetPermanentDelete( bool permanentDelete );
284 typedef Signal< void ( WidgetView ) > WidgetViewSignalType; ///< WidgetView signal type @since_tizen 3.0
287 * @brief This signal is emitted when the widget is added.
291 * @privilege %http://tizen.org/privilege/widget.viewer
292 * @return The signal to connect to.
294 WidgetViewSignalType& WidgetAddedSignal();
297 * @brief This signal is emitted when the widget is deleted.
301 * @privilege %http://tizen.org/privilege/widget.viewer
302 * @return The signal to connect to.
304 WidgetViewSignalType& WidgetDeletedSignal();
307 * @brief This signal is emitted when the widget creation is aborted.
311 * @privilege %http://tizen.org/privilege/widget.viewer
312 * @return The signal to connect to.
314 WidgetViewSignalType& WidgetCreationAbortedSignal();
317 * @brief This signal is emitted when the widget is resized.
321 * @privilege %http://tizen.org/privilege/widget.viewer
322 * @return The signal to connect to.
324 WidgetViewSignalType& WidgetResizedSignal();
327 * @brief This signal is emitted when the widget content is updated.
331 * @privilege %http://tizen.org/privilege/widget.viewer
332 * @return The signal to connect to.
334 WidgetViewSignalType& WidgetContentUpdatedSignal();
337 * @brief This signal is emitted when the widget extra info is updated.
341 * @privilege %http://tizen.org/privilege/widget.viewer
342 * @return The signal to connect to.
344 WidgetViewSignalType& WidgetExtraInfoUpdatedSignal();
347 * @brief This signal is emitted when the widget update period is changed.
351 * @privilege %http://tizen.org/privilege/widget.viewer
352 * @return The signal to connect to.
354 WidgetViewSignalType& WidgetUpdatePeriodChangedSignal();
357 * @brief This signal is emitted when the widget process is not running.
361 * @privilege %http://tizen.org/privilege/widget.viewer
362 * @return The signal to connect to.
364 WidgetViewSignalType& WidgetFaultedSignal();
366 public: // Not intended for application developers
369 * @brief Creates a handle using the WidgetView::Internal implementation.
372 * @param[in] implementation The WidgetView implementation.
374 DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
377 * @brief Allows the creation of this control from an Internal::CustomActor pointer.
380 * @param[in] internal A pointer to the internal CustomActor.
382 DALI_INTERNAL WidgetView( Dali::Internal::CustomActor* internal );
388 } // namespace WidgetView
392 #endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_H__