Enabled sampler arrays in shader
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / widget-application-impl.h
1 #ifndef DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H
2 #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H
3
4 /*
5  * Copyright (c) 2021 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 <dali/internal/adaptor/common/application-impl.h>
23 #include <dali/public-api/adaptor-framework/widget-application.h>
24
25 #include <memory>
26
27 namespace Dali
28 {
29 class Widget;
30
31 namespace Internal
32 {
33 namespace Adaptor
34 {
35 typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
36
37 /**
38  * Implementation of the WidgetApplication class.
39  */
40 class WidgetApplication : public Application
41 {
42 public:
43   typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction> CreateWidgetFunctionPair;
44   typedef std::vector<CreateWidgetFunctionPair>                                       CreateWidgetFunctionContainer;
45
46   /**
47    * Create a new widget application
48    * @param[in]  argc         A pointer to the number of arguments
49    * @param[in]  argv         A pointer to the argument list
50    * @param[in]  stylesheet   The path to user defined theme file
51    */
52   static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet);
53
54 public:
55   /**
56    * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
57    */
58   virtual void RegisterWidgetCreatingFunction(const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction);
59
60 protected:
61   /**
62    * Private Constructor
63    * @param[in]  argc         A pointer to the number of arguments
64    * @param[in]  argv         A pointer to the argument list
65    * @param[in]  stylesheet   The path to user defined theme file
66    */
67   WidgetApplication(int* argc, char** argv[], const std::string& stylesheet);
68
69   /**
70    * Destructor
71    */
72   virtual ~WidgetApplication();
73
74   // Undefined
75   WidgetApplication(const Application&) = delete;
76   WidgetApplication& operator=(Application&) = delete;
77 };
78
79 inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
80 {
81   DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
82
83   BaseObject& handle = widgetApplication.GetBaseObject();
84
85   return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
86 }
87
88 inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
89 {
90   DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
91
92   const BaseObject& handle = widgetApplication.GetBaseObject();
93
94   return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
95 }
96
97 } // namespace Adaptor
98
99 } // namespace Internal
100
101 } // namespace Dali
102
103 #endif // DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H