1 #ifndef DALI_INTERNAL_WIDGET_APPLICATION_H
2 #define DALI_INTERNAL_WIDGET_APPLICATION_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifdef WIDGET_SUPPOERTED
23 #include <widget_base.h>
27 #include <application-impl.h>
28 #include <widget-application.h>
40 class WidgetApplication;
41 typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
44 * Implementation of the WidgetApplication class.
46 class WidgetApplication : public Application
50 #ifndef WIDGET_SUPPOERTED
51 typedef void* widget_base_instance_h;
53 typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction > CreateWidgetFunctionPair;
54 typedef std::vector< CreateWidgetFunctionPair > CreateWidgetFunctionContainer;
57 * Create a new widget application
58 * @param[in] argc A pointer to the number of arguments
59 * @param[in] argv A pointer to the argument list
60 * @param[in] stylesheet The path to user defined theme file
62 static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
67 * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
69 void RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction );
72 * Add widget name - CreateWidgetFunction pair to container.
74 void AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair );
77 * Find and get CreateWidgetFunctionPair in container by widget name.
79 CreateWidgetFunctionPair GetWidgetCreatingFunctionPair( const std::string& widgetName );
82 * Add widget_base_instance_h - Widget instance pair to container.
84 void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget );
87 * Find and get Widget instance in container by widget_base_instance_h.
89 Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance );
92 * Delete widget_base_instance_h - Widget instance pair in container.
94 void DeleteWidget( widget_base_instance_h widgetBaseInstance );
100 * @param[in] argc A pointer to the number of arguments
101 * @param[in] argv A pointer to the argument list
102 * @param[in] stylesheet The path to user defined theme file
104 WidgetApplication( int* argc, char **argv[], const std::string& stylesheet );
109 virtual ~WidgetApplication();
112 WidgetApplication(const Application&);
113 WidgetApplication& operator=(Application&);
117 typedef std::pair< widget_base_instance_h, Dali::Widget > WidgetInstancePair;
118 typedef std::vector< WidgetInstancePair > WidgetInstanceContainer;
120 CreateWidgetFunctionContainer mCreateWidgetFunctionContainer;
121 WidgetInstanceContainer mWidgetInstanceContainer;
125 inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
127 DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
129 BaseObject& handle = widgetApplication.GetBaseObject();
131 return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
134 inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
136 DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
138 const BaseObject& handle = widgetApplication.GetBaseObject();
140 return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
143 } // namespace Adaptor
145 } // namespace Internal
149 #endif // DALI_INTERNAL_WIDGET_APPLICATION_H