Added default images for PushButton, CheckBoxButton and RadioButton.
Change-Id: I0acd58074bf72eb7d9bc1f809ecc4de6bcc9aeb8
/**
* Button states and contents
* (3) mSelectedContent
- * (2) mButtonContent (2) mSelectedBackgroundContent
+ * (2) mUnselectedContent (2) mSelectedBackgroundContent
* (1) mBackgroundContent (1) mBackgroundContent
* < unselected > ----------------------- < selected >
* | OnSelect() |
* The drawing order of child actors is as follows.
*
* Top mLabel
- * | mButtonContent / mSelectedContent / mDisabledContent / mDisabledSelectedContent
+ * | mUnselectedContent / mSelectedContent / mDisabledContent / mDisabledSelectedContent
* | mSelectedBackgroundContent
* Bottom mBackgroundContent / mDisabledBackgroundContent
*
Button::~Button()
{
- if( mAutoRepeatingTimer )
- {
- mAutoRepeatingTimer.Reset();
- }
}
void Button::SetDisabled( bool disabled )
{
- if( disabled != mDisabled )
+ if( disabled == mDisabled )
{
- unsigned int backgroundIndex;
- unsigned int buttonIndex;
-
- bool animationStarted = false;
-
- mDisabled = disabled;
-
- switch( mPaintState )
- {
- case UnselectedState:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mDisabledContent );
-
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mDisabledBackgroundContent );
-
- animationStarted = OnDisabled();
-
- if( animationStarted )
- {
- mPaintState = UnselectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledUnselectedState;
- }
- break;
- }
- case SelectedState:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mDisabledSelectedContent );
-
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mDisabledBackgroundContent );
-
- animationStarted = OnDisabled();
-
- if( animationStarted )
- {
- mPaintState = SelectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledSelectedState;
- }
- break;
- }
- case DisabledUnselectedState:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mButtonContent );
-
- if( mDisabledBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mBackgroundContent );
-
- animationStarted = OnDisabled();
-
- if( animationStarted )
- {
- mPaintState = DisabledUnselectedTransition;
- }
- else
- {
- mPaintState = UnselectedState;
- }
- break;
- }
- case DisabledSelectedState:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mSelectedContent );
-
- if( mDisabledBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mSelectedBackgroundContent );
- InsertChild( backgroundIndex, mBackgroundContent );
+ return;
+ }
- animationStarted = OnDisabled();
+ StopTransitionAnimation();
- if( animationStarted )
- {
- mPaintState = DisabledSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
- }
- case UnselectedSelectedTransition:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mDisabledSelectedContent );
+ mDisabled = disabled;
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
+ // Notifies the derived class the button has been disabled.
+ OnDisabled();
- InsertChild( backgroundIndex, mDisabledBackgroundContent );
+ switch( mPaintState )
+ {
+ case UnselectedState:
+ {
+ //Layer Order
+ //(3) mDisabledContent (Inserted)
+ //(4) mUnselectedContent
+ //(2) mDisabledBackgroundContent (Inserted)
+ //(1) mBackgroundContent
- animationStarted = OnDisabled();
+ TransitionInBetween( mUnselectedContent, mLabel, mDisabledContent );
+ TransitionInAbove( mBackgroundContent, mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = SelectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledSelectedState;
- }
- break;
- }
- case SelectedUnselectedTransition:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mDisabledContent );
+ TransitionOut( mUnselectedContent );
+ TransitionOut( mSelectedContent );
+ TransitionOut( mBackgroundContent );
+ TransitionOut( mSelectedBackgroundContent );
+ TransitionOut( mDisabledSelectedContent );
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
+ mPaintState = DisabledUnselectedState;
+ break;
+ }
+ case SelectedState:
+ {
+ //Layer Order
+ //(5) mDisabledSelectedContent (Inserted)
+ //(4) mSelectedContent
+ //(3) mDisabledBackgroundContent (Inserted)
+ //(2) mSelectedBackgroundContent
+ //(1) mBackgroundContent
+
+ TransitionInBetween( mSelectedContent, mLabel, mDisabledSelectedContent );
+ TransitionInAbove( mSelectedBackgroundContent, mDisabledBackgroundContent );
+
+ TransitionOut( mUnselectedContent );
+ TransitionOut( mSelectedContent );
+ TransitionOut( mBackgroundContent );
+ TransitionOut( mSelectedBackgroundContent );
+ TransitionOut( mDisabledContent );
- InsertChild( backgroundIndex, mDisabledBackgroundContent );
+ mPaintState = DisabledSelectedState;
+ break;
+ }
+ case DisabledUnselectedState:
+ {
+ //Layer Order
+ //(3) mUnselectedContent (Inserted)
+ //(4) mDisabledContent
+ //(2) mBackgroundContent (Inserted)
+ //(1) mDisabledBackgroundContent
- animationStarted = OnDisabled();
+ TransitionInBetween( mDisabledContent, mLabel, mUnselectedContent );
+ TransitionInAbove( mDisabledBackgroundContent, mBackgroundContent );
- if( animationStarted )
- {
- mPaintState = UnselectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledUnselectedState;
- }
- break;
- }
- case UnselectedDisabledTransition:
- {
- animationStarted = OnDisabled();
+ TransitionOut( mSelectedContent );
+ TransitionOut( mSelectedBackgroundContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = DisabledUnselectedTransition;
- }
- else
- {
- mPaintState = UnselectedState;
- }
- break;
- }
- case DisabledUnselectedTransition:
- {
- animationStarted = OnDisabled();
-
- if( animationStarted )
- {
- mPaintState = UnselectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledUnselectedState;
- }
- break;
- }
- case SelectedDisabledTransition:
- {
- animationStarted = OnDisabled();
-
- if( animationStarted )
- {
- mPaintState = DisabledSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
- }
- case DisabledSelectedTransition:
- {
- animationStarted = OnDisabled();
+ mPaintState = UnselectedState;
+ break;
+ }
+ case DisabledSelectedState:
+ {
+ //Layer Order
+ //(4) mSelectedContent (Inserted)
+ //(5) mDisabledSelectedContent
+ //(3) mSelectedBackgroundContent (Inserted)
+ //(2) mBackgroundContent (Inserted)
+ //(1) mDisabledBackgroundContent
+
+ TransitionInBetween( mDisabledSelectedContent, mLabel, mSelectedContent );
+ TransitionInAbove( mDisabledBackgroundContent, mSelectedBackgroundContent );
+ TransitionInAbove( mDisabledBackgroundContent, mBackgroundContent );
+
+ TransitionOut( mUnselectedContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = SelectedDisabledTransition;
- }
- else
- {
- mPaintState = DisabledSelectedState;
- }
- break;
- }
+ mPaintState = SelectedState;
+ break;
}
}
+
+ StartTransitionAnimation();
}
bool Button::IsDisabled() const
void Button::SetSelected( bool selected, bool emitSignal )
{
- unsigned int buttonIndex, backgroundIndex;
- bool animationStarted = false;
+ StopTransitionAnimation();
mSelected = selected;
+ // Notifies the derived class the button has been selected.
+ OnSelected();
+
switch( mPaintState )
{
case UnselectedState:
{
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mSelectedContent );
+ //Layer Order
+ //(3) mSelectedContent (Inserted)
+ //(4) mUnselectedContent
+ //(2) mSelectedBackgroundContent (Inserted)
+ //(1) mBackgroundContent
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mSelectedBackgroundContent );
+ TransitionInBetween( mUnselectedContent, mLabel, mSelectedContent );
+ TransitionInAbove( mBackgroundContent, mSelectedBackgroundContent );
+ TransitionInAtIndex( 0, mBackgroundContent );
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
+ TransitionOut( mUnselectedContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
+ mPaintState = SelectedState;
break;
}
case SelectedState:
{
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mButtonContent );
+ //Layer Order
+ //(3) mUnselectedContent (Inserted)
+ //(2) mSelectedContent
+ //(1) mBackgroundContent
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
+ TransitionInBetween( mSelectedContent, mLabel, mUnselectedContent );
+ TransitionInAtIndex( 0, mBackgroundContent );
- if( animationStarted )
- {
- mPaintState = SelectedUnselectedTransition;
- }
- else
- {
- mPaintState = UnselectedState;
- }
- break;
- }
- case UnselectedSelectedTransition:
- {
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
+ TransitionOut( mSelectedContent );
+ TransitionOut( mSelectedBackgroundContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = SelectedUnselectedTransition;
- }
- else
- {
- mPaintState = UnselectedState;
- }
- break;
- }
- case SelectedUnselectedTransition:
- {
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
-
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
- }
- case DisabledUnselectedTransition:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mSelectedContent );
-
- if( mDisabledBackgroundContent )
- {
- if( mBackgroundContent )
- {
- backgroundIndex = 2;
- }
- else
- {
- backgroundIndex = 1;
- }
- }
- else if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
-
- InsertChild( backgroundIndex, mSelectedBackgroundContent );
-
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
-
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
- }
- case DisabledSelectedTransition:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mButtonContent );
-
- // Notifies the derived class the button has been selected.
- animationStarted = OnSelected();
-
- if( animationStarted )
- {
- mPaintState = SelectedUnselectedTransition;
- }
- else
- {
- mPaintState = UnselectedState;
- }
+ mPaintState = UnselectedState;
break;
}
- default:
+ case DisabledUnselectedState:
+ case DisabledSelectedState:
{
+ DALI_ASSERT_DEBUG( 0 && "Shouldn't be able to change paint state if the button is disabled." );
break;
}
}
+ StartTransitionAnimation();
+
if( emitSignal )
{
Toolkit::Button handle( GetOwner() );
void Button::SetButtonImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
- if( mButtonContent && mButtonContent.GetParent() )
+ if( mUnselectedContent && mUnselectedContent.GetParent() )
{
- Self().Remove( mButtonContent );
+ Self().Remove( mUnselectedContent );
}
- mButtonContent = image;
-
- mButtonContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mButtonContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mButtonContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == UnselectedState )
+ mUnselectedContent = image;
+ if( mUnselectedContent )
{
- unsigned int index = FindChildIndex( mLabel );
-
- Self().Insert( index, mButtonContent );
+ mUnselectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mUnselectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mUnselectedContent.SetPosition( 0.f, 0.f );
}
-
+ ResetImageLayers();
OnButtonImageSet();
RelayoutRequest();
Actor Button::GetButtonImage() const
{
- return mButtonContent;
+ return mUnselectedContent;
}
Actor& Button::GetButtonImage()
{
- return mButtonContent;
+ return mUnselectedContent;
}
void Button::SetSelectedImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mSelectedContent && mSelectedContent.GetParent() )
{
}
mSelectedContent = image;
-
- mSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mSelectedContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == SelectedState )
+ if( mSelectedContent )
{
- unsigned int index = FindChildIndex( mLabel );
-
- Self().Insert( index, mSelectedContent );
+ mSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mSelectedContent.SetPosition( 0.f, 0.f );
}
-
+ ResetImageLayers();
OnSelectedImageSet();
RelayoutRequest();
void Button::SetBackgroundImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mBackgroundContent && mBackgroundContent.GetParent() )
{
}
mBackgroundContent = image;
-
- mBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mBackgroundContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == UnselectedState || mPaintState == SelectedState )
+ if( mBackgroundContent )
{
- Self().Insert( 0, mBackgroundContent );
+ mBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mBackgroundContent.SetPosition( 0.f, 0.f );
}
-
+ ResetImageLayers();
OnBackgroundImageSet();
RelayoutRequest();
void Button::SetSelectedBackgroundImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mSelectedBackgroundContent && mSelectedBackgroundContent.GetParent() )
{
}
mSelectedBackgroundContent = image;
-
- mSelectedBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mSelectedBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mSelectedBackgroundContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == SelectedState )
+ if( mSelectedBackgroundContent )
{
- if( mBackgroundContent )
- {
- Self().Insert( 1, mSelectedBackgroundContent );
- }
- else
- {
- Self().Insert( 0, mSelectedBackgroundContent );
- }
+ mSelectedBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mSelectedBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mSelectedBackgroundContent.SetPosition( 0.f, 0.f );
}
-
+ ResetImageLayers();
OnSelectedBackgroundImageSet();
RelayoutRequest();
void Button::SetDisabledImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mDisabledContent && mDisabledContent.GetParent() )
{
}
mDisabledContent = image;
-
- mDisabledContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mDisabledContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mDisabledContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == DisabledUnselectedState || mPaintState == DisabledSelectedState )
+ if( mDisabledContent )
{
- unsigned int index = FindChildIndex( mLabel );
-
- Self().Insert( index, mDisabledContent );
+ mDisabledContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mDisabledContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mDisabledContent.SetPosition( 0.f, 0.f );
}
+ ResetImageLayers();
OnDisabledImageSet();
}
void Button::SetDisabledSelectedImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mDisabledSelectedContent && mDisabledSelectedContent.GetParent() )
{
}
mDisabledSelectedContent = image;
-
- mDisabledSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mDisabledSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mDisabledSelectedContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == DisabledSelectedState )
+ if( mDisabledSelectedContent )
{
- unsigned int index = FindChildIndex( mLabel );
-
- Self().Insert( index, mDisabledSelectedContent );
+ mDisabledSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mDisabledSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mDisabledSelectedContent.SetPosition( 0.f, 0.f );
}
+ ResetImageLayers();
OnDisabledSelectedImageSet();
}
void Button::SetDisabledBackgroundImage( Actor image )
{
- StopAllAnimations();
+ StopTransitionAnimation();
if( mDisabledBackgroundContent && mDisabledBackgroundContent.GetParent() )
{
}
mDisabledBackgroundContent = image;
-
- mDisabledBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mDisabledBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mDisabledBackgroundContent.SetPosition( 0.f, 0.f );
-
- if( mPaintState == DisabledUnselectedState || mPaintState == DisabledSelectedState )
+ if( mDisabledBackgroundContent )
{
- Self().Insert( 0, mDisabledBackgroundContent );
+ mDisabledBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mDisabledBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mDisabledBackgroundContent.SetPosition( 0.f, 0.f );
}
-
+ ResetImageLayers();
OnDisabledBackgroundImageSet();
}
return false;
}
-void Button::UpdatePaintTransitionState()
-{
- switch( mPaintState )
- {
- case UnselectedSelectedTransition:
- {
- RemoveChild( mButtonContent );
- mPaintState = SelectedState;
- break;
- }
- case SelectedUnselectedTransition:
- {
- RemoveChild( mSelectedBackgroundContent );
- RemoveChild( mSelectedContent );
- mPaintState = UnselectedState;
- break;
- }
- case UnselectedDisabledTransition:
- {
- RemoveChild( mBackgroundContent );
- RemoveChild( mButtonContent );
- mPaintState = DisabledUnselectedState;
- break;
- }
- case DisabledUnselectedTransition:
- {
- RemoveChild( mDisabledBackgroundContent );
- RemoveChild( mDisabledContent );
- mPaintState = UnselectedState;
- break;
- }
- case SelectedDisabledTransition:
- {
- RemoveChild( mBackgroundContent );
- RemoveChild( mSelectedBackgroundContent );
- RemoveChild( mSelectedContent );
- mPaintState = DisabledSelectedState;
- break;
- }
- case DisabledSelectedTransition:
- {
- RemoveChild( mDisabledBackgroundContent );
- RemoveChild( mDisabledSelectedContent );
- mPaintState = SelectedState;
- break;
- }
- default:
- {
- break;
- }
- }
-}
-
void Button::OnButtonStageDisconnection()
{
if( ButtonDown == mState )
void Button::Pressed()
{
- unsigned int buttonIndex, backgroundIndex;
- bool animationStarted = false;
+ if( mPaintState == UnselectedState )
+ {
+ StopTransitionAnimation();
- switch( mPaintState )
+ // Notifies the derived class the button has been pressed.
+ OnPressed();
+
+ //Layer Order
+ //(4) mSelectedContent (Inserted)
+ //(3) mUnselectedContent
+ //(2) mSelectedBackgroundContent (Inserted)
+ //(1) mBackgroundContent
+
+ TransitionInBetween( mUnselectedContent, mLabel, mSelectedContent );
+ TransitionInAbove( mBackgroundContent, mSelectedBackgroundContent );
+ TransitionInAtIndex( 0, mBackgroundContent );
+
+ TransitionOut( mUnselectedContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
+
+ mPaintState = SelectedState;
+
+ StartTransitionAnimation();
+ }
+}
+
+void Button::Released()
+{
+ if( mPaintState == SelectedState )
{
- case UnselectedState:
- {
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mSelectedContent );
+ StopTransitionAnimation();
- if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
+ // Notifies the derived class the button has been released.
+ OnReleased();
- InsertChild( backgroundIndex, mSelectedBackgroundContent );
+ //Layer Order
+ //(3) mUnselectedContent (Inserted)
+ //(2) mSelectedContent
+ //(1) mBackgroundContent
- // Notifies the derived class the button has been pressed.
- animationStarted = OnPressed();
+ TransitionInBetween( mSelectedContent, mLabel, mUnselectedContent );
+ TransitionInAtIndex( 0, mBackgroundContent );
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
- }
- case SelectedUnselectedTransition:
- {
- // Notifies the derived class the button has been pressed.
- animationStarted = OnPressed();
+ TransitionOut( mSelectedContent );
+ TransitionOut( mSelectedBackgroundContent );
+ TransitionOut( mDisabledContent );
+ TransitionOut( mDisabledSelectedContent );
+ TransitionOut( mDisabledBackgroundContent );
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
+ mPaintState = UnselectedState;
+
+ StartTransitionAnimation();
+ }
+}
+
+Button::ButtonState Button::GetState()
+{
+ return mState;
+}
+
+Button::PaintState Button::GetPaintState()
+{
+ return mPaintState;
+}
+
+bool Button::InsertButtonImage( unsigned int index, Actor& actor )
+{
+ if( actor )
+ {
+ Self().Insert( index, actor );
+ PrepareForTranstionOut( actor );
+ return true;
+ }
+
+ return false;
+}
+
+void Button::RemoveButtonImage( Actor& actor )
+{
+ if( actor )
+ {
+ if( actor.GetParent() )
+ {
+ Self().Remove( actor );
}
- case DisabledUnselectedTransition:
+ PrepareForTranstionIn( actor );
+ }
+}
+
+unsigned int Button::FindChildIndex( Actor& actor )
+{
+ Actor self = Self();
+ unsigned int childrenNum = self.GetChildCount();
+
+ for( unsigned int i = 0; i < childrenNum; i++ )
+ {
+ Actor child = self.GetChildAt( i );
+ if( child == actor )
{
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mSelectedContent );
+ return i;
+ }
+ }
- if( mDisabledBackgroundContent )
- {
- if( mBackgroundContent )
- {
- backgroundIndex = 2;
- }
- else
- {
- backgroundIndex = 1;
- }
- }
- else if( mBackgroundContent )
- {
- backgroundIndex = 1;
- }
- else
- {
- backgroundIndex = 0;
- }
+ return childrenNum;
+}
- InsertChild( backgroundIndex, mSelectedBackgroundContent );
+void Button::TransitionInBetween( Actor childLower, Actor childUpper, Actor actor )
+{
+ unsigned int index = childLower ? FindChildIndex( childLower ) + 1 : FindChildIndex( childUpper );
+ TransitionInAtIndex( index, actor );
+}
- // Notifies the derived class the button has been pressed.
- animationStarted = OnPressed();
+void Button::TransitionInAbove( Actor child, Actor actor )
+{
+ unsigned int index = child ? FindChildIndex( child ) + 1 : 0;
+ TransitionInAtIndex( index, actor );
+}
- if( animationStarted )
- {
- mPaintState = UnselectedSelectedTransition;
- }
- else
- {
- mPaintState = SelectedState;
- }
- break;
+void Button::TransitionInAtIndex( unsigned int index, Actor actor )
+{
+ if( actor )
+ {
+ if( !actor.GetParent() )
+ {
+ Self().Insert( index, actor );
}
- default:
- break;
+
+ OnTransitionIn( actor );
}
}
-void Button::Released()
+void Button::TransitionOut( Actor actor )
+{
+ OnTransitionOut( actor );
+}
+
+void Button::ResetImageLayers()
{
- unsigned int buttonIndex;
- bool animationStarted = false;
+ //ensure that all layers are in the correct order and state according to the paint state
+ int index = 0;
switch( mPaintState )
{
- case SelectedState:
+ case UnselectedState:
{
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mButtonContent );
+ //Layer Order
+ //(2) mUnselectedContent
+ //(1) mBackgroundContent
- // Notifies the derived class the button has been released.
- animationStarted = OnReleased();
+ RemoveButtonImage( mSelectedContent );
+ RemoveButtonImage( mSelectedBackgroundContent );
+ RemoveButtonImage( mDisabledContent );
+ RemoveButtonImage( mDisabledSelectedContent );
+ RemoveButtonImage( mDisabledBackgroundContent );
- if( animationStarted )
+ if( InsertButtonImage( index, mBackgroundContent ) )
{
- mPaintState = SelectedUnselectedTransition;
+ ++index;
}
- else
+ if( InsertButtonImage( index, mUnselectedContent ) )
{
- mPaintState = UnselectedState;
+ ++index;
}
break;
}
- case UnselectedSelectedTransition:
+ case SelectedState:
{
- // Notifies the derived class the button has been released.
- animationStarted = OnReleased();
+ //Layer Order
+ //(3) mSelectedContent
+ //(2) mSelectedBackgroundContent
+ //(1) mBackgroundContent
- if( animationStarted )
+ RemoveButtonImage( mUnselectedContent );
+ RemoveButtonImage( mDisabledContent );
+ RemoveButtonImage( mDisabledSelectedContent );
+ RemoveButtonImage( mDisabledBackgroundContent );
+
+ if( InsertButtonImage( index, mBackgroundContent ) )
{
- mPaintState = SelectedUnselectedTransition;
+ ++index;
}
- else
+ if( InsertButtonImage( index, mSelectedBackgroundContent ) )
+ {
+ ++index;
+ }
+ if( InsertButtonImage( index, mSelectedContent ) )
{
- mPaintState = UnselectedState;
+ ++index;
}
break;
}
- case DisabledSelectedTransition:
+ case DisabledUnselectedState:
{
- buttonIndex = FindChildIndex( mLabel );
- InsertChild( buttonIndex, mButtonContent );
+ //Layer Order
+ //(2) mDisabledContent
+ //(1) mDisabledBackgroundContent
- // Notifies the derived class the button has been released.
- animationStarted = OnReleased();
+ RemoveButtonImage( mUnselectedContent );
+ RemoveButtonImage( mBackgroundContent );
+ RemoveButtonImage( mSelectedContent );
+ RemoveButtonImage( mDisabledSelectedContent );
+ RemoveButtonImage( mSelectedBackgroundContent );
- if( animationStarted )
+ if( InsertButtonImage( index, mDisabledBackgroundContent ? mDisabledBackgroundContent : mBackgroundContent ) )
{
- mPaintState = SelectedUnselectedTransition;
+ ++index;
}
- else
+ if( InsertButtonImage( index, mDisabledContent ? mDisabledContent : mUnselectedContent ) )
{
- mPaintState = UnselectedState;
+ ++index;
}
break;
}
- default:
+ case DisabledSelectedState:
{
+ //Layer Order
+ // (2) mDisabledSelectedContent
+ // (1) mDisabledBackgroundContent
+
+ RemoveButtonImage( mUnselectedContent );
+ RemoveButtonImage( mSelectedContent );
+ RemoveButtonImage( mBackgroundContent );
+ RemoveButtonImage( mSelectedBackgroundContent );
+ RemoveButtonImage( mDisabledContent );
+
+ if( mDisabledBackgroundContent )
+ {
+ if( InsertButtonImage( index, mDisabledBackgroundContent) )
+ {
+ ++index;
+ }
+ }
+ else
+ {
+ if( InsertButtonImage( index, mBackgroundContent ) )
+ {
+ ++index;
+ }
+ if( InsertButtonImage( index, mSelectedBackgroundContent ) )
+ {
+ ++index;
+ }
+ }
+
+ if( InsertButtonImage( index, mDisabledSelectedContent ? mDisabledSelectedContent : mSelectedContent) )
+ {
+ ++index;
+ }
break;
}
}
}
-Button::ButtonState Button::GetState()
-{
- return mState;
-}
-
-Button::PaintState Button::GetPaintState()
-{
- return mPaintState;
-}
-
-void Button::InsertChild( unsigned int index, Actor& actor )
+void Button::StartTransitionAnimation()
{
- if( actor )
+ if( mTransitionAnimation )
{
- Self().Insert( index, actor);
+ mTransitionAnimation.Play();
+ }
+ else
+ {
+ ResetImageLayers();
}
}
-void Button::RemoveChild( Actor& actor )
+void Button::StopTransitionAnimation()
{
- if( actor && actor.GetParent() )
+ if( mTransitionAnimation )
{
- Self().Remove( actor );
+ mTransitionAnimation.Clear();
+ mTransitionAnimation.Reset();
}
}
-unsigned int Button::FindChildIndex( Actor& actor )
+Dali::Animation Button::GetTransitionAnimation()
{
- Actor self = Self();
- unsigned int childrenNum = self.GetChildCount();
-
- for( unsigned int i = 0; i < childrenNum; i++ )
+ if( !mTransitionAnimation )
{
- Actor child = self.GetChildAt( i );
- if( child == actor )
- {
- return i;
- }
+ mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
+ mTransitionAnimation.FinishedSignal().Connect( this, &Button::TransitionAnimationFinished );
}
- return childrenNum;
+ return mTransitionAnimation;
+}
+
+void Button::TransitionAnimationFinished( Dali::Animation& source )
+{
+ StopTransitionAnimation();
+ ResetImageLayers();
}
void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
{
case Toolkit::Button::Property::DISABLED:
{
- GetImplementation( button ).SetDisabled( value.Get<bool>() );
+ GetImplementation( button ).SetDisabled( value.Get< bool >() );
break;
}
case Toolkit::Button::Property::NORMAL_STATE_ACTOR:
{
Property::Map map;
- Scripting::CreatePropertyMap( GetImplementation( button ).mButtonContent, map );
+ Scripting::CreatePropertyMap( GetImplementation( button ).mUnselectedContent, map );
value = map;
break;
}
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/button.h>
*/
Actor& GetLabel();
- /**
- * It changes the transition state of the push button.
- */
- void UpdatePaintTransitionState();
-
private:
/**
/**
* This method is called when the \e selected property is changed.
- * @return true if the transition animation is started.
*/
- virtual bool OnSelected() { return false; }
+ virtual void OnSelected() {}
/**
* This method is called when the \e disabled property is changed.
- * @return true if the transition animation is started.
*/
- virtual bool OnDisabled() { return false; }
+ virtual void OnDisabled() {}
/**
* This method is called when the button is pressed.
- * @return true if the transition animation is started.
*/
- virtual bool OnPressed() { return false; }
+ virtual void OnPressed() {}
/**
* This method is called when the button is released.
- * @return true if the transition animation is started.
*/
- virtual bool OnReleased() { return false; }
-
- /**
- * This method stops all animations
- */
- virtual void StopAllAnimations() {}
+ virtual void OnReleased() {}
public:
SelectedState, ///< The button is selected.
DisabledUnselectedState, ///< The button is disabled and unselected.
DisabledSelectedState, ///< The button is disabled and selected.
- UnselectedSelectedTransition, ///< The button is in transition from unselected to selected.
- SelectedUnselectedTransition, ///< The button is in transition from selected to unselected.
- UnselectedDisabledTransition, ///< The button is in transition from unselected to disabled.
- DisabledUnselectedTransition, ///< The button is in transition from disabled to unselected.
- SelectedDisabledTransition, ///< The button is in transition from selected to disabled.
- DisabledSelectedTransition ///< The button is in transition from disabled to selected.
};
ButtonState GetState();
PaintState GetPaintState();
/**
- * Inserts the actor to the button.
+ * Returns the animation to be used for transitioning creating the animation if needed.
+ * @return The initialised transition animation.
+ */
+ Dali::Animation GetTransitionAnimation();
+
+ /**
+ * Prepares the actor to be transitioned in.
+ * @param[in] actor The actor that will be transitioned in.
+ */
+ virtual void PrepareForTranstionIn( Actor actor ) {}
+
+ /**
+ * Prepares the actor to be transitioned in.
+ * @param[in] actor The actor that will be transitioned out.
+ */
+ virtual void PrepareForTranstionOut( Actor actor ) {}
+
+ /**
+ * Transitions the actor in, allowing derived classes to configure
+ * the GetTransitionAnimation() animation ready.
+ * Button is in charge of calling Dali::Animation::Play and so derived classes
+ * only need to add the animation.
+ */
+ virtual void OnTransitionIn( Actor actor ) {}
+
+ /**
+ * Transitions the actor out, allowing derived classes to configure
+ * the GetTransitionAnimation() animation ready.
+ * Button is in charge of calling Dali::Animation::Play and so derived classes
+ * only need to add the animation.
+ */
+ virtual void OnTransitionOut( Actor actor ) {}
+
+private:
+ /**
+ * Starts the transition animation.
+ * Button::TransitionFinished is called when the animation finishes.
+ */
+ void StartTransitionAnimation();
+
+ /**
+ * This method stops all transition animations
*/
- void InsertChild( unsigned int index, Actor& actor );
+ void StopTransitionAnimation();
/**
- * Removes the actor from the button.
+ * Called when the transition animation finishes.
*/
- void RemoveChild( Actor& actor );
+ void TransitionAnimationFinished( Dali::Animation& source );
+
+ /**
+ * Resets the Button to the base state for the current paint state.
+ * Any additionally inserted images needed for transitions that are
+ * no longer needed and the removed.
+ */
+ void ResetImageLayers();
+
+ /**
+ * Transitions in the actor, inserting the actor above childLower below the childUpper.
+ * Will not insert the actor if it is already attached to a parent (and so will not reorder the actor)
+ */
+ void TransitionInBetween( Actor childLower, Actor childUpper, Actor actor );
+
+ /**
+ * Transitions in the actor, inserting the actor above the child if the child exists or at the bottom otherwise
+ * Will not insert the actor if it is already attached to a parent (and so will not reorder the actor)
+ */
+ void TransitionInAbove( Actor child, Actor actor );
+
+ /**
+ * Transitions in the actor, inserting the actor at the index
+ * Will not insert the actor if it is already attached to a parent (and so will not reorder the actor)
+ */
+ void TransitionInAtIndex( unsigned int index, Actor actor );
+
+ /**
+ * Transitions out the actor
+ */
+ void TransitionOut( Actor actor );
+
+ /**
+ * Inserts the actor to the button and prepares it to be transitioned out
+ * @return true if the child was inserted, false otherwise
+ */
+ bool InsertButtonImage( unsigned int index, Actor& actor );
+
+ /**
+ * Removes the actor from the button and prepares it to be transitioned out
+ */
+ void RemoveButtonImage( Actor& actor );
/**
* Finds the index of the actor.
*/
unsigned int FindChildIndex( Actor& actor );
-private:
// Undefined
Button( const Button& );
Actor mLabel; ///< Stores the button label.
- Actor mButtonContent; ///< Stores the unselected content.
+ Actor mUnselectedContent; ///< Stores the unselected content.
Actor mSelectedContent; ///< Stores the selected content.
Actor mBackgroundContent; ///< Stores the background content.
Actor mSelectedBackgroundContent; ///< Stores the selected background content.
Actor mDisabledSelectedContent; ///< Stores the disabled selected content.
Actor mDisabledBackgroundContent; ///< Stores the disabled background content.
+ Animation mTransitionAnimation; ///< Animation used in the state transitions.
+
TapGestureDetector mTapDetector;
bool mDisabled; ///< Stores the disabled property.
bool mSelected; ///< Stores the selected state.
float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds.
float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds.
+
float mAnimationTime; ///< The animation time.
// Actions
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
//INTERNAL INCLUDES
#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
TypeRegistration mType( typeid(Toolkit::CheckBoxButton), typeid(Toolkit::Button), Create );
+const char* const UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "checkbox-unselected.png";
+const char* const SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "checkbox-selected.png";
+const char* const DISABLED_UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "checkbox-unselected-disabled.png";
+const char* const DISABLED_SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "checkbox-selected-diabled.png";
}
Dali::Toolkit::CheckBoxButton CheckBoxButton::New()
CheckBoxButton::~CheckBoxButton()
{
- if( mTransitionAnimation )
- {
- mTransitionAnimation.Clear();
- }
}
void CheckBoxButton::OnButtonInitialize()
{
// Wrap around all children
Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+
+ Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledImage = Dali::ResourceImage::New( DISABLED_UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledSelectedImage = Dali::ResourceImage::New( DISABLED_SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+
+ SetButtonImage( ImageActor::New( buttonImage ) );
+ SetSelectedImage( ImageActor::New( selectedImage ) );
+ SetDisabledImage( ImageActor::New( disabledImage ) );
+ SetDisabledSelectedImage( ImageActor::New( disabledSelectedImage ) );
}
void CheckBoxButton::OnLabelSet()
{
label.SetX( GetBackgroundImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
- else
+ else if( IsSelected() && GetSelectedImage())
{
- label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
- }
-}
-
-bool CheckBoxButton::OnSelected()
-{
- Actor& selectedImage = GetSelectedImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case UnselectedState:
- {
- StartTransitionAnimation( selectedImage );
- break;
- }
- case SelectedState:
+ else if( GetButtonImage() )
{
- RemoveChild( selectedImage );
- break;
+ label.SetX( GetButtonImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
- case UnselectedSelectedTransition:
- {
- StopTransitionAnimation( false );
- RemoveChild( selectedImage );
- break;
- }
- default:
+ else
{
- break;
+ label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
}
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
}
-bool CheckBoxButton::OnDisabled()
+void CheckBoxButton::OnDisabled()
{
Actor& backgroundImage = GetBackgroundImage();
- Actor& selectedImage = GetSelectedImage();
Actor& disabledBackgroundImage = GetDisabledBackgroundImage();
- Actor& disabledSelectedImage = GetDisabledSelectedImage();
-
- PaintState paintState = GetPaintState();
-
- switch( paintState )
- {
- case UnselectedState:
- {
- RemoveChild( backgroundImage );
- break;
- }
- case SelectedState:
- {
- RemoveChild( backgroundImage );
- RemoveChild( selectedImage );
- break;
- }
- case DisabledUnselectedState:
- {
- RemoveChild( disabledBackgroundImage );
- break;
- }
- case DisabledSelectedState:
- {
- RemoveChild( disabledBackgroundImage );
- RemoveChild( disabledSelectedImage );
- break;
- }
- case UnselectedSelectedTransition:
- {
- StopTransitionAnimation();
-
- RemoveChild( backgroundImage );
- RemoveChild( selectedImage );
- break;
- }
- default:
- {
- break;
- }
- }
Actor& label = GetLabel();
-
if( label )
{
- if( IsDisabled() && disabledBackgroundImage)
+ if( IsDisabled() && disabledBackgroundImage )
{
label.SetX( disabledBackgroundImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
{
label.SetX( backgroundImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
+ else if( IsSelected() && GetSelectedImage())
+ {
+ label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ }
+ else if( GetButtonImage() )
+ {
+ label.SetX( GetButtonImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ }
else
{
label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
}
-
- if( mTransitionAnimation )
- {
- return true;
- }
-
- return false;
}
-void CheckBoxButton::StopAllAnimations()
+void CheckBoxButton::PrepareForTranstionIn( Actor actor )
{
- StopTransitionAnimation();
-}
-
-void CheckBoxButton::StartTransitionAnimation( Actor& actor )
-{
- if( actor )
+ Actor& selectedImage = GetSelectedImage();
+ if( actor == selectedImage )
{
+ actor.SetScale( Vector3( 0.0f, 1.0f, 1.0f ) );
+
if( !mTickUVEffect )
{
- ImageActor imageActor = ImageActor::DownCast( actor );
mTickUVEffect = CreateImageRegionEffect();
- imageActor.SetShaderEffect( mTickUVEffect );
}
-
- actor.SetScale( Vector3( 0.0f, 1.0f, 1.0f ) );
-
mTickUVEffect.SetUniform("uBottomRight", Vector2( 0.0f, 1.0f ) );
- if( !mTransitionAnimation )
+ ImageActor imageActor = ImageActor::DownCast( actor );
+ if( imageActor )
{
- mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
+ imageActor.SetShaderEffect( mTickUVEffect );
}
-
- // UV anim
- mTransitionAnimation.AnimateTo( Property( mTickUVEffect, "uBottomRight" ), Vector2( 1.0f, 1.0f ) );
-
- // Actor size anim
- mTransitionAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f );
-
- mTransitionAnimation.FinishedSignal().Connect( this, &CheckBoxButton::TransitionAnimationFinished );
- mTransitionAnimation.Play();
}
}
-void CheckBoxButton::StopTransitionAnimation( bool remove )
+void CheckBoxButton::PrepareForTranstionOut( Actor actor )
{
- if( mTransitionAnimation )
+ Actor& selectedImage = GetSelectedImage();
+ if( actor == selectedImage )
{
- mTransitionAnimation.Clear();
- mTransitionAnimation.Reset();
- }
+ actor.SetScale( Vector3::ONE );
- if( remove )
- {
- UpdatePaintTransitionState();
+ if( !mTickUVEffect )
+ {
+ mTickUVEffect = CreateImageRegionEffect();
+ }
+ mTickUVEffect.SetUniform("uBottomRight", Vector2::ONE );
+
+ ImageActor imageActor = ImageActor::DownCast( actor );
+ if( imageActor )
+ {
+ imageActor.SetShaderEffect( mTickUVEffect );
+ }
}
}
-void CheckBoxButton::TransitionAnimationFinished( Dali::Animation& source )
+void CheckBoxButton::OnTransitionIn( Actor actor )
{
- StopTransitionAnimation();
+ Actor& selectedImage = GetSelectedImage();
+ if( actor && actor == selectedImage )
+ {
+ if( GetPaintState() == UnselectedState )
+ {
+ Dali::Animation transitionAnimation = GetTransitionAnimation();
+ if( transitionAnimation )
+ {
+ DALI_ASSERT_DEBUG( mTickUVEffect );
+ if( mTickUVEffect )
+ {
+ // UV anim
+ transitionAnimation.AnimateTo( Property( mTickUVEffect, "uBottomRight" ), Vector2::ONE );
+ }
+ // Actor size anim
+ transitionAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f );
+ }
+ }
+ else
+ {
+ //explicitly end the swipe animation
+ actor.SetScale( Vector3::ONE );
+ if( mTickUVEffect )
+ {
+ mTickUVEffect.SetUniform("uBottomRight", Vector2::ONE );
+ }
+ }
+ }
}
} // namespace Internal
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/animation/animation.h>
#include <dali/public-api/shader-effects/shader-effect.h>
-
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
virtual void OnLabelSet();
/**
- * @copydoc Toolkit::Internal::Button::OnSelected()
- */
- virtual bool OnSelected();
-
- /**
* @copydoc Toolkit::Internal::Button::OnDisabled()
*/
- virtual bool OnDisabled();
-
- /**
- * @copydoc Toolkit::Internal::Button::StopAllAnimations()
- */
- virtual void StopAllAnimations();
-
-private:
+ virtual void OnDisabled();
/**
- * Adds the actor to the transition animation.
- * It creates a transition animation if needed and starts the animation.
- * @param[in] actor The actor.
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
*/
- void StartTransitionAnimation( Actor& actor );
+ virtual void PrepareForTranstionIn( Actor actor );
/**
- * Stops the transition animation.
- * @param[in] remove If true, removes the fadeout actor from root.
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
*/
- void StopTransitionAnimation( bool remove = true );
-
- // slots
+ virtual void PrepareForTranstionOut( Actor actor );
/**
- * Called when the transition animation finishes.
+ * @copydoc Toolkit::Internal::Button::OnTransitionInImage( Actor actor )
*/
- void TransitionAnimationFinished( Dali::Animation& source );
+ virtual void OnTransitionIn( Actor actor );
private:
CheckBoxButton& operator=( const CheckBoxButton& );
private:
- Animation mTransitionAnimation; ///< Animation used in the state transitions.
ShaderEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across
};
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
TypeRegistration typeRegistration( typeid(Toolkit::PushButton), typeid(Toolkit::Button), Create );
+const char* const UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "button-up.9.png";
+const char* const SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "button-down.9.png";
+const char* const DISABLED_UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "button-disabled.9.png";
+const char* const DISABLED_SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "button-down-disabled.9.png";
+
} // unnamed namespace
namespace
// Set resize policy to natural size so that buttons will resize to background images
self.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+
+ Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledImage = Dali::ResourceImage::New( DISABLED_UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledSelectedImage = Dali::ResourceImage::New( DISABLED_SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+
+ SetButtonImage( ImageActor::New( buttonImage ) );
+ SetSelectedImage( ImageActor::New( selectedImage ) );
+ SetDisabledImage( ImageActor::New( disabledImage ) );
+ SetDisabledSelectedImage( ImageActor::New( disabledSelectedImage ) );
}
void PushButton::OnLabelSet()
RelayoutRequest();
}
-void PushButton::OnDisabledBackgroundImageSet()
+void PushButton::OnDisabledSelectedImageSet()
{
ConfigureSizeNegotiation();
RelayoutRequest();
}
-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()
+void PushButton::OnDisabledBackgroundImageSet()
{
- StopTransitionAnimation();
+ ConfigureSizeNegotiation();
+ RelayoutRequest();
}
void PushButton::OnSizeSet( const Vector3& targetSize )
}
}
-void PushButton::StartTransitionAnimation()
+void PushButton::PrepareForTranstionIn( Actor actor )
{
- if( mTransitionAnimation )
- {
- mTransitionAnimation.FinishedSignal().Connect( this, &PushButton::TransitionAnimationFinished );
- mTransitionAnimation.Play();
- }
+ actor.SetOpacity( 0.0f );
}
-void PushButton::StopTransitionAnimation( bool remove )
+void PushButton::PrepareForTranstionOut( Actor actor )
{
- if( mTransitionAnimation )
- {
- mTransitionAnimation.Clear();
- mTransitionAnimation.Reset();
- }
-
- if( remove )
- {
- UpdatePaintTransitionState();
- }
+ actor.SetOpacity( 1.0f );
}
-void PushButton::FadeInImage( Actor& image, float opacity, Vector3 scale )
+void PushButton::OnTransitionIn( Actor actor )
{
- if( image )
- {
- image.SetOpacity( opacity );
- image.SetScale( scale );
-
- if( !mTransitionAnimation )
- {
- mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
- }
+ FadeImageTo( actor, 1.f );
+}
- mTransitionAnimation.AnimateTo( Property( image, Actor::Property::COLOR_ALPHA ), 1.f );
- }
+void PushButton::OnTransitionOut( Actor actor )
+{
+ FadeImageTo( actor, 0.0f );
}
-void PushButton::FadeOutImage( Actor& image, float opacity, Vector3 scale )
+void PushButton::FadeImageTo( Actor actor, float opacity )
{
- if( image )
+ if( actor )
{
- image.SetOpacity( opacity );
- image.SetScale( scale );
+ Dali::Animation transitionAnimation = GetTransitionAnimation();
+ DALI_ASSERT_DEBUG( transitionAnimation );
- if( !mTransitionAnimation )
+ if( transitionAnimation )
{
- mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
+ transitionAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), opacity );
}
-
- mTransitionAnimation.AnimateTo( Property( image, Actor::Property::COLOR_ALPHA ), 0.f );
}
}
-void PushButton::TransitionAnimationFinished( Dali::Animation& source )
-{
- StopTransitionAnimation();
-}
-
Vector3 PushButton::GetNaturalSize()
{
Vector3 size;
// EXTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
virtual void OnDisabledImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
+ * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet()
*/
- virtual void OnDisabledBackgroundImageSet();
+ virtual void OnDisabledSelectedImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnSelected()
+ * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
*/
- virtual bool OnSelected();
+ virtual void OnDisabledBackgroundImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnDisabled()
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
*/
- virtual bool OnDisabled();
+ virtual void PrepareForTranstionIn( Actor actor );
/**
- * @copydoc Toolkit::Internal::Button::OnPressed()
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
*/
- virtual bool OnPressed();
+ virtual void PrepareForTranstionOut( Actor actor );
/**
- * @copydoc Toolkit::Internal::Button::OnReleased()
+ * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
*/
- virtual bool OnReleased();
+ virtual void OnTransitionIn( Actor actor );
/**
- * @copydoc Toolkit::Internal::Button::StopAllAnimations()
+ * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
*/
- virtual void StopAllAnimations();
+ virtual void OnTransitionOut( Actor actor );
private: // From Control
private:
/**
- * Starts the transition animation.
- * PushButton::TransitionAnimationFinished slot is called when the animation finishes.
- */
- void StartTransitionAnimation();
-
- /**
- * Stops the transition animation.
- * @param[in] remove If true, removes the fadeout actor from root.
- */
- void StopTransitionAnimation( bool remove = true );
-
- /**
* It adds the actor to the root actor and to the fade in animation.
- * @param[inout] image The actor.
- * @param[in] opacity The initial opacity.
- * @param[in] scale The initial scale.
- */
- void FadeInImage( Actor& image, float opacity = 0.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) );
-
- /**
- * It adds the actor fade out animation and stores it to be removed when the animation finishes.
- * @param[in] layer Defines if the actor is going to be stored in the mFadeOutBackgroundImage or mFadeOutCheckedImage member.
- * @param[inout] image The actor.
- * @param[in] opacity The initial opacity.
- * @param[in] scale The initial scale.
+ * @param[inout] actor The actor.
+ * @param[in] opacity The opacity to fade to
*/
- void FadeOutImage( Actor& image, float opacity = 1.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) );
+ void FadeImageTo( Actor actor, float opacity );
/**
* @brief Custom configuration for size negotiation
*/
void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
- // slots
-
- /**
- * Called when the transition animation finishes.
- */
- void TransitionAnimationFinished( Dali::Animation& source );
-
private:
// Undefined
private:
- Animation mTransitionAnimation; ///< Animation used in the state transitions.
Vector3 mSize; ///< The button's size.
};
const char* const UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-unselected.png";
const char* const SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-selected.png";
+const char* const DISABLED_UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-unselected-disabled.png";
+const char* const DISABLED_SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-selected-disabled.png";
const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f );
}
// Wrap size of radio button around all its children
self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
- Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR );
- Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR );
+ Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledImage = Dali::ResourceImage::New( DISABLED_UNSELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
+ Image disabledSelectedImage = Dali::ResourceImage::New( DISABLED_SELECTED_BUTTON_IMAGE_DIR, ResourceImage::ON_DEMAND, ResourceImage::NEVER );
SetButtonImage( ImageActor::New( buttonImage ) );
SetSelectedImage( ImageActor::New( selectedImage ) );
+ SetDisabledImage( ImageActor::New( disabledImage ) );
+ SetDisabledSelectedImage( ImageActor::New( disabledSelectedImage ) );
RelayoutRequest();
}
label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
}
- if( IsSelected() )
+ if( IsSelected() && GetSelectedImage() )
{
label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
- else
+ else if( GetButtonImage() )
{
label.SetX( GetButtonImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
+ else
+ {
+ label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ }
}
}
-bool RadioButton::OnSelected()
+void RadioButton::OnSelected()
{
- Actor& buttonImage = GetButtonImage();
- Actor& selectedImage = GetSelectedImage();
Actor& label = GetLabel();
PaintState paintState = GetPaintState();
-
switch( paintState )
{
case UnselectedState:
}
}
- RemoveChild( buttonImage );
-
- if( label )
+ Actor& selectedImage = GetSelectedImage();
+ if( label && selectedImage )
{
label.SetX( selectedImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
}
case SelectedState:
{
- RemoveChild( selectedImage );
-
- if( label )
+ Actor& buttonImage = GetButtonImage();
+ if( label && buttonImage )
{
label.SetX( buttonImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
}
break;
}
}
-
- // there is no animation
- return false;
}
} // namespace Internal
/**
* @copydoc Toolkit::Internal::Button::OnSelected()
*/
- virtual bool OnSelected();
+ virtual void OnSelected();
/**
* @copydoc Toolkit::Internal::Button::OnLabelSet()