-void PushButton::OnLabelSet()
-{
- Actor& label = GetLabelActor();
-
- if( label )
- {
- Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( label );
- if( textLabel )
- {
- textLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, false );
- }
- }
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnButtonImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnSelectedImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnBackgroundImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnSelectedBackgroundImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnDisabledImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnDisabledSelectedImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnDisabledBackgroundImageSet()
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::OnSizeSet( const Vector3& targetSize )
-{
- if( targetSize != mSize )
- {
- mSize = targetSize;
-
- Actor& label = GetLabelActor();
-
- if( label )
- {
- label.SetSize( mSize );
- }
- }
-}
-
-void PushButton::PrepareForTranstionIn( Actor actor )
-{
- actor.SetOpacity( 0.0f );
-}
-
-void PushButton::PrepareForTranstionOut( Actor actor )
-{
- actor.SetOpacity( 1.0f );
-}
-
-void PushButton::OnTransitionIn( Actor actor )
-{
- FadeImageTo( actor, 1.f );
-}
-
-void PushButton::OnTransitionOut( Actor actor )
-{
- FadeImageTo( actor, 0.0f );
-}
-
-void PushButton::FadeImageTo( Actor actor, float opacity )
-{
- if( actor )
- {
- Dali::Animation transitionAnimation = GetTransitionAnimation();
- DALI_ASSERT_DEBUG( transitionAnimation );
-
- if( transitionAnimation )
- {
- transitionAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), opacity );
- }
- }
-}
-
-Vector3 PushButton::GetNaturalSize()
-{
- Vector3 size;
-
- // If label, test against it's size
- Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( GetLabelActor() );
-
- Actor icon = GetDecoration( UNSELECTED_DECORATION );
- if( label || icon )
- {
- Vector3 labelSize( Vector3::ZERO );
- Vector3 iconSize( Vector3::ZERO );
-
- if( label )
- {
- Vector3 labelNaturalSize = label.GetNaturalSize();
- labelSize.width = labelNaturalSize.width + mLabelPadding.left + mLabelPadding.right;
- labelSize.height = labelNaturalSize.height + mLabelPadding.top + mLabelPadding.bottom;
- }
-
- if( icon )
- {
- Vector3 iconNaturalSize = icon.GetNaturalSize();
- iconSize.width = iconNaturalSize.width + mIconPadding.left + mIconPadding.right;
- iconSize.height = iconNaturalSize.height + mIconPadding.top + mIconPadding.bottom;
-
- switch( mIconAlignment )
- {
- case LEFT:
- case RIGHT:
- {
- size.width = labelSize.width + iconSize.width;
- size.height = std::max( labelSize.height, iconSize.height );
- break;
- }
- case TOP:
- case BOTTOM:
- {
- size.width = std::max( labelSize.width, iconSize.width );
- size.height = labelSize.height + iconSize.height;
- break;
- }
- }
- }
- else
- {
- // No icon, so size is the same as label size.
- // (If there is no label this is zero).
- size = labelSize;
- }
- }
- else
- {
- // Check Image and Background image and use the largest size as the control's Natural size.
- SizeOfActorIfLarger( GetUnselectedImage(), size );
- SizeOfActorIfLarger( GetBackgroundImage(), size );
- }
-
- return size;
-}
-
-void PushButton::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
-{
- ConfigureSizeNegotiation();
-}
-
-void PushButton::ConfigureSizeNegotiation()