2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "widget-application-impl.h"
23 #include <widget-impl.h>
24 #include <widget-controller.h>
25 #include <dali/integration-api/debug.h>
36 WidgetApplicationPtr WidgetApplication::New(
39 const std::string& stylesheet)
41 WidgetApplicationPtr widgetApplication( new WidgetApplication (argc, argv, stylesheet ) );
42 return widgetApplication;
45 WidgetApplication::WidgetApplication( int* argc, char** argv[], const std::string& stylesheet )
46 :Application(argc, argv, stylesheet, Dali::WidgetApplication::OPAQUE, PositionSize(), Framework::WIDGET)
48 DALI_LOG_ERROR("WidgetApplication is not implemented in 3.0 tizen profile.\n");
51 WidgetApplication::~WidgetApplication()
56 void WidgetApplication::RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction )
60 void WidgetApplication::AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair )
62 mCreateWidgetFunctionContainer.push_back( pair );
65 WidgetApplication::CreateWidgetFunctionPair WidgetApplication::GetWidgetCreatingFunctionPair( const std::string& widgetName )
67 for( CreateWidgetFunctionContainer::const_iterator iter = mCreateWidgetFunctionContainer.begin(); iter != mCreateWidgetFunctionContainer.end(); ++iter )
69 if( widgetName.find((*iter).first) != std::string::npos )
75 return CreateWidgetFunctionPair( "", NULL );
78 void WidgetApplication::AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget )
80 mWidgetInstanceContainer.push_back( WidgetInstancePair(widgetBaseInstance, widget) );
83 Dali::Widget WidgetApplication::GetWidget( widget_base_instance_h widgetBaseInstance )
85 for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter )
87 if( (*iter).first == widgetBaseInstance )
89 return (*iter).second;
92 return Dali::Widget();
95 void WidgetApplication::DeleteWidget( widget_base_instance_h widgetBaseInstance )
97 for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter )
99 if( (*iter).first == widgetBaseInstance )
101 mWidgetInstanceContainer.erase(iter);
107 } // namespace Adaptor
109 } // namespace Internal