Add widget_viewer_dali
[platform/core/uifw/widget-viewer-dali.git] / internal / widget_view / widget_view_impl.h
1 #ifndef __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__
2 #define __DALI_WIDGET_VIEW_INTERNAL_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 // INTERNAL INCLUDES
22 #include <public_api/widget_view/widget_view.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <pepper-dali/public-api/object-view/object-view.h>
27 #include <bundle.h>
28
29 namespace Dali
30 {
31
32 namespace WidgetView
33 {
34
35 namespace Internal
36 {
37
38 class WidgetView : public Toolkit::Internal::Control
39 {
40 public:
41
42   /**
43    * @copydoc Dali::WidgetView::WidgetView::New
44    */
45   static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
46
47   /**
48    * @copydoc Dali::WidgetView::WidgetView::GetWidgetId
49    */
50   const std::string& GetWidgetId() const;
51
52   /**
53    * @copydoc Dali::WidgetView::WidgetView::GetInstanceId
54    */
55   const std::string& GetInstanceId() const;
56
57   /**
58    * @copydoc Dali::WidgetView::WidgetView::GetContentInfo
59    */
60   const std::string& GetContentInfo() const;
61
62   /**
63    * @copydoc Dali::WidgetView::WidgetView::GetTitle
64    */
65   const std::string& GetTitle() const;
66
67   /**
68    * @copydoc Dali::WidgetView::WidgetView::GetPeriod
69    */
70   double GetPeriod() const;
71
72   /**
73    * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
74    */
75   void ActivateFaultedWidget();
76
77   /**
78    * @copydoc Dali::WidgetView::WidgetView::IsWidgetFaulted
79    */
80   bool IsWidgetFaulted();
81
82   /**
83    * @copydoc Dali::WidgetView::WidgetView::SetPermanentDelete
84    */
85   void SetPermanentDelete( bool permanentDelete );
86
87   void AddObjectView( Pepper::ObjectView objectView );
88   void RemoveObjectView();
89
90 public: //Signals
91
92   Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAddedSignal();
93   Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetDeletedSignal();
94
95 protected:
96
97   /**
98    * Construct a new WidgetView.
99    */
100   WidgetView();
101
102   /**
103    * Construct a new WidgetView.
104    */
105   WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
106
107   /**
108    * A reference counted object may only be deleted by calling Unreference()
109    */
110   virtual ~WidgetView();
111
112 private: // From Control
113
114   /**
115    * @copydoc Toolkit::Control::OnInitialize()
116    */
117   virtual void OnInitialize();
118
119 private:
120
121   // Undefined
122   WidgetView( const WidgetView& );
123
124   // Undefined
125   WidgetView& operator= ( const WidgetView& );
126
127 private:
128
129   Pepper::ObjectView mObjectView;
130
131   std::string mWidgetId;
132   std::string mInstanceId;
133   std::string mContentInfo;
134   std::string mTitle;
135
136   bundle* mBundle;
137
138   int mWidth;
139   int mHeight;
140   int mPid;
141   double mPeriod;
142
143   bool mPermanentDelete;
144
145   // Signals
146   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;
147   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetDeletedSignal;
148 };
149
150 } // namespace Internal
151
152 // Helpers for public-api forwarding methods
153
154 inline Internal::WidgetView& GetImplementation( WidgetView& widgetView )
155 {
156   DALI_ASSERT_ALWAYS( widgetView );
157
158   Dali::RefObject& handle = widgetView.GetImplementation();
159
160   return static_cast<Internal::WidgetView&>( handle );
161 }
162
163 inline const Internal::WidgetView& GetImplementation( const WidgetView& widgetView )
164 {
165   DALI_ASSERT_ALWAYS( widgetView );
166
167   const Dali::RefObject& handle = widgetView.GetImplementation();
168
169   return static_cast<const Internal::WidgetView&>( handle );
170 }
171
172 } // namespace WidgetView
173
174 } // namespace Dali
175
176 #endif // __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__