-void Button::SetDisabled( bool disabled )
-{
- if( disabled == mDisabled )
- {
- return;
- }
-
- StopTransitionAnimation();
-
- mDisabled = disabled;
-
- // Notifies the derived class the button has been disabled.
- OnDisabled();
-
- switch( mPaintState )
- {
- case UnselectedState:
- {
- //Layer Order
- //(3) mDisabledContent (Inserted)
- //(4) mUnselectedContent
- //(2) mDisabledBackgroundContent (Inserted)
- //(1) mBackgroundContent
-
- AddButtonImage( mBackgroundContent );
- TransitionButtonImage( mDisabledBackgroundContent );
- AddButtonImage( mUnselectedContent );
- TransitionButtonImage( mDisabledContent );
-
- AddButtonImage( mDecoration[ UNSELECTED_DECORATION ] );
- ReAddLabel();
-
- TransitionOut( mDecoration[ SELECTED_DECORATION ] );
- TransitionOut( mUnselectedContent );
- TransitionOut( mSelectedContent );
- TransitionOut( mBackgroundContent );
- TransitionOut( mSelectedBackgroundContent );
- TransitionOut( mDisabledSelectedContent );
-
- mPaintState = DisabledUnselectedState;
- break;
- }
- case SelectedState:
- {
- //Layer Order
- //(5) mDisabledSelectedContent (Inserted)
- //(4) mSelectedContent
- //(3) mDisabledBackgroundContent (Inserted)
- //(2) mSelectedBackgroundContent
- //(1) mBackgroundContent
-
- AddButtonImage( mBackgroundContent );
- AddButtonImage( mSelectedBackgroundContent );
- TransitionButtonImage( mDisabledBackgroundContent );
- AddButtonImage( mSelectedContent );
- TransitionButtonImage( mDisabledSelectedContent );
-
- AddButtonImage( mDecoration[ SELECTED_DECORATION ] );
- ReAddLabel();
-
- TransitionOut( mDecoration[ UNSELECTED_DECORATION ] );
- TransitionOut( mUnselectedContent );
- TransitionOut( mSelectedContent );
- TransitionOut( mBackgroundContent );
- TransitionOut( mSelectedBackgroundContent );
- TransitionOut( mDisabledContent );
-
- mPaintState = DisabledSelectedState;
- break;
- }
- case DisabledUnselectedState:
- {
- //Layer Order
- //(3) mUnselectedContent (Inserted)
- //(4) mDisabledContent
- //(2) mBackgroundContent (Inserted)
- //(1) mDisabledBackgroundContent
-
- AddButtonImage( mDisabledBackgroundContent );
- TransitionButtonImage( mBackgroundContent );
- AddButtonImage( mDisabledContent );
- TransitionButtonImage( mUnselectedContent );
-
- AddButtonImage( mDecoration[ UNSELECTED_DECORATION ] );
- ReAddLabel();
-
- TransitionOut( mDecoration[ SELECTED_DECORATION ] );
- TransitionOut( mSelectedContent );
- TransitionOut( mSelectedBackgroundContent );
- TransitionOut( mDisabledContent );
- TransitionOut( mDisabledSelectedContent );
- TransitionOut( mDisabledBackgroundContent );
-
- mPaintState = UnselectedState;
- break;
- }
- case DisabledSelectedState:
- {
- //Layer Order
- //(4) mSelectedContent (Inserted)
- //(5) mDisabledSelectedContent
- //(3) mSelectedBackgroundContent (Inserted)
- //(2) mBackgroundContent (Inserted)
- //(1) mDisabledBackgroundContent
-
- AddButtonImage( mDisabledBackgroundContent );
- TransitionButtonImage( mBackgroundContent );
- TransitionButtonImage( mSelectedBackgroundContent );
- AddButtonImage( mDisabledSelectedContent );
- TransitionButtonImage( mSelectedContent );
-
- AddButtonImage( mDecoration[ SELECTED_DECORATION ] );
- ReAddLabel();
-
- TransitionOut( mDecoration[ UNSELECTED_DECORATION ] );
- TransitionOut( mUnselectedContent );
- TransitionOut( mDisabledContent );
- TransitionOut( mDisabledSelectedContent );
- TransitionOut( mDisabledBackgroundContent );
-
- mPaintState = SelectedState;
- break;
- }
- }
-
- StartTransitionAnimation();
-}
-
-bool Button::IsDisabled() const
-{
- return mDisabled;
-}
-