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 #include <widget_base.h>
25 #include <application-impl.h>
26 #include <widget-application.h>
38 class WidgetApplication;
39 typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
42 * Implementation of the WidgetApplication class.
44 class WidgetApplication : public Application
48 typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction > CreateWidgetFunctionPair;
49 typedef std::vector< CreateWidgetFunctionPair > CreateWidgetFunctionContainer;
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
57 static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
62 * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
64 void RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction );
67 * Add widget name - CreateWidgetFunction pair to container.
69 void AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair );
72 * Find and get CreateWidgetFunctionPair in container by widget name.
74 CreateWidgetFunctionPair GetWidgetCreatingFunctionPair( const std::string& widgetName );
77 * Add widget_base_instance_h - Widget instance pair to container.
79 void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget );
82 * Find and get Widget instance in container by widget_base_instance_h.
84 Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance );
87 * Delete widget_base_instance_h - Widget instance pair in container.
89 void DeleteWidget( widget_base_instance_h widgetBaseInstance );
95 * @param[in] argc A pointer to the number of arguments
96 * @param[in] argv A pointer to the argument list
97 * @param[in] stylesheet The path to user defined theme file
99 WidgetApplication( int* argc, char **argv[], const std::string& stylesheet );
104 virtual ~WidgetApplication();
107 WidgetApplication(const Application&);
108 WidgetApplication& operator=(Application&);
112 typedef std::pair< widget_base_instance_h, Dali::Widget > WidgetInstancePair;
113 typedef std::vector< WidgetInstancePair > WidgetInstanceContainer;
115 CreateWidgetFunctionContainer mCreateWidgetFunctionContainer;
116 WidgetInstanceContainer mWidgetInstanceContainer;
120 inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
122 DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
124 BaseObject& handle = widgetApplication.GetBaseObject();
126 return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
129 inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
131 DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
133 const BaseObject& handle = widgetApplication.GetBaseObject();
135 return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
138 } // namespace Adaptor
140 } // namespace Internal
144 #endif // DALI_INTERNAL_WIDGET_APPLICATION_H