Add widget_viewer_dali
[platform/core/uifw/widget-viewer-dali.git] / public_api / widget_view / widget_view.h
1 #ifndef __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
2 #define __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
3
4 /*
5  * Copyright (c) 2016 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 // EXTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace WidgetView
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class WidgetView;
33 }
34
35 /**
36  * @addtogroup dali_widget_view
37  * @{
38  */
39
40 /**
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.
43  *
44  * @since_tizen 3.0
45  */
46 class DALI_IMPORT_API WidgetView : public Toolkit::Control
47 {
48 public:
49
50   /**
51    * @brief Create widget view.
52    *
53    * @since_tizen 3.0
54    * @param[in] widgetId The widget id.
55    * @param[in] contentInfo Contents that will be given to the widget instance.
56    * @param[in] width The widget width.
57    * @param[in] height The widget height.
58    * @param[in] period The period of updating contents of the widget.
59    * @return A handle to WidgetView.
60    */
61   static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
62
63   /**
64    * @brief Downcast a handle to WidgetView handle.
65    *
66    * If the BaseHandle points is a WidgetView the downcast returns a valid handle.
67    * If not the returned handle is left empty.
68    *
69    * @since_tizen 3.0
70    * @param[in] handle Handle to an object
71    * @return handle to a WidgetView or an empty handle
72    */
73   static WidgetView DownCast( BaseHandle handle );
74
75   /**
76    * @brief Creates an empty handle.
77    * @since_tizen 3.0
78    */
79   WidgetView();
80
81   /**
82    * @brief Copy constructor.
83    *
84    * @since_tizen 3.0
85    * @param[in] handle The handle to copy from.
86    */
87   WidgetView( const WidgetView& handle );
88
89   /**
90    * @brief Assignment operator.
91    *
92    * @since_tizen 3.0
93    * @param[in] handle The handle to copy from.
94    * @return A reference to this.
95    */
96   WidgetView& operator=( const WidgetView& handle );
97
98   /**
99    * @brief Destructor
100    *
101    * This is non-virtual since derived Handle types must not contain data or virtual methods.
102    * @since_tizen 3.0
103    */
104   ~WidgetView();
105
106   /**
107    * @brief Get the id of the widget.
108    *
109    * @since_tizen 3.0
110    * @return The widget id on success, otherwise an empty string.
111    */
112   const std::string& GetWidgetId() const;
113
114   /**
115    * @brief Get the instance id of the widget.
116    *
117    * @since_tizen 3.0
118    * @return The instance id on success, otherwise an empty string.
119    */
120   const std::string& GetInstanceId() const;
121
122   /**
123    * @brief Get the content string of the widget.
124    * This string can be used for creating contents of widget again after reboot a device or recovered from crash(abnormal status).
125    *
126    * @since_tizen 3.0
127    * @return The content string to be recognize content of the widget or an empty string if there is no specific content string.
128    */
129   const std::string& GetContentInfo() const;
130
131   /**
132    * @brief Get the summarized string of the widget content for accessibility.
133    * If the accessibility feature is turned on, a viewer can use this text to describe the widget.
134    *
135    * @since_tizen 3.0
136    * @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.
137    */
138   const std::string& GetTitle() const;
139
140   /**
141    * @brief Get the update period of the widget.
142    *
143    * @since_tizen 3.0
144    * @return The update period of the widget.
145    */
146   double GetPeriod() const;
147
148   /**
149    * @brief Activate a widget in faulted state.
150    * A widget in faulted state MUST be activated before adding the widget.
151    *
152    * @since_tizen 3.0
153    * @privlevel public
154    * @privilege %http://tizen.org/privilege/widget.viewer
155    */
156   void ActivateFaultedWidget();
157
158   /**
159    * @brief Check whether the widget is faulted.
160    *
161    * @since_tizen 3.0
162    * @return true for faulted state, otherwise false.
163    */
164   bool IsWidgetFaulted();
165
166   /**
167    * @brief Set the deletion mode.
168    *
169    * @since_tizen 3.0
170    * @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.
171    */
172   void SetPermanentDelete( bool permanentDelete );
173
174 public: //Signals
175
176   typedef Signal< void ( WidgetView ) > WidgetViewSignalType;   ///< WidgetView signal type @since_tizen 3.0
177
178   /**
179    * @brief This signal is emitted when the widget is added.
180    *
181    * @since_tizen 3.0
182    * @return The signal to connect to.
183    */
184   WidgetViewSignalType& WidgetAddedSignal();
185
186   /**
187    * @brief This signal is emitted when the widget is deleted.
188    *
189    * @since_tizen 3.0
190    * @return The signal to connect to.
191    */
192   WidgetViewSignalType& WidgetDeletedSignal();
193
194 public: // Not intended for application developers
195
196   /**
197    * @brief Creates a handle using the WidgetView::Internal implementation.
198    *
199    * @since_tizen 3.0
200    * @param[in] implementation The WidgetView implementation.
201    */
202   DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
203
204   /**
205    * @brief Allows the creation of this control from an Internal::CustomActor pointer.
206    *
207    * @since_tizen 3.0
208    * @param[in] internal A pointer to the internal CustomActor.
209    */
210   DALI_INTERNAL WidgetView( Dali::Internal::CustomActor* internal );
211 };
212
213 /**
214  * @}
215  */
216 } // namespace WidgetView
217
218 } // namespace Dali
219
220 #endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_H__