-bool PushButton::OnSelected()
-{
- Actor& buttonImage = GetButtonImage();
- Actor& selectedImage = GetSelectedImage();
- Actor& selectedBackgroundImage = GetSelectedBackgroundImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case UnselectedState:
- {
- FadeOutImage( buttonImage );
- FadeInImage( selectedBackgroundImage );
- FadeInImage( selectedImage );
- StartTransitionAnimation();
- break;
- }
- case SelectedState:
- {
- FadeOutImage( selectedBackgroundImage );
- FadeOutImage( selectedImage );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- case UnselectedSelectedTransition:
- {
- float opacity = 1.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( buttonImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case SelectedUnselectedTransition:
- {
- float opacity = 0.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( buttonImage, 1.f - opacity );
- FadeInImage( selectedBackgroundImage, opacity );
- FadeInImage( selectedImage, opacity );
- StartTransitionAnimation();
- break;
- }
- case DisabledUnselectedTransition:
- {
- StopTransitionAnimation();
- FadeOutImage( buttonImage );
- FadeInImage( selectedBackgroundImage );
- FadeInImage( selectedImage );
- StartTransitionAnimation();
- break;
- }
- case DisabledSelectedTransition:
- {
- StopTransitionAnimation();
- FadeOutImage( selectedBackgroundImage );
- FadeOutImage( selectedImage );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- default:
- {
- break;
- }
- }
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
-}
-
-bool PushButton::OnDisabled()
-{
- Actor& buttonImage = GetButtonImage();
- Actor& selectedImage = GetSelectedImage();
- Actor& selectedBackgroundImage = GetSelectedBackgroundImage();
- Actor& backgroundImage = GetBackgroundImage();
- Actor& disabledImage = GetDisabledImage();
- Actor& disabledSelectedImage = GetDisabledSelectedImage();
- Actor& disabledBackgroundImage = GetDisabledBackgroundImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case UnselectedState:
- {
- FadeOutImage( backgroundImage );
- FadeOutImage( buttonImage );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledImage );
- StartTransitionAnimation();
- break;
- }
- case SelectedState:
- {
- FadeOutImage( backgroundImage );
- FadeOutImage( selectedBackgroundImage );
- FadeOutImage( selectedImage );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledSelectedImage );
- StartTransitionAnimation();
- break;
- }
- case DisabledUnselectedState:
- {
- FadeOutImage( disabledBackgroundImage );
- FadeOutImage( disabledImage );
- FadeInImage( backgroundImage );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- case DisabledSelectedState:
- {
- FadeOutImage( disabledBackgroundImage );
- FadeOutImage( disabledSelectedImage );
- FadeInImage( backgroundImage );
- FadeInImage( selectedBackgroundImage );
- FadeInImage( selectedImage );
- StartTransitionAnimation();
- break;
- }
- case UnselectedSelectedTransition:
- {
- float opacity = 1.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation();
- FadeOutImage( backgroundImage );
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledSelectedImage );
- StartTransitionAnimation();
- break;
- }
- case SelectedUnselectedTransition:
- {
- float opacity = 1.f;
- if( buttonImage )
- {
- opacity = buttonImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation();
- FadeOutImage( backgroundImage );
- FadeOutImage( buttonImage, opacity );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledImage );
- StartTransitionAnimation();
- break;
- }
- case UnselectedDisabledTransition:
- {
- float opacity = 1.f;
- if( disabledImage )
- {
- opacity = disabledImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( disabledBackgroundImage, opacity );
- FadeOutImage( disabledImage, opacity );
- FadeInImage( backgroundImage, 1.f - opacity );
- FadeInImage( buttonImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case DisabledUnselectedTransition:
- {
- float opacity = 1.f;
- if( buttonImage )
- {
- opacity = buttonImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( backgroundImage, opacity );
- FadeOutImage( buttonImage, opacity );
- FadeInImage( disabledBackgroundImage, 1.f - opacity );
- FadeInImage( disabledImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case SelectedDisabledTransition:
- {
- float opacity = 1.f;
- if( disabledSelectedImage )
- {
- opacity = disabledSelectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( disabledBackgroundImage, opacity );
- FadeOutImage( disabledSelectedImage, opacity );
- FadeInImage( backgroundImage, 1.f - opacity );
- FadeInImage( selectedBackgroundImage, 1.f - opacity );
- FadeInImage( selectedImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case DisabledSelectedTransition:
- {
- float opacity = 1.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( backgroundImage, opacity );
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( disabledBackgroundImage, 1.f - opacity );
- FadeInImage( disabledSelectedImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- }
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
-}
-
-bool PushButton::OnPressed()
-{
- Actor& buttonImage = GetButtonImage();
- Actor& selectedImage = GetSelectedImage();
- Actor& selectedBackgroundImage = GetSelectedBackgroundImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case UnselectedState:
- {
- FadeOutImage( buttonImage );
- FadeInImage( selectedBackgroundImage );
- FadeInImage( selectedImage );
- StartTransitionAnimation();
- break;
- }
- case SelectedUnselectedTransition:
- {
- float opacity = 1.f;
- if( buttonImage )
- {
- opacity = buttonImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( buttonImage, opacity );
- FadeInImage( selectedBackgroundImage, 1.f - opacity );
- FadeInImage( selectedImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case DisabledUnselectedTransition:
- {
- float opacity = 1.f;
- if( buttonImage )
- {
- opacity = buttonImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation();
- FadeOutImage( buttonImage, opacity );
- FadeInImage( selectedBackgroundImage );
- FadeInImage( selectedImage );
- StartTransitionAnimation();
- break;
- }
- default:
- break;
- }
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
-}
-
-bool PushButton::OnReleased()
-{
- Actor& buttonImage = GetButtonImage();
- Actor& selectedImage = GetSelectedImage();
- Actor& selectedBackgroundImage = GetSelectedBackgroundImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case SelectedState:
- {
- FadeOutImage( selectedBackgroundImage );
- FadeOutImage( selectedImage );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- case UnselectedSelectedTransition:
- {
- float opacity = 1.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation( false );
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( buttonImage, 1.f - opacity );
- StartTransitionAnimation();
- break;
- }
- case DisabledSelectedTransition:
- {
- float opacity = 1.f;
- if( selectedImage )
- {
- opacity = selectedImage.GetCurrentOpacity();
- }
-
- StopTransitionAnimation();
- FadeOutImage( selectedBackgroundImage, opacity );
- FadeOutImage( selectedImage, opacity );
- FadeInImage( buttonImage );
- StartTransitionAnimation();
- break;
- }
- default:
- {
- break;
- }
- }
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
-}
-
-void PushButton::StopAllAnimations()