Remove non-public APIs of Animation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
index 730b746..cee57f6 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/animation/animation.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
@@ -49,29 +50,180 @@ 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: // From Button
+
+  /**
+   * @copydoc Toolkit::Internal::Button::SetButtonImage( Actor image )
+   */
+  virtual void SetButtonImage( Actor image );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image )
+   */
+  virtual void SetSelectedImage( Actor image );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image )
+   */
+  virtual void SetBackgroundImage( Actor image );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::SetDisabledImage( Actor image )
+   */
+  virtual void SetDisabledImage( Actor image );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image )
+   */
+  virtual void SetDisabledBackgroundImage( Actor image );
+
+private: // From Button
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
    */
   virtual void OnButtonInitialize();
 
-protected: // From Control
+  /**
+   * @copydoc Toolkit::Internal::Button::OnLabelSet()
+   */
+  virtual void OnLabelSet();
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnSelected()
+   */
+  virtual void OnSelected( bool selected );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled )
+   */
+  virtual void OnDisabled( bool disabled );
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnPressed()
+   */
+  virtual void OnPressed();
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnReleased()
+   */
+  virtual void OnReleased();
+
+  /**
+   * @copydoc Toolkit::Internal::Button::OnClicked()
+   */
+  virtual void OnClicked();
+
+private: // From Control
+
+  /**
+   * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
+   */
+  virtual void OnControlSizeSet( const Vector3& targetSize );
 
   /**
-   * @copydoc Control::GetNaturalSize()
+   * @copydoc Toolkit::Control::GetNaturalSize()
    */
   virtual Vector3 GetNaturalSize();
 
+private:
+
   /**
-   * Construct a new PushButton.
+   * Used in the FadeOut functions.
    */
-  PushButton();
+  enum ImageLayer
+  {
+    Background, ///< Fade out the background.
+    Foreground  ///< Fade out the foreground.
+  };
 
   /**
-   * A reference counted object may only be deleted by calling Unreference()
+   * Gets the button image that is fading out.
+   * @return A reference to the button image that is fading out.
    */
-  virtual ~PushButton();
+  Actor& GetFadeOutButtonImage();
+
+  /**
+   * Gets the background image that is fading out.
+   * @return A reference to the background image that is fading out.
+   */
+  Actor& GetFadeOutBackgroundImage();
+
+  /**
+   * Adds the actor to the fade in animation. It creates a fade in animation if needed.
+   * @param[in] actor The actor.
+   */
+  void AddToFadeInAnimation( Actor& actor );
+
+  /**
+   * Starts the fade in animation.
+   * PushButton::FadeInAnimationFinished slot is called when the animation finishes.
+   */
+  void StartFadeInAnimation();
+
+  /**
+   * Stops the fade in animation.
+   */
+  void StopFadeInAnimation();
+
+  /**
+   * Adds the actor to the fade out animation. It creates a fade out animation if needed.
+   */
+  void AddToFadeOutAnimation( Actor& actor );
+
+  /**
+   * Starts the fade out animation.
+   * PushButton::FadeOutAnimationFinished slot is called when the animation finishes.
+   */
+  void StartFadeOutAnimation();
+
+  /**
+   * Stops the fade out animation.
+   * It removes the actor stored in PushButton::mFadeOutBackgroundImage and PushButton::mFadeOutCheckedImage.
+   * @param[in] remove If true, removes the fadeout actor from root.
+   */
+  void StopFadeOutAnimation( bool remove = true );
+
+  /**
+   * 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.
+   */
+  void FadeInImage( Actor& image, float opacity = 0.f, int priority = -1 );
+
+  /**
+   * 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.
+   */
+  void FadeOutImage( ImageLayer layer, Actor& image, float opacity = 1.f );
+
+  // slots
+
+  /**
+   * Called when the fade out animation finishes.
+   * It changes the check button paint state and removes actors from the root.
+   */
+  void FadeOutAnimationFinished( Dali::Animation& source );
+
+  /**
+   * Called when the fade in animation finishes.
+   * It changes the check button paint state.
+   */
+  void FadeInAnimationFinished( Dali::Animation& source );
 
 private:
 
@@ -80,6 +232,18 @@ private:
 
   // Undefined
   PushButton& operator=( const PushButton& );
+
+private:
+
+  Animation             mFadeInAnimation;           ///< Animation used in the state transitions.
+  Animation             mFadeOutAnimation;          ///< Animation used in the state transitions.
+
+  Actor                 mFadeOutButtonContent;      ///< Stores a foreground content, which is in a fade out animation, to be removed when the animation finishes.
+  Actor                 mFadeOutBackgroundContent;  ///< Stores a background content, which is in a fade out animation, to be removed when the animation finishes.
+
+  Vector3               mSize;                      ///< The button's size.
+
+  PaintState            mPaintState;                ///< The paint state.
 };
 
 } // namespace Internal