X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fbutton-impl.h;h=5197acadbd4a5002ca7453828d193346e6454558;hb=b46395d404c2b437c4679975e0ed2c073949ba61;hp=2c4c115330c42f7240ddc30b3c77110e39af913d;hpb=38a8b42e1f7765a9b3314a033700fb25d4a6f8fd;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/button-impl.h b/dali-toolkit/internal/controls/buttons/button-impl.h index 2c4c115..5197aca 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-impl.h @@ -41,14 +41,6 @@ namespace Internal */ class Button : public Control { -public: - - // Properties - enum - { - BUTTON_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, - BUTTON_PROPERTY_END_INDEX = BUTTON_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices - }; protected: @@ -150,6 +142,11 @@ public: Actor GetLabel() const; /** + * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) + */ + void SetButtonImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetButtonImage() */ Actor GetButtonImage() const; @@ -161,6 +158,11 @@ public: Actor& GetButtonImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) + */ + void SetSelectedImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() */ Actor GetSelectedImage() const; @@ -172,6 +174,11 @@ public: Actor& GetSelectedImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) + */ + void SetBackgroundImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage() */ Actor GetBackgroundImage() const; @@ -183,6 +190,27 @@ public: Actor& GetBackgroundImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedBackgroundImage( Actor image ) + */ + void SetSelectedBackgroundImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetSelectedBackgroundImage() + */ + Actor GetSelectedBackgroundImage() const; + + /** + * Internal use only. + * @return A reference to the selected background image. + */ + Actor& GetSelectedBackgroundImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) + */ + void SetDisabledImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() */ Actor GetDisabledImage() const; @@ -194,6 +222,11 @@ public: Actor& GetDisabledImage(); /** + * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) + */ + void SetDisabledSelectedImage( Actor image ); + + /** * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledSelectedImage() */ Actor GetDisabledSelectedImage() const; @@ -205,6 +238,11 @@ public: Actor& GetDisabledSelectedImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) + */ + void SetDisabledBackgroundImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() */ Actor GetDisabledBackgroundImage() const; @@ -224,57 +262,71 @@ public: */ static bool DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ); +protected: + /** - * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) + * @return A reference to the label actor. */ - virtual void SetButtonImage( Actor image ) {} + Actor& GetLabel(); /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) + * It changes the transition state of the push button. */ - virtual void SetSelectedImage( Actor image ) {} + void UpdatePaintTransitionState(); + +private: /** - * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) + * Perform the click action to click the button. + * @param[in] attributes The attributes to perfrom this action. */ - virtual void SetBackgroundImage( Actor image ) {} + void DoClickAction( const PropertyValueContainer& attributes ); /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) + * This method is called after the button initialization. + * Could be reimplemented in subclasses to provide specific behaviour. */ - virtual void SetDisabledImage( Actor image ) {} + virtual void OnButtonInitialize() { } /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) + * This method is called when the label is set. */ - virtual void SetDisabledSelectedImage( Actor image ) {} + virtual void OnLabelSet() {} /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) + * This method is called when the button image is set */ - virtual void SetDisabledBackgroundImage( Actor image ) {} + virtual void OnButtonImageSet() {} -protected: + /** + * This method is called when the selected image is set + */ + virtual void OnSelectedImageSet() {} /** - * Internal use only. - * @return A reference to the label actor. + * This method is called when the background image is set */ - Actor& GetLabel(); + virtual void OnBackgroundImageSet() {} -private: + /** + * This method is called when the selected background image is set + */ + virtual void OnSelectedBackgroundImageSet() {} /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. + * This method is called when the disabled button image is set */ - void DoClickAction( const PropertyValueContainer& attributes ); + virtual void OnDisabledImageSet() {} /** - * This method is called after the button initialization. - * Could be reimplemented in subclasses to provide specific behaviour. + * This method is called when the disabled selected image is set */ - virtual void OnButtonInitialize() { } + virtual void OnDisabledSelectedImageSet() {} + + /** + * This method is called when the disabled background image is set + */ + virtual void OnDisabledBackgroundImageSet() {} /** * This method is called from the OnTouchEvent method when the button is down. @@ -308,34 +360,33 @@ private: virtual void OnButtonStageDisconnection(); /** - * This method is called when the label is set. - */ - virtual void OnLabelSet() {} - - /** * This method is called when the \e selected property is changed. + * @return true if the transition animation is started. */ - virtual void OnSelected( bool selected ) {} + virtual bool OnSelected() { return false; } /** * This method is called when the \e disabled property is changed. + * @return true if the transition animation is started. */ - virtual void OnDisabled( bool disabled ) {} + virtual bool OnDisabled() { return false; } /** * This method is called when the button is pressed. + * @return true if the transition animation is started. */ - virtual void OnPressed() {} + virtual bool OnPressed() { return false; } /** * This method is called when the button is released. + * @return true if the transition animation is started. */ - virtual void OnReleased() {} + virtual bool OnReleased() { return false; } /** - * This method is called when the button is clicked + * This method stops all animations */ - virtual void OnClicked() {} + virtual void StopAllAnimations() {} public: @@ -436,6 +487,23 @@ private: */ bool AutoRepeatingSlot(); + /** + * Sets the button as selected or unselected. + * @param[in] selected \e selected property value. + * @param[in] emitSignal Emit a signal if this value is \e true. + */ + void SetSelected( bool selected, bool emitSignal ); + + /** + * This method is called when the button is pressed. + */ + void Pressed(); + + /** + * This method is called when the button is released. + */ + void Released(); + protected: enum ButtonState @@ -454,7 +522,7 @@ protected: DisabledUnselectedState, ///< The button is disabled and unselected. DisabledSelectedState, ///< The button is disabled and selected. UnselectedSelectedTransition, ///< The button is in transition from unselected to selected. - SelectedUnselectedTransition, ///< The push button is in transition from selected to unselected. + SelectedUnselectedTransition, ///< The button is in transition from selected to unselected. UnselectedDisabledTransition, ///< The button is in transition from unselected to disabled. DisabledUnselectedTransition, ///< The button is in transition from disabled to unselected. SelectedDisabledTransition, ///< The button is in transition from selected to disabled. @@ -462,6 +530,23 @@ protected: }; ButtonState GetState(); + PaintState GetPaintState(); + + /** + * Inserts the actor to the button. + */ + void InsertChild( unsigned int index, Actor& actor ); + + /** + * Removes the actor from the button. + */ + void RemoveChild( Actor& actor ); + + /** + * Finds the index of the actor. + * If the actor doesn't exist, return the last index + 1. + */ + unsigned int FindChildIndex( Actor& actor ); private: @@ -486,6 +571,7 @@ private: Actor mButtonContent; ///< Stores the unselected content. Actor mSelectedContent; ///< Stores the selected content. Actor mBackgroundContent; ///< Stores the background content. + Actor mSelectedBackgroundContent; ///< Stores the selected background content. Actor mDisabledContent; ///< Stores the disabled content. Actor mDisabledSelectedContent; ///< Stores the disabled selected content. Actor mDisabledBackgroundContent; ///< Stores the disabled background content. @@ -504,6 +590,7 @@ private: bool mClickActionPerforming; ButtonState mState; ///< Stores the button state. + PaintState mPaintState; ///< Stores the paint state. }; } // namespace Internal @@ -533,4 +620,3 @@ inline const Toolkit::Internal::Button& GetImplementation( const Toolkit::Button } // namespace Dali #endif // __DALI_TOOLKIT_INTERNAL_BUTTON_H__ -