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] period 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 period );
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 Get the id of the widget.
113 * @privilege %http://tizen.org/privilege/widget.viewer
114 * @return The widget id on success, otherwise an empty string.
116 const std::string& GetWidgetId() const;
119 * @brief Get the instance id of the widget.
123 * @privilege %http://tizen.org/privilege/widget.viewer
124 * @return The instance id on success, otherwise an empty string.
126 const std::string& GetInstanceId() const;
129 * @brief Get the content string of the widget.
130 * This string can be used for creating contents of widget again after reboot a device or recovered from crash(abnormal status).
134 * @privilege %http://tizen.org/privilege/widget.viewer
135 * @return The content string to be recognize content of the widget or an empty string if there is no specific content string.
137 const std::string& GetContentInfo();
140 * @brief Get the summarized string of the widget content for accessibility.
141 * If the accessibility feature is turned on, a viewer can use this text to describe the widget.
145 * @privilege %http://tizen.org/privilege/widget.viewer
146 * @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.
148 const std::string& GetTitle();
151 * @brief Get the update period of the widget.
155 * @privilege %http://tizen.org/privilege/widget.viewer
156 * @return The update period of the widget.
158 double GetPeriod() const;
161 * @brief Shows the widget.
165 * @privilege %http://tizen.org/privilege/widget.viewer
166 * @note Use this function instead of Dali::Actor::SetVisible() to restart updating widget content.
171 * @brief Hides the widget.
175 * @privilege %http://tizen.org/privilege/widget.viewer
176 * @note Use this function instead of Dali::Actor::SetVisible() to stop updating widget content.
181 * @brief Cancels touch event procedure.
182 * If you call this function after feed the touch down event, the widget will get ON_HOLD events.
183 * If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event.
187 * @privilege %http://tizen.org/privilege/widget.viewer
188 * @return true on success, false otherwise.
190 bool CancelTouchEvent();
193 * @brief Sets whether to enable or disable the preview of the widget
197 * @privilege %http://tizen.org/privilege/widget.viewer
198 * @param[in] enable Whether to enable the preview of the widget or not
200 void SetPreviewEnabled( bool enabled );
203 * @brief Checks if the preview of the widget has been enabled or not.
207 * @privilege %http://tizen.org/privilege/widget.viewer
208 * @return Whether the preview of the widget is enabled
210 bool GetPreviewEnabled() const;
213 * @brief Sets whether to enable or disable the state message of the widget
217 * @privilege %http://tizen.org/privilege/widget.viewer
218 * @param[in] enable Whether to enable the state message of the widget or not
220 void SetStateTextEnabled( bool enabled );
223 * @brief Checks if the state message of the widget has been enabled or not.
227 * @privilege %http://tizen.org/privilege/widget.viewer
228 * @return Whether the state message of the widget is enabled
230 bool GetStateTextEnabled() const;
233 * @brief Activate a widget in faulted state.
234 * A widget in faulted state MUST be activated before adding the widget.
238 * @privilege %http://tizen.org/privilege/widget.viewer
240 void ActivateFaultedWidget();
243 * @brief Check whether the widget is faulted.
247 * @privilege %http://tizen.org/privilege/widget.viewer
248 * @return true for faulted state, otherwise false.
250 bool IsWidgetFaulted();
253 * @brief Set the deletion mode.
257 * @privilege %http://tizen.org/privilege/widget.viewer
258 * @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.
260 void SetPermanentDelete( bool permanentDelete );
264 typedef Signal< void ( WidgetView ) > WidgetViewSignalType; ///< WidgetView signal type @since_tizen 3.0
267 * @brief This signal is emitted when the widget is added.
270 * @return The signal to connect to.
272 WidgetViewSignalType& WidgetAddedSignal();
275 * @brief This signal is emitted when the widget is deleted.
278 * @return The signal to connect to.
280 WidgetViewSignalType& WidgetDeletedSignal();
282 public: // Not intended for application developers
285 * @brief Creates a handle using the WidgetView::Internal implementation.
288 * @param[in] implementation The WidgetView implementation.
290 DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
293 * @brief Allows the creation of this control from an Internal::CustomActor pointer.
296 * @param[in] internal A pointer to the internal CustomActor.
298 DALI_INTERNAL WidgetView( Dali::Internal::CustomActor* internal );
304 } // namespace WidgetView
308 #endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_H__