Merge "Changes needed for https://review.tizen.org/gerrit/#/c/191202/" into devel...
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / tizen / widget-application-impl-tizen.h
1 #ifndef DALI_INTERNAL_WIDGET_APPLICATION_TIZEN_H
2 #define DALI_INTERNAL_WIDGET_APPLICATION_TIZEN_H
3
4 /*
5  * Copyright (c) 2017 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 #ifdef WIDGET_SUPPOERTED
23 #include <widget_base.h>
24 #endif
25
26 // INTERNAL INCLUDES
27 #include <dali/internal/adaptor/common/application-impl.h>
28 #include <dali/internal/system/common/widget-application-impl.h>
29
30 #ifndef WIDGET_SUPPOERTED
31 typedef void* widget_base_instance_h;
32 #endif
33
34 namespace Dali
35 {
36 class Widget;
37
38 namespace Internal
39 {
40
41 namespace Adaptor
42 {
43
44 class WidgetApplication;
45 typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
46
47 /**
48  * Implementation of the WidgetApplication class.
49  */
50 class WidgetApplicationTizen : public WidgetApplication
51 {
52 public:
53
54   typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction >  CreateWidgetFunctionPair;
55   typedef std::vector< CreateWidgetFunctionPair >   CreateWidgetFunctionContainer;
56
57   /**
58    * Create a new widget application
59    * @param[in]  argc         A pointer to the number of arguments
60    * @param[in]  argv         A pointer to the argument list
61    * @param[in]  stylesheet   The path to user defined theme file
62    */
63   static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
64
65 public:
66
67   /**
68    * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
69    */
70   void RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction ) override;
71
72   /**
73    * Add widget name - CreateWidgetFunction pair to container.
74    */
75   void AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair );
76
77   /**
78    * Find and get CreateWidgetFunctionPair in container by widget name.
79    */
80   CreateWidgetFunctionPair GetWidgetCreatingFunctionPair( const std::string& widgetName );
81
82   /**
83    * Add widget_base_instance_h - Widget instance pair to container.
84    */
85   void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget );
86
87   /**
88    * Find and get Widget instance in container by widget_base_instance_h.
89    */
90   Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance );
91
92   /**
93    * Delete widget_base_instance_h - Widget instance pair in container.
94    */
95   void DeleteWidget( widget_base_instance_h widgetBaseInstance );
96
97 protected:
98
99   /**
100    * Private Constructor
101    * @param[in]  argc         A pointer to the number of arguments
102    * @param[in]  argv         A pointer to the argument list
103    * @param[in]  stylesheet   The path to user defined theme file
104    */
105   WidgetApplicationTizen( int* argc, char **argv[], const std::string& stylesheet );
106
107   /**
108    * Destructor
109    */
110   virtual ~WidgetApplicationTizen();
111
112   WidgetApplicationTizen(const Application&) = delete;
113   WidgetApplicationTizen& operator=(Application&) = delete;
114
115 private:
116
117   typedef std::pair< widget_base_instance_h, Dali::Widget > WidgetInstancePair;
118   typedef std::vector< WidgetInstancePair >                 WidgetInstanceContainer;
119
120   CreateWidgetFunctionContainer  mCreateWidgetFunctionContainer;
121   WidgetInstanceContainer        mWidgetInstanceContainer;
122
123 };
124
125 } // namespace Adaptor
126
127 } // namespace Internal
128
129 } // namespace Dali
130
131 #endif // DALI_INTERNAL_WIDGET_APPLICATION_TIZEN_H