X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fpush-button-impl.h;h=f1925a3c40fbfc6ccc13a247ccbb246f90206ec3;hp=730b7466f1ee66f483f8a791ca9c9addf18cc358;hb=06e563f8a982e25a0efe2d91c794657dc8e4bc4a;hpb=2acdedcc7c7e732a9ec97d08c8cee7423ed6ebf7 diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.h b/dali-toolkit/internal/controls/buttons/push-button-impl.h index 730b746..f1925a3 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.h @@ -19,7 +19,7 @@ */ // EXTERNAL INCLUDES -#include +#include // INTERNAL INCLUDES #include @@ -49,29 +49,214 @@ public: */ static Dali::Toolkit::PushButton New(); -protected: // From Button +protected: /** - * Sets the Leave signal. + * Construct a new PushButton. + */ + PushButton(); + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~PushButton(); + +public: + + // Properties + + /** + * Enum for the alignment modes of the icon. + */ + enum IconAlignment + { + LEFT, + RIGHT, + TOP, + BOTTOM, + DEFAULT = RIGHT + }; + + /** + * 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. + */ + static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ); + + /** + * 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. + */ + static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ); + +private: // From Button + + /** + * @copydoc Toolkit::Internal::Button::OnButtonInitialize() */ virtual void OnButtonInitialize(); -protected: // From Control + /** + * @copydoc Toolkit::Internal::Button::OnLabelSet() + */ + virtual void OnLabelSet(); /** - * @copydoc Control::GetNaturalSize() + * @copydoc Toolkit::Internal::Button::OnButtonImageSet() + */ + virtual void OnButtonImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnSelectedImageSet() + */ + virtual void OnSelectedImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnBackgroundImage() + */ + virtual void OnBackgroundImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet() + */ + virtual void OnSelectedBackgroundImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnDisabledImageSet() + */ + virtual void OnDisabledImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet() + */ + virtual void OnDisabledSelectedImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet() + */ + virtual void OnDisabledBackgroundImageSet(); + + /** + * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor ) + */ + virtual void PrepareForTranstionIn( Actor actor ); + + /** + * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor ) + */ + virtual void PrepareForTranstionOut( Actor actor ); + + /** + * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor ) + */ + virtual void OnTransitionIn( Actor actor ); + + /** + * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor ) + */ + virtual void OnTransitionOut( Actor actor ); + +private: // From Control + + /** + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) + */ + virtual void OnSizeSet( const Vector3& targetSize ); + + /** + * @copydoc Toolkit::Control::GetNaturalSize */ virtual Vector3 GetNaturalSize(); /** - * Construct a new PushButton. + * @copydoc Toolkit::Control::OnSetResizePolicy */ - PushButton(); + virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ); + +private: /** - * A reference counted object may only be deleted by calling Unreference() + * 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 ~PushButton(); + void FadeImageTo( Actor actor, float opacity ); + + /** + * @brief Custom configuration for size negotiation + */ + void ConfigureSizeNegotiation(); + + /** + * @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 ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label ); + + /** + * @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 SetIcon( DecorationState state, const std::string iconFilename ); + + /** + * @brief Gets either the selected or unselected icon. + * + * @param[in] state The icon state to get + * @return The filename of the icon + */ + std::string& GetIcon( DecorationState state ); + + /** + * @brief Sets the alignment mode to use to align the icon to the label. + * + * @param[in] iconAlignment The alignment mode to use + */ + void SetIconAlignment( const PushButton::IconAlignment iconAlignment ); + + /** + * @brief Gets the alignment mode used to align the icon to the label. + * + * @return The alignment mode in use + */ + const PushButton::IconAlignment GetIconAlignment() const; + + /** + * @brief Sets the padding for the label. + * + * @param[in] padding The padding to set + */ + void SetLabelPadding( const Vector4& padding ); + + /** + * @brief Gets the padding for the label. + * + * @return The label padding + */ + Vector4 GetLabelPadding(); + + /** + * @brief Sets the padding for the icon. + * + * @param[in] padding The padding to set + */ + void SetIconPadding( const Vector4& padding ); + + /** + * @brief Gets the padding for the icon. + * + * @return The icon padding + */ + Vector4 GetIconPadding(); private: @@ -80,6 +265,14 @@ private: // Undefined PushButton& operator=( const PushButton& ); + +private: + + 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