#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/relayout-helper.h>
namespace Dali
{
buttonImage = image;
- FadeInImage( buttonImage );
+ FadeInImage( buttonImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
else
{
buttonImage = image;
- Self().Add( buttonImage );
+ Self().Insert( 0, buttonImage );
}
break;
}
// Replaces the button image.
buttonImage = image;
- Self().Add( buttonImage );
+ Self().Insert( 0, buttonImage );
FadeOutImage( Foreground, buttonImage, opacity );
StartFadeOutAnimation();
buttonImage = image;
- FadeInImage( buttonImage );
+ FadeInImage( buttonImage, 0.0f, 0 );
StartFadeInAnimation();
break;
}
buttonImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
buttonImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
buttonImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
- buttonImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ buttonImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ buttonImage.SetName( "BUTTON_IMAGE" );
}
void PushButton::SetSelectedImage( Actor image )
selectedImage = image;
- FadeInImage( selectedImage );
+ FadeInImage( selectedImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
else
{
selectedImage = image;
- Self().Add( selectedImage );
+ Self().Insert( 0, selectedImage );
}
break;
}
// Replaces the button image.
selectedImage = image;
- Self().Add( selectedImage );
+ Self().Insert( 0, selectedImage );
FadeOutImage( Foreground, selectedImage, opacity );
StartFadeOutAnimation();
selectedImage = image;
- FadeInImage( selectedImage );
+ FadeInImage( selectedImage, 0.0f, 0 );
StartFadeInAnimation();
break;
}
selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
selectedImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
- selectedImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ selectedImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
}
void PushButton::SetBackgroundImage( Actor image )
backgroundImage = image;
- FadeInImage( backgroundImage );
+ FadeInImage( backgroundImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
else
{
backgroundImage = image;
- Self().Add( backgroundImage );
+ Self().Insert( 0, backgroundImage );
}
break;
}
// Replaces the button image.
backgroundImage = image;
- Self().Add( backgroundImage );
+ Self().Insert( 0, backgroundImage );
FadeOutImage( Background, backgroundImage, opacity );
StartFadeOutAnimation();
backgroundImage = image;
- FadeInImage( backgroundImage );
+ FadeInImage( backgroundImage, 0.0f, 0 );
StartFadeInAnimation();
break;
}
backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
backgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH );
- backgroundImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
}
void PushButton::SetDisabledImage( Actor image )
disabledImage = image;
- FadeInImage( disabledImage );
+ FadeInImage( disabledImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
disabledImage = image;
- FadeInImage( disabledImage );
+ FadeInImage( disabledImage, 0.0f, 0 );
StartFadeInAnimation();
break;
}
disabledImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
disabledImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
disabledImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
- disabledImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ disabledImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
}
void PushButton::SetDisabledBackgroundImage( Actor image )
disabledBackgroundImage = image;
- FadeInImage( disabledBackgroundImage );
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
disabledBackgroundImage = image;
- FadeInImage( disabledBackgroundImage );
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
StartFadeInAnimation();
break;
}
disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
disabledBackgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH );
- disabledBackgroundImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+ disabledBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
}
void PushButton::OnButtonInitialize()
// Push button requires the Leave event.
Actor root = Self();
root.SetLeaveRequired( true );
+
+ // Set resize policy to natural size so that buttons will resize to background images
+ root.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
}
void PushButton::OnLabelSet()
{
StopFadeOutAnimation();
FadeOutImage( Foreground, buttonImage );
- FadeInImage( selectedImage );
+ FadeInImage( selectedImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
{
StopFadeOutAnimation();
FadeOutImage( Foreground, selectedImage );
- FadeInImage( buttonImage );
+ FadeInImage( buttonImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeInAnimation();
FadeOutImage( Foreground, selectedImage, 1.f - opacity );
- FadeInImage( buttonImage, opacity );
+ FadeInImage( buttonImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeInAnimation();
FadeOutImage( Foreground, buttonImage, 1.f - opacity );
- FadeInImage( selectedImage, opacity );
+ FadeInImage( selectedImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeOutAnimation();
FadeOutImage( Background, backgroundImage );
FadeOutImage( Foreground, buttonImage );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledImage );
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
+ FadeInImage( disabledImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeOutAnimation();
FadeOutImage( Background, backgroundImage );
FadeOutImage( Foreground, selectedImage );
- FadeInImage( disabledBackgroundImage );
- FadeInImage( disabledImage );
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
+ FadeInImage( disabledImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeOutAnimation();
FadeOutImage( Background, disabledBackgroundImage );
FadeOutImage( Foreground, disabledImage );
- FadeInImage( backgroundImage );
- FadeInImage( buttonImage );
+ FadeInImage( backgroundImage, 0.0f, 0 );
+ FadeInImage( buttonImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeOutAnimation();
FadeOutImage( Background, disabledBackgroundImage );
FadeOutImage( Foreground, disabledImage );
- FadeInImage( backgroundImage );
- FadeInImage( selectedImage );
+ FadeInImage( backgroundImage, 0.0f, 0 );
+ FadeInImage( selectedImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, selectedImage, 1.f - opacity );
FadeOutImage( Background, backgroundImage );
- FadeInImage( disabledImage );
- FadeInImage( disabledBackgroundImage );
+ FadeInImage( disabledImage, 0.0f, 0 );
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, buttonImage, 1.f - opacity );
FadeOutImage( Background, backgroundImage );
- FadeInImage( disabledImage );
- FadeInImage( disabledBackgroundImage );
+ FadeInImage( disabledImage, 0.0f, 0);
+ FadeInImage( disabledBackgroundImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, disabledImage, 1.f - opacity );
FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity );
- FadeInImage( buttonImage, opacity );
- FadeInImage( backgroundImage, opacity );
+ FadeInImage( buttonImage, opacity, 0 );
+ FadeInImage( backgroundImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, buttonImage, 1.f - opacity );
FadeOutImage( Background, backgroundImage, 1.f - opacity );
- FadeInImage( disabledImage, opacity );
- FadeInImage( disabledBackgroundImage, opacity );
+ FadeInImage( disabledImage, opacity, 0 );
+ FadeInImage( disabledBackgroundImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, disabledImage, 1.f - opacity );
FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity );
- FadeInImage( selectedImage, opacity );
- FadeInImage( backgroundImage, opacity );
+ FadeInImage( selectedImage, opacity, 0 );
+ FadeInImage( backgroundImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
FadeOutImage( Foreground, selectedImage, 1.f - opacity );
FadeOutImage( Background, backgroundImage, 1.f - opacity );
- FadeInImage( disabledImage, opacity );
- FadeInImage( disabledBackgroundImage, opacity );
+ FadeInImage( disabledImage, opacity, 0 );
+ FadeInImage( disabledBackgroundImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
{
StopFadeOutAnimation();
FadeOutImage( Foreground, buttonImage );
- FadeInImage( selectedImage );
+ FadeInImage( selectedImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeInAnimation();
FadeOutImage( Foreground, buttonImage, 1.f - opacity );
- FadeInImage( selectedImage, opacity );
+ FadeInImage( selectedImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
{
StopFadeOutAnimation();
FadeOutImage( Foreground, selectedImage );
- FadeInImage( buttonImage );
+ FadeInImage( buttonImage, 0.0f, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
StopFadeInAnimation();
FadeOutImage( Foreground, selectedImage, 1.f - opacity );
- FadeInImage( buttonImage, opacity );
+ FadeInImage( buttonImage, opacity, 0 );
StartFadeOutAnimation();
StartFadeInAnimation();
ImageActor imageActor = FindImageActor( GetButtonImage() );
if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
{
- Vector3 imageSize = RelayoutHelper::GetNaturalSize( imageActor );
+ Vector3 imageSize = imageActor.GetNaturalSize();
if( widthIsZero )
{
ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() );
if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
{
- Vector3 imageSize = RelayoutHelper::GetNaturalSize( backgroundImageActor );
+ Vector3 imageSize = backgroundImageActor.GetNaturalSize();
if( widthIsZero )
{
}
}
-void PushButton::FadeInImage( Actor& image, float opacity )
+void PushButton::FadeInImage( Actor& image, float opacity, int priority )
{
if( image )
{
image.SetOpacity( opacity );
if( !image.GetParent() )
{
- Self().Add( image );
+ if( priority > -1 )
+ {
+ Self().Insert( priority, image );
+ }
+ else
+ {
+ Self().Add( image );
+ }
}
AddToFadeInAnimation( image );