X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fpush-button-impl.h;h=7a2347485a2f9939fd06d8c8275643fdfdccf937;hb=620ac79821b89142af1926f3577c7fa003f16ad3;hp=1297fef92e9546bbf9ec5fa8d522821d74644dd6;hpb=306d2f61a1b64179e801fa8a0bb2bd7b4e9dd682;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.h b/dali-toolkit/internal/controls/buttons/push-button-impl.h index 1297fef..7a23474 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.h @@ -19,8 +19,8 @@ */ // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include @@ -50,318 +50,153 @@ public: */ 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 ); - - /** - * @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 ) - */ - void SetSelectedImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) - */ - void SetSelectedImage( Actor image ); +protected: /** - * Used by the painter only. - * @return A reference to the selected image. - */ - Actor& GetSelectedImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() - */ - Actor GetSelectedImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Image image ) - */ - void SetDisabledBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) - */ - void SetDisabledBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the disabled background image. - */ - Actor& GetDisabledBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() + * Construct a new PushButton. */ - Actor GetDisabledBackgroundImage() const; + PushButton(); /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Image image ) + * A reference counted object may only be deleted by calling Unreference() */ - void SetDisabledImage( Image image ); + virtual ~PushButton(); - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) - */ - void SetDisabledImage( Actor image ); +private: // From Button /** - * Used by the painter only. - * @return A reference to the disabled button image. + * @copydoc Toolkit::Internal::Button::OnButtonInitialize() */ - Actor& GetDisabledImage(); + virtual void OnButtonInitialize(); /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() + * @copydoc Toolkit::Internal::Button::OnLabelSet() */ - Actor GetDisabledImage() const; + virtual void OnLabelSet(); /** - * @copydoc Dali::Toolkit::PushButton::SetLabel( const std::string& label ) + * @copydoc Toolkit::Internal::Button::OnButtonImageSet() */ - void SetLabel( const std::string& label ); + virtual void OnButtonImageSet(); /** - * @copydoc Dali::Toolkit::PushButton::SetLabel( Actor label ) + * @copydoc Toolkit::Internal::Button::OnSelectedImageSet() */ - void SetLabel( Actor label ); + virtual void OnSelectedImageSet(); /** - * @copydoc Dali::Toolkit::PushButton::GetLabel() + * @copydoc Toolkit::Internal::Button::OnBackgroundImage() */ - Actor GetLabel() const; + virtual void OnBackgroundImageSet(); /** - * Used by the painter only. - * @return A reference to the label actor. + * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet() */ - Actor& GetLabel(); + virtual void OnSelectedBackgroundImageSet(); /** - * Used by the painter only. - * @return A reference to the background image that is fading out. + * @copydoc Toolkit::Internal::Button::OnDisabledImageSet() */ - Actor& GetFadeOutBackgroundImage(); + virtual void OnDisabledImageSet(); /** - * Used by the painter only. - * @return A reference to the button image that is fading out. + * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet() */ - Actor& GetFadeOutButtonImage(); - -public: - - // Signals + virtual void OnDisabledBackgroundImageSet(); /** - * @copydoc Dali::Toolkit::PushButton::PressedSignal() + * @copydoc Toolkit::Internal::Button::OnSelected() */ - Toolkit::PushButton::PressedSignalType& PressedSignal(); + virtual bool OnSelected(); /** - * @copydoc Dali::Toolkit::PushButton::ReleasedSignal() + * @copydoc Toolkit::Internal::Button::OnDisabled() */ - Toolkit::PushButton::ReleasedSignalType& ReleasedSignal(); + virtual bool OnDisabled(); /** - * 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::OnPressed() */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - - // Properties + virtual bool OnPressed(); /** - * @copydoc Button::SetProperty + * @copydoc Toolkit::Internal::Button::OnReleased() */ - static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value ); + virtual bool OnReleased(); /** - * @copydoc Button::GetProperty + * @copydoc Toolkit::Internal::Button::StopAllAnimations() */ - static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ); - -protected: // From Button + virtual void StopAllAnimations(); - /** - * Sets the Leave signal. - */ - virtual void OnButtonInitialize(); +private: // From Control /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is pressed. + * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize ) */ - virtual void OnButtonDown(); + virtual void OnControlSizeSet( const Vector3& targetSize ); /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is released. + * @copydoc Toolkit::Control::GetNaturalSize */ - virtual void OnButtonUp(); + Vector3 GetNaturalSize(); /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the touch point leaves the boundary of the button. + * @copydoc Toolkit::Control::OnSetResizePolicy */ - virtual void OnTouchPointLeave(); + virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ); - /** - * Currently it doesn't need different behaviour than @see OnTouchPointLeave() - */ - virtual void OnTouchPointInterrupted(); +private: /** - * Sets the push button animation time. - * @param animationTime The animation time in seconds. + * Starts the transition animation. + * PushButton::TransitionAnimationFinished slot is called when the animation finishes. */ - virtual void OnAnimationTimeSet( float animationTime ); + void StartTransitionAnimation(); /** - * Retrieves the animation time. - * @return The animation time in seconds. + * Stops the transition animation. + * @param[in] remove If true, removes the fadeout actor from root. */ - virtual float OnAnimationTimeRequested() const; + void StopTransitionAnimation( bool remove = true ); /** - * This method is called when the button is removed from the stage. + * 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. */ - virtual void OnButtonStageDisconnection(); - -protected: // From Control + void FadeInImage( Actor& image, float opacity = 0.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) ); /** - * Respond the activate notification. + * 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. */ - virtual void OnActivated(); + void FadeOutImage( Actor& image, float opacity = 1.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) ); /** - * @copydoc Control::GetNaturalSize() + * @brief Custom configuration for size negotiation */ - virtual Vector3 GetNaturalSize(); - -private: + void ConfigureSizeNegotiation(); /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. + * @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 DoClickAction(const PropertyValueContainer& attributes); + void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const ActorContainer& images, Actor& label ); -public: + // slots /** - * 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 + * Called when the transition animation finishes. */ - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes); - - /** - * Construct a new PushButton. - */ - PushButton(); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~PushButton(); + void TransitionAnimationFinished( Dali::Animation& source ); private: @@ -371,46 +206,10 @@ 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; + Animation mTransitionAnimation; ///< Animation used in the state transitions. + Vector3 mSize; ///< The button's size. }; } // namespace Internal