Refactored Button and derived classes, moving state change and transition logic to...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
index 3eddddc..51164b5 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 // 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>
@@ -100,84 +99,74 @@ private: // From Button
   virtual void OnDisabledImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
+   * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet()
    */
-  virtual void OnDisabledBackgroundImageSet();
+  virtual void OnDisabledSelectedImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnSelected()
+   * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
    */
-  virtual bool OnSelected();
+  virtual void OnDisabledBackgroundImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabled()
+   * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
    */
-  virtual bool OnDisabled();
+  virtual void PrepareForTranstionIn( Actor actor );
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnPressed()
+   * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
    */
-  virtual bool OnPressed();
+  virtual void PrepareForTranstionOut( Actor actor );
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnReleased()
+   * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
    */
-  virtual bool OnReleased();
+  virtual void OnTransitionIn( Actor actor );
 
   /**
-   * @copydoc Toolkit::Internal::Button::StopAllAnimations()
+   * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
    */
-  virtual void StopAllAnimations();
+  virtual void OnTransitionOut( Actor actor );
 
 private: // From Control
 
   /**
-   * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
+   * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
    */
-  virtual void OnControlSizeSet( const Vector3& targetSize );
+  virtual void OnSizeSet( const Vector3& targetSize );
 
   /**
-   * @copydoc Toolkit::Control::GetNaturalSize()
+   * @copydoc Toolkit::Control::GetNaturalSize
    */
   virtual Vector3 GetNaturalSize();
 
-private:
-
   /**
-   * Starts the transition animation.
-   * PushButton::TransitionAnimationFinished slot is called when the animation finishes.
+   * @copydoc Toolkit::Control::OnSetResizePolicy
    */
-  void StartTransitionAnimation();
+  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
 
-  /**
-   * Stops the transition animation.
-   * @param[in] remove If true, removes the fadeout actor from root.
-   */
-  void StopTransitionAnimation( bool remove = true );
+private:
 
   /**
    * 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.
+   * @param[inout] actor The actor.
+   * @param[in] opacity The opacity to fade to
    */
-  void FadeInImage( Actor& image, float opacity = 0.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) );
+  void FadeImageTo( Actor actor, float opacity );
 
   /**
-   * 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.
+   * @brief Custom configuration for size negotiation
    */
-  void FadeOutImage( Actor& image, float opacity = 1.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) );
-
-  // slots
+  void ConfigureSizeNegotiation();
 
   /**
-   * Called when the transition animation finishes.
+   * @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 TransitionAnimationFinished( Dali::Animation& source );
+  void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
 
 private:
 
@@ -189,7 +178,6 @@ private:
 
 private:
 
-  Animation             mTransitionAnimation;       ///< Animation used in the state transitions.
   Vector3               mSize;                      ///< The button's size.
 };