summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dd6db6b)
Previously control-impl registered a backgrounf visual but also kept a handle to it as member variable.
Now GetVisual is called when the background visual is needed. The member handle is removed.
Passing an empty map for SetProperty( Property::BACKGROUND ) unregisters and removes the background visual
Change-Id: Iff835223e67b96f4cbaaf5296a30fb4cb404981d
Impl(Control& controlImpl)
: mControlImpl( controlImpl ),
mStyleName(""),
Impl(Control& controlImpl)
: mControlImpl( controlImpl ),
mStyleName(""),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
mKeyEventSignal(),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
mKeyEventSignal(),
- // An empty map means the background is no longer required
+ // An empty image means the background is no longer required
controlImpl.ClearBackground();
}
break;
controlImpl.ClearBackground();
}
break;
case Toolkit::Control::Property::BACKGROUND:
{
const Property::Map* map = value.GetMap();
case Toolkit::Control::Property::BACKGROUND:
{
const Property::Map* map = value.GetMap();
+ if( map && !map->Empty() )
{
controlImpl.SetBackground( *map );
}
else
{
{
controlImpl.SetBackground( *map );
}
else
{
- // The background is not a property map, so we should clear the background
+ // The background is an empty property map, so we should clear the background
controlImpl.ClearBackground();
}
break;
controlImpl.ClearBackground();
}
break;
{
DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
Property::Map map;
{
DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
Property::Map map;
- if( controlImpl.mImpl->mBackgroundVisual )
+ Toolkit::Visual::Base visual = controlImpl.GetVisual( Toolkit::Control::Property::BACKGROUND );
+ if( visual )
- controlImpl.mImpl->mBackgroundVisual.CreatePropertyMap( map );
+ visual.CreatePropertyMap( map );
case Toolkit::Control::Property::BACKGROUND:
{
Property::Map map;
case Toolkit::Control::Property::BACKGROUND:
{
Property::Map map;
- if( controlImpl.mImpl->mBackgroundVisual )
+ Toolkit::Visual::Base visual = controlImpl.GetVisual( Toolkit::Control::Property::BACKGROUND );
+ if( visual )
- (controlImpl.mImpl->mBackgroundVisual).CreatePropertyMap( map );
+ visual.CreatePropertyMap( map );
Control& mControlImpl;
RegisteredVisualContainer mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
Control& mControlImpl;
RegisteredVisualContainer mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
- Toolkit::Visual::Base mBackgroundVisual; ///< The visual to render the background
Vector4 mBackgroundColor; ///< The color of the background visual
Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
Toolkit::Control::KeyEventSignalType mKeyEventSignal;
Vector4 mBackgroundColor; ///< The color of the background visual
Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
Toolkit::Control::KeyEventSignalType mKeyEventSignal;
Property::Map map;
map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
Property::Map map;
map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
- mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
- if( mImpl->mBackgroundVisual )
- {
- mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
- }
+
+ SetBackground( map );
}
Vector4 Control::GetBackgroundColor() const
}
Vector4 Control::GetBackgroundColor() const
void Control::SetBackground( const Property::Map& map )
{
void Control::SetBackground( const Property::Map& map )
{
- mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
- if( mImpl->mBackgroundVisual )
+ Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
+ if( visual )
- mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
+ visual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
void Control::SetBackgroundImage( Image image )
{
}
}
void Control::SetBackgroundImage( Image image )
{
- mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
- RegisterVisual( Toolkit::Control::Property::BACKGROUND, mImpl->mBackgroundVisual );
- if( mImpl->mBackgroundVisual )
+ DALI_LOG_WARNING( "SetBackgroundImage is for the depreciated Property::BACKGROUND_IMAGE use SetBackground( const Property::Map& map )\n" );
+ Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( image );
+ if( visual )
- mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
+ visual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
void Control::ClearBackground()
{
}
}
void Control::ClearBackground()
{
- if( mImpl->mBackgroundVisual )
- {
- UnregisterVisual( Toolkit::Control::Property::BACKGROUND );
- mImpl->mBackgroundVisual.Reset();
- }
- mImpl->mBackgroundColor = Color::TRANSPARENT;
+ UnregisterVisual( Toolkit::Control::Property::BACKGROUND );
+ mImpl->mBackgroundColor = Color::TRANSPARENT;
}
void Control::EnableGestureDetection(Gesture::Type type)
}
void Control::EnableGestureDetection(Gesture::Type type)
void Control::OnSizeSet(const Vector3& targetSize)
{
void Control::OnSizeSet(const Vector3& targetSize)
{
- if( mImpl->mBackgroundVisual )
+ Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND );
+ if( visual )
{
Vector2 size( targetSize );
{
Vector2 size( targetSize );
- mImpl->mBackgroundVisual.SetSize( size );
+ visual.SetSize( size );
Vector3 Control::GetNaturalSize()
{
Vector3 Control::GetNaturalSize()
{
- if( mImpl->mBackgroundVisual )
+ Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND );
+ if( visual )
- mImpl->mBackgroundVisual.GetNaturalSize(naturalSize);
- return Vector3(naturalSize);
+ visual.GetNaturalSize( naturalSize );
+ return Vector3( naturalSize );
}
return Vector3::ZERO;
}
}
return Vector3::ZERO;
}