X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=df7bb8cc04c6677e92998c00f836aac9e2ecb6a0;hb=543e89293214ebed96d22ac8aa5522e217ec18f9;hp=b41b6300ae3d247a5eea44f96fe4b2dfb0e134a6;hpb=12ba8f6537fee9e4ad8c4fc11bbbea01691833b2;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 b41b630..df7bb8c 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -32,11 +32,11 @@ #include // INTERNAL INCLUDES -#include -#include -#include #include #include +#include +#include +#include #include #include #include @@ -244,23 +244,27 @@ public: controlImpl.SetStyleName( value.Get< std::string >() ); break; } - case Toolkit::Control::Property::BACKGROUND: + + case Toolkit::Control::Property::BACKGROUND_COLOR: { + DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" ); + controlImpl.SetBackgroundColor( value.Get< Vector4 >() ); + break; + } + + case Toolkit::Control::Property::BACKGROUND_IMAGE: + { + DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" ); Image image = Scripting::NewImage( value ); if ( image ) { controlImpl.SetBackgroundImage( image ); - break; } - const Property::Map* map = value.GetMap(); - if( map ) + else { - controlImpl.SetBackground( *map ); - break; + // An empty map means the background is no longer required + controlImpl.ClearBackground(); } - - // The background is neither a valid image nor a property map, so it is no longer required - controlImpl.ClearBackground(); break; } @@ -276,6 +280,26 @@ public: } break; } + + case Toolkit::Control::Property::BACKGROUND: + { + Image image = Scripting::NewImage( value ); + if ( image ) + { + controlImpl.SetBackgroundImage( image ); + break; + } + const Property::Map* map = value.GetMap(); + if( map ) + { + controlImpl.SetBackground( *map ); + break; + } + + // The background is neither a valid image nor a property map, so it is no longer required + controlImpl.ClearBackground(); + break; + } } } } @@ -304,14 +328,21 @@ public: break; } - case Toolkit::Control::Property::BACKGROUND: + case Toolkit::Control::Property::BACKGROUND_COLOR: { + DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" ); + value = controlImpl.GetBackgroundColor(); + break; + } + + case Toolkit::Control::Property::BACKGROUND_IMAGE: + { + DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" ); Property::Map map; if( controlImpl.mImpl->mBackgroundRenderer ) { - (controlImpl.mImpl->mBackgroundRenderer).CreatePropertyMap( map ); + controlImpl.mImpl->mBackgroundRenderer.CreatePropertyMap( map ); } - value = map; break; } @@ -321,6 +352,19 @@ public: value = controlImpl.HasKeyInputFocus(); break; } + + case Toolkit::Control::Property::BACKGROUND: + { + Property::Map map; + if( controlImpl.mImpl->mBackgroundRenderer ) + { + (controlImpl.mImpl->mBackgroundRenderer).CreatePropertyMap( map ); + } + + value = map; + break; + } + } } @@ -349,15 +393,19 @@ public: bool mAddRemoveBackgroundChild:1; ///< Flag to know when we are adding or removing our own actor to avoid call to OnControlChildAdd // Properties - these need to be members of Internal::Control::Impl as they need to function within this class. - static PropertyRegistration PROPERTY_1; - static PropertyRegistration PROPERTY_2; - static PropertyRegistration PROPERTY_3; + static const PropertyRegistration PROPERTY_1; + static const PropertyRegistration PROPERTY_2; + static const PropertyRegistration PROPERTY_3; + static const PropertyRegistration PROPERTY_4; + static const PropertyRegistration PROPERTY_5; }; // Properties registered without macro to use specific member variables. -PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); -PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); +const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); Toolkit::Control Control::New() { @@ -404,7 +452,7 @@ void Control::SetBackgroundColor( const Vector4& color ) Actor self( Self() ); Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get(); factory.ResetRenderer( mImpl->mBackgroundRenderer, self, color ); - mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX ); + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); } Vector4 Control::GetBackgroundColor() const @@ -440,7 +488,7 @@ void Control::SetBackground(const Property::Map& map) mImpl->mBackgroundRenderer = factory.GetControlRenderer( map ); if( mImpl->mBackgroundRenderer && self.OnStage() ) // Request control renderer with a property map might return an empty handle { - mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX ); + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); mImpl->mBackgroundRenderer.SetOnStage( self ); } } @@ -450,7 +498,7 @@ void Control::SetBackgroundImage( Image image ) Actor self( Self() ); Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get(); factory.ResetRenderer( mImpl->mBackgroundRenderer, self, image ); - mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX ); + mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND ); } void Control::ClearBackground()