X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=a736f7d8f7fd9a0b24bdb3334e4f087f1a5f5c23;hp=ef276bbcd868b07d7908a61cbad23ec76abcf15b;hb=99e2ea03e6d6059f5803d700932df1ff1c848cd3;hpb=41278d3fb755de3cb89edf6d80603b18562b4e01 diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index ef276bb..a736f7d 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ #include #include #include -#include #include -#include +#include +#include #include #include @@ -36,10 +36,11 @@ #include #include #include -#include +#include #include #include -#include +#include +#include namespace Dali { @@ -367,7 +368,7 @@ public: Control& mControlImpl; std::string mStyleName; - Toolkit::ControlRenderer mBackgroundRenderer; ///< The control renderer to render the background + Toolkit::Visual::Base mBackgroundRenderer; ///< The control renderer to render the background Vector4 mBackgroundColor; ///< The color of the background renderer Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this Toolkit::Control::KeyEventSignalType mKeyEventSignal; @@ -441,12 +442,16 @@ const std::string& Control::GetStyleName() const void Control::SetBackgroundColor( const Vector4& color ) { - mImpl->mBackgroundColor = color; - Actor self( Self() ); - Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get(); - factory.ResetRenderer( mImpl->mBackgroundRenderer, self, color ); - mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + mImpl->mBackgroundColor = color; + Property::Map map; + map[ RENDERER_TYPE ] = COLOR_RENDERER; + map[ "mixColor" ] = color; + InitializeVisual( self, mImpl->mBackgroundRenderer, map ); + if( mImpl->mBackgroundRenderer ) + { + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + } } Vector4 Control::GetBackgroundColor() const @@ -454,25 +459,24 @@ Vector4 Control::GetBackgroundColor() const return mImpl->mBackgroundColor; } -void Control::SetBackground(const Property::Map& map) +void Control::SetBackground( const Property::Map& map ) { Actor self( Self() ); - mImpl->mBackgroundRenderer.RemoveAndReset( self ); - Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get(); - mImpl->mBackgroundRenderer = factory.GetControlRenderer( map ); - if( mImpl->mBackgroundRenderer && self.OnStage() ) // Request control renderer with a property map might return an empty handle + InitializeVisual( self, mImpl->mBackgroundRenderer, map ); + if( mImpl->mBackgroundRenderer ) { mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); - mImpl->mBackgroundRenderer.SetOnStage( self ); } } void Control::SetBackgroundImage( Image image ) { Actor self( Self() ); - Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get(); - factory.ResetRenderer( mImpl->mBackgroundRenderer, self, image ); - mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + InitializeVisual( self, mImpl->mBackgroundRenderer, image ); + if( mImpl->mBackgroundRenderer ) + { + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + } } void Control::ClearBackground()