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 Sets whether to enable or disable the preview of the widget
165 * @privilege %http://tizen.org/privilege/widget.viewer
166 * @param[in] enable Whether to enable the preview of the widget or not
168 void SetPreviewEnabled( bool enabled );
171 * @brief Checks if the preview of the widget has been enabled or not.
175 * @privilege %http://tizen.org/privilege/widget.viewer
176 * @return Whether the preview of the widget is enabled
178 bool GetPreviewEnabled() const;
181 * @brief Sets whether to enable or disable the state message of the widget
185 * @privilege %http://tizen.org/privilege/widget.viewer
186 * @param[in] enable Whether to enable the state message of the widget or not
188 void SetStateTextEnabled( bool enabled );
191 * @brief Checks if the state message of the widget has been enabled or not.
195 * @privilege %http://tizen.org/privilege/widget.viewer
196 * @return Whether the state message of the widget is enabled
198 bool GetStateTextEnabled() const;
201 * @brief Activate a widget in faulted state.
202 * A widget in faulted state MUST be activated before adding the widget.
206 * @privilege %http://tizen.org/privilege/widget.viewer
208 void ActivateFaultedWidget();
211 * @brief Check whether the widget is faulted.
215 * @privilege %http://tizen.org/privilege/widget.viewer
216 * @return true for faulted state, otherwise false.
218 bool IsWidgetFaulted();
221 * @brief Set the deletion mode.
225 * @privilege %http://tizen.org/privilege/widget.viewer
226 * @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.
228 void SetPermanentDelete( bool permanentDelete );
232 typedef Signal< void ( WidgetView ) > WidgetViewSignalType; ///< WidgetView signal type @since_tizen 3.0
235 * @brief This signal is emitted when the widget is added.
238 * @return The signal to connect to.
240 WidgetViewSignalType& WidgetAddedSignal();
243 * @brief This signal is emitted when the widget is deleted.
246 * @return The signal to connect to.
248 WidgetViewSignalType& WidgetDeletedSignal();
250 public: // Not intended for application developers
253 * @brief Creates a handle using the WidgetView::Internal implementation.
256 * @param[in] implementation The WidgetView implementation.
258 DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
261 * @brief Allows the creation of this control from an Internal::CustomActor pointer.
264 * @param[in] internal A pointer to the internal CustomActor.
266 DALI_INTERNAL WidgetView( Dali::Internal::CustomActor* internal );
272 } // namespace WidgetView
276 #endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_H__