*/
// EXTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/common/vector-wrapper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
*/
static Dali::Toolkit::PushButton New();
- /**
- * @copydoc Dali::Toolkit::PushButton::SetAutoRepeating( bool autoRepeating )
- */
- void SetAutoRepeating( bool autoRepeating );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::IsAutoRepeating() const
- */
- bool IsAutoRepeating() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
- */
- void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::GetInitialAutoRepeatingDelay() const
- */
- float GetInitialAutoRepeatingDelay() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
- */
- void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::GetNextAutoRepeatingDelay() const
- */
- float GetNextAutoRepeatingDelay() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetToggleButton( bool toggle )
- */
- void SetToggleButton( bool toggle );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::IsToggleButton() const
- */
- bool IsToggleButton() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetToggled( bool toggle )
- */
- void SetToggled( bool toggle );
+protected:
/**
- * @copydoc Dali::Toolkit::PushButton::IsToggled() const
- */
- bool IsToggled() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetButtonImage( const Image image )
- */
- void SetButtonImage( Image image );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image )
- */
- void SetButtonImage( Actor image );
-
- /**
- * Used by the painter only.
- * @return A reference to the button image.
- */
- Actor& GetButtonImage();
-
- /**
- * @copydoc Dali::Toolkit::PushButton::
- */
- Actor GetButtonImage() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( const Image image )
- */
- void SetBackgroundImage( Image image );
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image )
- */
- void SetBackgroundImage( Actor image );
-
- /**
- * Used by the painter only.
- * @return A reference to the background image.
- */
- Actor& GetBackgroundImage();
-
- /**
- * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage()
- */
- Actor GetBackgroundImage() const;
-
- /**
- * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( const Image image )
+ * Construct a new PushButton.
*/
- void SetSelectedImage( Image image );
+ PushButton();
/**
- * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image )
+ * A reference counted object may only be deleted by calling Unreference()
*/
- void SetSelectedImage( Actor image );
+ virtual ~PushButton();
- /**
- * Used by the painter only.
- * @return A reference to the selected image.
- */
- Actor& GetSelectedImage();
+public:
- /**
- * @copydoc Dali::Toolkit::PushButton::GetSelectedImage()
- */
- Actor GetSelectedImage() const;
+ // Properties
/**
- * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Image image )
+ * Enum for the alignment modes of the icon.
*/
- void SetDisabledBackgroundImage( Image image );
+ enum IconAlignment
+ {
+ LEFT,
+ RIGHT,
+ TOP,
+ BOTTOM,
+ DEFAULT = RIGHT
+ };
/**
- * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( 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.
*/
- void SetDisabledBackgroundImage( Actor image );
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
/**
- * Used by the painter only.
- * @return A reference to the disabled background 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.
*/
- Actor& GetDisabledBackgroundImage();
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
- /**
- * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage()
- */
- Actor GetDisabledBackgroundImage() const;
+private: // From Button
/**
- * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Image image )
+ * @copydoc Toolkit::Internal::Button::OnInitialize
*/
- void SetDisabledImage( Image image );
+ virtual void OnInitialize();
/**
- * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image )
+ * @copydoc Toolkit::Internal::Button::OnLabelSet
*/
- void SetDisabledImage( Actor image );
+ virtual void OnLabelSet( bool noPadding );
/**
- * Used by the painter only.
- * @return A reference to the disabled button image.
+ * @copydoc Toolkit::Internal::Button::OnButtonImageSet
*/
- Actor& GetDisabledImage();
+ virtual void OnButtonImageSet();
/**
- * @copydoc Dali::Toolkit::PushButton::GetDisabledImage()
+ * @copydoc Toolkit::Internal::Button::OnSelectedImageSet
*/
- Actor GetDisabledImage() const;
+ virtual void OnSelectedImageSet();
/**
- * @copydoc Dali::Toolkit::PushButton::SetLabel( const std::string& label )
+ * @copydoc Toolkit::Internal::Button::OnBackgroundImage
*/
- void SetLabel( const std::string& label );
+ virtual void OnBackgroundImageSet();
/**
- * @copydoc Dali::Toolkit::PushButton::SetLabel( Actor label )
+ * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet
*/
- void SetLabel( Actor label );
+ virtual void OnSelectedBackgroundImageSet();
/**
- * @copydoc Dali::Toolkit::PushButton::GetLabel()
+ * @copydoc Toolkit::Internal::Button::OnDisabledImageSet
*/
- Actor GetLabel() const;
+ virtual void OnDisabledImageSet();
/**
- * Used by the painter only.
- * @return A reference to the label actor.
+ * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet
*/
- Actor& GetLabel();
+ virtual void OnDisabledSelectedImageSet();
/**
- * Used by the painter only.
- * @return A reference to the background image that is fading out.
+ * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet
*/
- Actor& GetFadeOutBackgroundImage();
+ virtual void OnDisabledBackgroundImageSet();
/**
- * Used by the painter only.
- * @return A reference to the button image that is fading out.
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
*/
- Actor& GetFadeOutButtonImage();
-
-public:
-
- // Signals
+ virtual void PrepareForTranstionIn( Actor actor );
/**
- * @copydoc Dali::Toolkit::PushButton::PressedSignal()
+ * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
*/
- Toolkit::PushButton::PressedSignalType& PressedSignal();
+ virtual void PrepareForTranstionOut( Actor actor );
/**
- * @copydoc Dali::Toolkit::PushButton::ReleasedSignal()
+ * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
*/
- Toolkit::PushButton::ReleasedSignalType& ReleasedSignal();
+ virtual void OnTransitionIn( Actor actor );
/**
- * Connects a callback function with the object's signals.
- * @param[in] object The object providing the signal.
- * @param[in] tracker Used to disconnect the signal.
- * @param[in] signalName The signal to connect to.
- * @param[in] functor A newly allocated FunctorDelegate.
- * @return True if the signal was connected.
- * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
-
- // Properties
+ virtual void OnTransitionOut( Actor actor );
- /**
- * @copydoc Button::SetProperty
- */
- static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
+private: // From Control
/**
- * @copydoc Button::GetProperty
+ * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
-
-protected: // From Button
+ virtual void OnSizeSet( const Vector3& targetSize );
/**
- * Sets the Leave signal.
+ * @copydoc Toolkit::Control::GetNaturalSize
*/
- virtual void OnButtonInitialize();
+ virtual Vector3 GetNaturalSize();
/**
- * Emits signals and notifies the painter accordingly with the set button
- * properties when the button is pressed.
+ * @copydoc Toolkit::Control::OnSetResizePolicy
*/
- virtual void OnButtonDown();
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
- /**
- * Emits signals and notifies the painter accordingly with the set button
- * properties when the button is released.
- */
- virtual void OnButtonUp();
+private:
/**
- * Emits signals and notifies the painter accordingly with the set button
- * properties when the touch point leaves the boundary of the button.
+ * 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
*/
- virtual void OnTouchPointLeave();
+ void FadeImageTo( Actor actor, float opacity );
/**
- * Currently it doesn't need different behaviour than @see OnTouchPointLeave()
+ * @brief Custom configuration for size negotiation
*/
- virtual void OnTouchPointInterrupted();
+ void ConfigureSizeNegotiation();
/**
- * Sets the push button animation time.
- * @param animationTime The animation time in seconds.
+ * @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
*/
- virtual void OnAnimationTimeSet( float animationTime );
+ void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
/**
- * Retrieves the animation time.
- * @return The animation time in seconds.
+ * @brief Sets either the selected or unselected icon.
+ *
+ * @param[in] state The icon state to set
+ * @param[in] iconFilename The filename of the icon
*/
- virtual float OnAnimationTimeRequested() const;
+ void SetIcon( DecorationState state, const std::string iconFilename );
/**
- * This method is called when the button is removed from the stage.
+ * @brief Gets either the selected or unselected icon.
+ *
+ * @param[in] state The icon state to get
+ * @return The filename of the icon
*/
- virtual void OnButtonStageDisconnection();
-
-protected: // From Control
+ std::string& GetIcon( DecorationState state );
/**
- * Respond the activate notification.
+ * @brief Sets the alignment mode to use to align the icon to the label.
+ *
+ * @param[in] iconAlignment The alignment mode to use
*/
- virtual void OnActivated();
+ void SetIconAlignment( const PushButton::IconAlignment iconAlignment );
/**
- * @copydoc Control::GetNaturalSize()
+ * @brief Gets the alignment mode used to align the icon to the label.
+ *
+ * @return The alignment mode in use
*/
- virtual Vector3 GetNaturalSize();
-
-private:
+ const PushButton::IconAlignment GetIconAlignment() const;
/**
- * Perform the click action to click the button.
- * @param[in] attributes The attributes to perfrom this action.
+ * @brief Sets the padding for the label.
+ *
+ * @param[in] padding The padding to set
*/
- void DoClickAction(const PropertyValueContainer& attributes);
-
-public:
+ void SetLabelPadding( const Vector4& padding );
/**
- * Performs actions as requested using the action name.
- * @param[in] object The object on which to perform the action.
- * @param[in] actionName The action to perform.
- * @param[in] attributes The attributes with which to perfrom this action.
- * @return true if action has been accepted by this control
+ * @brief Gets the padding for the label.
+ *
+ * @return The label padding
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
+ Vector4 GetLabelPadding();
/**
- * Construct a new PushButton.
+ * @brief Sets the padding for the icon.
+ *
+ * @param[in] padding The padding to set
*/
- PushButton();
+ void SetIconPadding( const Vector4& padding );
/**
- * A reference counted object may only be deleted by calling Unreference()
+ * @brief Gets the padding for the icon.
+ *
+ * @return The icon padding
*/
- virtual ~PushButton();
+ Vector4 GetIconPadding();
private:
// Undefined
PushButton& operator=( const PushButton& );
- /**
- * Sets up the autorepeating timer.
- * @param[in] delay The delay time in seconds.
- */
- void SetUpTimer( float delay );
-
- /**
- * Slot called when Dali::Timer::SignalTick signal. Resets the autorepeating timer.
- */
- bool AutoRepeatingSlot();
-
private:
- bool mAutoRepeating; ///< Stores the autorepeating property.
- float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds.
- float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds.
- bool mToggleButton; ///< Stores the toggle property.
-
- // AutoRepeating
- Timer mAutoRepeatingTimer; ///< Timer used to implement the autorepeating property.
-
- // Toggle
- bool mToggled; ///< Stores the toggle state.
-
- // Signals
- Toolkit::PushButton::PressedSignalType mPressedSignal; ///< Signal emitted when the button is pressed.
- Toolkit::PushButton::ReleasedSignalType mReleasedSignal; ///< Signal emitted when the button is released.
-
- Actor mButtonImage; ///< Stores the unselected image.
- Actor mBackgroundImage; ///< Stores the background image.
- Actor mSelectedImage; ///< Stores the selected image.
- Actor mDisabledImage; ///< Stores the disabled image.
- Actor mDisabledBackgroundImage; ///< Stores the disabled background image.
-
- Actor mLabel; ///< Stores the text label.
-
- Actor mFadeOutBackgroundImage; ///< Stores a background image, which is in a fade out animation, to be removed when the animation finishes.
- Actor mFadeOutButtonImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes.
- // Actions
- bool mClickActionPerforming;
+ 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