2 * Copyright (c) 2015 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.
18 #include "renderer-factory-impl.h"
21 #include <dali/integration-api/debug.h>
22 #include <dali/public-api/object/property-array.h>
23 #include <dali/public-api/object/type-registry.h>
24 #include <dali/devel-api/object/type-registry-helper.h>
27 #include <dali-toolkit/internal/controls/renderers/color/color-renderer.h>
28 #include <dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h>
29 #include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
33 const char * const RENDERER_TYPE_NAME( "renderer-type" );
34 const char * const COLOR_RENDERER("color-renderer");
35 const char * const GRADIENT_RENDERER("gradient-renderer");
52 BaseHandle handle = Toolkit::RendererFactory::Get();
57 DALI_TYPE_REGISTRATION_BEGIN_CREATE( Toolkit::RendererFactory, Dali::BaseHandle, Create, true )
58 DALI_TYPE_REGISTRATION_END()
62 RendererFactory::RendererFactory()
66 RendererFactory::~RendererFactory()
70 Toolkit::ControlRenderer RendererFactory::GetControlRenderer( const Property::Map& propertyMap )
72 ControlRenderer* rendererPtr = NULL;
74 Property::Value* type = propertyMap.Find( RENDERER_TYPE_NAME );
75 std::string typeValue ;
76 if( type && type->Get( typeValue ))
78 if( typeValue == COLOR_RENDERER )
80 rendererPtr = new ColorRenderer();
82 else if( typeValue == GRADIENT_RENDERER )
84 rendererPtr = new GradientRenderer();
92 mFactoryCache = new RendererFactoryCache();
94 rendererPtr->Initialize( *( mFactoryCache.Get() ), propertyMap );
98 DALI_LOG_ERROR( "Renderer type unknown" );
101 return Toolkit::ControlRenderer(rendererPtr);
104 } // namespace Internal
106 } // namespace Toolkit