[widget-viewer-dali] Change the license as Flora
[platform/core/uifw/widget-viewer-dali.git] / internal / widget_view_manager / widget_view_manager_impl.h
1 #ifndef __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__
2 #define __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__
3
4 /*
5  * Samsung API
6  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7  *
8  * Licensed under the Flora License, Version 1.1 (the License);
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://floralicense.org/license/
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an AS IS BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 // INTERNAL INCLUDES
22 #include <public_api/widget_view_manager/widget_view_manager.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/object/base-object.h>
26 #include <pepper-dali/public-api/compositor/compositor.h>
27 #include <map>
28
29 namespace Dali
30 {
31
32 namespace WidgetView
33 {
34
35 namespace Internal
36 {
37
38 class WidgetViewManager;
39 typedef IntrusivePtr<WidgetViewManager> WidgetViewManagerPtr;
40
41 class WidgetViewManager : public BaseObject, public ConnectionTracker
42 {
43 public:
44
45   /**
46    * @copydoc Dali::WidgetView::WidgetViewManager::New()
47    */
48   static WidgetViewManagerPtr New( Application application, const std::string& name );
49
50   /**
51    * @copydoc Dali::WidgetView::WidgetViewManager::AddWidget()
52    */
53   Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
54
55 private:
56
57   /**
58    * Construct a new WidgetViewManager.
59    */
60   WidgetViewManager();
61
62   /**
63    * A reference counted object may only be deleted by calling Unreference()
64    */
65   virtual ~WidgetViewManager();
66
67   /**
68    * Initialize the WidgetViewManager
69    */
70   int Initialize( Application application, const std::string& name );
71
72   void OnObjectViewAdded( Pepper::Compositor compositor, Pepper::ObjectView objectView );
73   void OnObjectViewDeleted( Pepper::Compositor compositor, Pepper::ObjectView objectView );
74
75   static int WidgetEventCallback( const char* widgetId, const char* instanceId, int event, void* data );
76
77 private:
78
79   // Undefined
80   WidgetViewManager( const WidgetViewManager& );
81
82   // Undefined
83   WidgetViewManager& operator= ( const WidgetViewManager& );
84
85 private:
86
87   Pepper::Compositor mCompositor;
88
89   typedef std::map<std::string, Dali::WidgetView::WidgetView> WidgetViewContainer;
90   typedef WidgetViewContainer::iterator WidgetViewIter;
91
92   WidgetViewContainer mWidgetViewContainer;
93 };
94
95 } // namespace Internal
96
97 // Helpers for public-api forwarding methods
98
99 inline Internal::WidgetViewManager& GetImplementation( WidgetViewManager& obj )
100 {
101   DALI_ASSERT_ALWAYS( obj );
102
103   Dali::BaseObject& handle = obj.GetBaseObject();
104
105   return static_cast<Internal::WidgetViewManager&>( handle );
106 }
107
108 inline const Internal::WidgetViewManager& GetImplementation( const WidgetViewManager& obj )
109 {
110   DALI_ASSERT_ALWAYS( obj );
111
112   const Dali::BaseObject& handle = obj.GetBaseObject();
113
114   return static_cast<const Internal::WidgetViewManager&>( handle );
115 }
116
117 } // namespace WidgetView
118
119 } // namespace Dali
120
121 #endif // __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__