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