9489787af586f63086de27b5e1fa2a8aee9eef81
[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 <map>
27
28 namespace Dali
29 {
30
31 namespace WidgetView
32 {
33
34 namespace Internal
35 {
36
37 class WidgetViewManager;
38 typedef IntrusivePtr<WidgetViewManager> WidgetViewManagerPtr;
39
40 class WidgetViewManager : public BaseObject, public ConnectionTracker
41 {
42 public:
43
44   /**
45    * @copydoc Dali::WidgetView::WidgetViewManager::New()
46    */
47   static WidgetViewManagerPtr New( Application application, const std::string& name );
48
49   /**
50    * @copydoc Dali::WidgetView::WidgetViewManager::AddWidget()
51    */
52   Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
53
54 private:
55
56   /**
57    * Construct a new WidgetViewManager.
58    */
59   WidgetViewManager();
60
61   /**
62    * A reference counted object may only be deleted by calling Unreference()
63    */
64   virtual ~WidgetViewManager();
65
66   /**
67    * Initialize the WidgetViewManager
68    */
69   int Initialize( Application application, const std::string& name );
70
71   static int WidgetEventCallback( const char* widgetId, const char* instanceId, int event, void* data );
72
73 private:
74
75   // Undefined
76   WidgetViewManager( const WidgetViewManager& );
77
78   // Undefined
79   WidgetViewManager& operator= ( const WidgetViewManager& );
80
81 private:
82
83   typedef std::map<std::string, Dali::WidgetView::WidgetView> WidgetViewContainer;
84   typedef WidgetViewContainer::iterator WidgetViewIter;
85
86   WidgetViewContainer mWidgetViewContainer;
87 };
88
89 } // namespace Internal
90
91 // Helpers for public-api forwarding methods
92
93 inline Internal::WidgetViewManager& GetImplementation( WidgetViewManager& obj )
94 {
95   DALI_ASSERT_ALWAYS( obj );
96
97   Dali::BaseObject& handle = obj.GetBaseObject();
98
99   return static_cast<Internal::WidgetViewManager&>( handle );
100 }
101
102 inline const Internal::WidgetViewManager& GetImplementation( const WidgetViewManager& obj )
103 {
104   DALI_ASSERT_ALWAYS( obj );
105
106   const Dali::BaseObject& handle = obj.GetBaseObject();
107
108   return static_cast<const Internal::WidgetViewManager&>( handle );
109 }
110
111 } // namespace WidgetView
112
113 } // namespace Dali
114
115 #endif // __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__