-
- StopTransitionAnimation();
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- default:
- {
- break;
- }
- }
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
-}
-
-void PushButton::StopAllAnimations()
-{
- StopTransitionAnimation();
-}
-
-void PushButton::OnControlSizeSet( const Vector3& targetSize )
-{
- if( targetSize != mSize )
- {
- mSize = targetSize;
-
- Actor& label = GetLabel();
-
- if( label )
- {
- label.SetSize( mSize );
- }
- }
-}
-
-Vector3 PushButton::GetNaturalSize()
-{
- Vector3 size;
-
- // Check Image and Background image and use the largest size as the control's Natural size.
- SizeOfActorIfLarger( GetButtonImage(), size );
- SizeOfActorIfLarger( GetBackgroundImage(), size );
-
- // If label, test against it's size
- Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( GetLabel() );
- if( label )
- {
- Vector3 labelSize = label.GetNaturalSize();
-
- size.width = std::max( size.width, labelSize.width + TEXT_PADDING * 2.0f );
- size.height = std::max( size.height, labelSize.height + TEXT_PADDING * 2.0f );
- }
-
- return size;
-}
-
-void PushButton::StartTransitionAnimation()
-{
- if( mTransitionAnimation )
- {
- mTransitionAnimation.FinishedSignal().Connect( this, &PushButton::TransitionAnimationFinished );
- mTransitionAnimation.Play();
- }
-}
-
-void PushButton::StopTransitionAnimation( bool remove )
-{
- if( mTransitionAnimation )
- {
- mTransitionAnimation.Clear();
- mTransitionAnimation.Reset();
- }
-
- if( remove )
- {
- UpdatePaintTransitionState();
- }
-}
-
-void PushButton::FadeInImage( Actor& image, float opacity, Vector3 scale )
-{
- if( image )
- {
- image.SetOpacity( opacity );
- image.SetScale( scale );
-
- if( !mTransitionAnimation )
- {
- mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
- }
-
- mTransitionAnimation.AnimateTo( Property( image, Actor::Property::COLOR_ALPHA ), 1.f );
- }
-}
-
-void PushButton::FadeOutImage( Actor& image, float opacity, Vector3 scale )
-{
- if( image )
- {
- image.SetOpacity( opacity );
- image.SetScale( scale );
-
- if( !mTransitionAnimation )
- {
- mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );