X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=0a2c3c87546bd98177cc6fdace1063d4660c9868;hb=9fff4fa5534b563329dc8cd6c0598888f667ee39;hp=841e3d35c471ba0be881ba68fbc3c940568876c5;hpb=e84f2b4052f5a042c6a08d02b87e771bac5ddf44;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 841e3d3..0a2c3c8 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,12 +34,13 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include -#include #include #include +#include namespace Dali { @@ -163,8 +164,6 @@ TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &Do DALI_TYPE_REGISTRATION_END() -const char * const COLOR_RENDERER_COLOR_NAME("blendColor"); - } // unnamed namespace namespace Internal @@ -179,6 +178,7 @@ public: : mControlImpl( controlImpl ), mStyleName(""), mBackgroundRenderer(), + mBackgroundColor(Color::TRANSPARENT), mStartingPinchScale( NULL ), mKeyEventSignal(), mPinchGestureDetector(), @@ -369,6 +369,7 @@ public: Control& mControlImpl; std::string mStyleName; Toolkit::ControlRenderer 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; Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusGainedSignal; @@ -442,47 +443,40 @@ const std::string& Control::GetStyleName() const void Control::SetBackgroundColor( const Vector4& 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; + InitializeControlRenderer( self, mImpl->mBackgroundRenderer, map ); + if( mImpl->mBackgroundRenderer ) + { + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + } } Vector4 Control::GetBackgroundColor() const { - if( mImpl->mBackgroundRenderer && ( &typeid( GetImplementation(mImpl->mBackgroundRenderer) ) == &typeid( ColorRenderer ) ) ) - { - Property::Map map; - mImpl->mBackgroundRenderer.CreatePropertyMap( map ); - const Property::Value* colorValue = map.Find( COLOR_RENDERER_COLOR_NAME ); - Vector4 color; - if( colorValue && colorValue->Get(color)) - { - return color; - } - } - - return Color::TRANSPARENT; + 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 + InitializeControlRenderer( 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 ); + InitializeControlRenderer( self, mImpl->mBackgroundRenderer, image ); + if( mImpl->mBackgroundRenderer ) + { + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); + } } void Control::ClearBackground() @@ -674,12 +668,12 @@ Toolkit::Control::KeyEventSignalType& Control::KeyEventSignal() return mImpl->mKeyEventSignal; } -Toolkit::Control::KeyInputFocusSignalType& Control:: KeyInputFocusGainedSignal() +Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { return mImpl->mKeyInputFocusGainedSignal; } -Toolkit::Control::KeyInputFocusSignalType& Control:: KeyInputFocusLostSignal() +Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { return mImpl->mKeyInputFocusLostSignal; } @@ -720,15 +714,18 @@ void Control::Initialize() if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS ) { - Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); + Toolkit::StyleManager styleManager = StyleManager::Get(); + // if stylemanager is available if( styleManager ) { + StyleManager& styleManagerImpl = GetImpl( styleManager ); + // Register for style changes - styleManager.StyleChangeSignal().Connect( this, &Control::OnStyleChange ); + styleManagerImpl.ControlStyleChangeSignal().Connect( this, &Control::OnStyleChange ); // Apply the current style - GetImpl( styleManager ).ApplyThemeStyleAtInit( Toolkit::Control( GetOwner() ) ); + styleManagerImpl.ApplyThemeStyleAtInit( Toolkit::Control( GetOwner() ) ); } }