*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/common/vector-wrapper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
*/
virtual ~PushButton();
-public: // From Button
+public:
+
+ // Properties
/**
- * @copydoc Toolkit::Internal::Button::SetButtonImage( Actor image )
+ * Enum for the alignment modes of the icon.
*/
- virtual void SetButtonImage( Actor image );
+ enum IconAlignment
+ {
+ LEFT,
+ RIGHT,
+ TOP,
+ BOTTOM,
+ DEFAULT = RIGHT
+ };
/**
- * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image )
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
*/
- virtual void SetSelectedImage( Actor image );
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
/**
- * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image )
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
*/
- virtual void SetBackgroundImage( Actor image );
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+
+private: // From Button
/**
- * @copydoc Toolkit::Internal::Button::SetDisabledImage( Actor image )
+ * @copydoc Toolkit::Internal::Button::OnButtonInitialize
*/
- virtual void SetDisabledImage( Actor image );
+ virtual void OnButtonInitialize();
/**
- * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image )
+ * @copydoc Toolkit::Internal::Button::OnLabelSet
*/
- virtual void SetDisabledBackgroundImage( Actor image );
+ virtual void OnLabelSet( bool noPadding );
-private: // From Button
+ /**
+ * @copydoc Toolkit::Internal::Button::OnButtonImageSet
+ */
+ virtual void OnButtonImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
+ * @copydoc Toolkit::Internal::Button::OnSelectedImageSet
*/
- virtual void OnButtonInitialize();
+ virtual void OnSelectedImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnLabelSet()
+ * @copydoc Toolkit::Internal::Button::OnBackgroundImage
*/
- virtual void OnLabelSet();
+ virtual void OnBackgroundImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnSelected()
+ * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet
*/
- virtual void OnSelected( bool selected );
+ virtual void OnSelectedBackgroundImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled )
+ * @copydoc Toolkit::Internal::Button::OnDisabledImageSet
*/
- virtual void OnDisabled( bool disabled );
+ virtual void OnDisabledImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnPressed()
+ * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet
*/
- virtual void OnPressed();
+ virtual void OnDisabledSelectedImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnReleased()
+ * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet
*/
- virtual void OnReleased();
+ virtual void OnDisabledBackgroundImageSet();
/**
- * @copydoc Toolkit::Internal::Button::OnClicked()
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
*/
- virtual void OnClicked();
+ virtual void PrepareForTranstionIn( Actor actor );
-private: // From Control
+ /**
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
+ */
+ virtual void PrepareForTranstionOut( Actor actor );
/**
- * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
+ * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
*/
- virtual void OnControlSizeSet( const Vector3& targetSize );
+ virtual void OnTransitionIn( Actor actor );
/**
- * @copydoc Toolkit::Control::GetNaturalSize()
+ * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
*/
- virtual Vector3 GetNaturalSize();
+ virtual void OnTransitionOut( Actor actor );
-private:
+private: // From Control
/**
- * Used in the FadeOut functions.
+ * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
*/
- enum ImageLayer
- {
- Background, ///< Fade out the background.
- Foreground ///< Fade out the foreground.
- };
+ virtual void OnSizeSet( const Vector3& targetSize );
/**
- * Gets the button image that is fading out.
- * @return A reference to the button image that is fading out.
+ * @copydoc Toolkit::Control::GetNaturalSize
*/
- Actor& GetFadeOutButtonImage();
+ virtual Vector3 GetNaturalSize();
/**
- * Gets the background image that is fading out.
- * @return A reference to the background image that is fading out.
+ * @copydoc Toolkit::Control::OnSetResizePolicy
*/
- Actor& GetFadeOutBackgroundImage();
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+
+private:
/**
- * Adds the actor to the fade in animation. It creates a fade in animation if needed.
- * @param[in] actor The actor.
+ * It adds the actor to the root actor and to the fade in animation.
+ * @param[inout] actor The actor.
+ * @param[in] opacity The opacity to fade to
*/
- void AddToFadeInAnimation( const Actor& actor );
+ void FadeImageTo( Actor actor, float opacity );
/**
- * Starts the fade in animation.
- * PushButton::FadeInAnimationFinished slot is called when the animation finishes.
+ * @brief Custom configuration for size negotiation
*/
- void StartFadeInAnimation();
+ void ConfigureSizeNegotiation();
/**
- * Stops the fade in animation.
+ * @brief Configure size negotiation for a given dimension
+ *
+ * @param[in] dimension The dimension to configure
+ * @param[in] images The list of images to configure
+ * @param[in] label The text label to configure
*/
- void StopFadeInAnimation();
+ void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
/**
- * Adds the actor to the fade out animation. It creates a fade out animation if needed.
+ * @brief Sets either the selected or unselected icon.
+ *
+ * @param[in] state The icon state to set
+ * @param[in] iconFilename The filename of the icon
*/
- void AddToFadeOutAnimation( const Actor& actor );
+ void SetIcon( DecorationState state, const std::string iconFilename );
/**
- * Starts the fade out animation.
- * PushButton::FadeOutAnimationFinished slot is called when the animation finishes.
+ * @brief Gets either the selected or unselected icon.
+ *
+ * @param[in] state The icon state to get
+ * @return The filename of the icon
*/
- void StartFadeOutAnimation();
+ std::string& GetIcon( DecorationState state );
/**
- * Stops the fade out animation.
- * It removes the actor stored in PushButton::mFadeOutBackgroundImage and PushButton::mFadeOutCheckedImage.
- * @param[in] remove If true, removes the fadeout actor from root.
+ * @brief Sets the alignment mode to use to align the icon to the label.
+ *
+ * @param[in] iconAlignment The alignment mode to use
*/
- void StopFadeOutAnimation( bool remove = true );
+ void SetIconAlignment( const PushButton::IconAlignment iconAlignment );
/**
- * 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.
+ * @brief Gets the alignment mode used to align the icon to the label.
+ *
+ * @return The alignment mode in use
*/
- void FadeInImage( Actor& image, float opacity = 0.f, int priority = -1 );
+ const PushButton::IconAlignment GetIconAlignment() const;
/**
- * 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.
+ * @brief Sets the padding for the label.
+ *
+ * @param[in] padding The padding to set
*/
- void FadeOutImage( ImageLayer layer, Actor& image, float opacity = 1.f );
+ void SetLabelPadding( const Vector4& padding );
- // slots
+ /**
+ * @brief Gets the padding for the label.
+ *
+ * @return The label padding
+ */
+ Vector4 GetLabelPadding();
/**
- * Called when the fade out animation finishes.
- * It changes the check button paint state and removes actors from the root.
+ * @brief Sets the padding for the icon.
+ *
+ * @param[in] padding The padding to set
*/
- void FadeOutAnimationFinished( Dali::Animation& source );
+ void SetIconPadding( const Vector4& padding );
/**
- * Called when the fade in animation finishes.
- * It changes the check button paint state.
+ * @brief Gets the padding for the icon.
+ *
+ * @return The icon padding
*/
- void FadeInAnimationFinished( Dali::Animation& source );
+ Vector4 GetIconPadding();
private:
private:
- Animation mFadeInAnimation; ///< Animation used in the state transitions.
- Animation mFadeOutAnimation; ///< Animation used in the state transitions.
-
- Actor mFadeOutButtonContent; ///< Stores a foreground content, which is in a fade out animation, to be removed when the animation finishes.
- Actor mFadeOutBackgroundContent; ///< Stores a background content, which is in a fade out animation, to be removed when the animation finishes.
-
- Vector3 mSize; ///< The button's size.
-
- PaintState mPaintState; ///< The paint state.
+ std::string mIconName[ DECORATION_STATES ]; ///< The original filenames for the icons.
+ Padding mLabelPadding; ///< The padding around the label (if present).
+ Padding mIconPadding; ///< The padding around the icon (if present).
+ IconAlignment mIconAlignment; ///< The alignment of the icon against the label.
+ Vector3 mSize; ///< The button's size.
};
} // namespace Internal