Purge underscored header file barriers
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
index 89bce4b..d7e91d3 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
-#define __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
+#ifndef DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
+#define DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -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>
@@ -62,168 +61,102 @@ protected:
    */
   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();
-
-  /**
-   * @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 Toolkit::Control::GetNaturalSize()
-   */
-  virtual Vector3 GetNaturalSize();
+public:
 
-private:
+  // Properties
 
   /**
-   * Used in the FadeOut functions.
+   * Enum for the alignment modes of the icon.
    */
-  enum ImageLayer
+  enum IconAlignment
   {
-    Background, ///< Fade out the background.
-    Foreground  ///< Fade out the foreground.
+    LEFT,
+    RIGHT,
+    TOP,
+    BOTTOM,
+    DEFAULT = RIGHT
   };
 
   /**
-   * Gets the button image that is fading out.
-   * @return A reference to the button image that is fading out.
+   * 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.
    */
-  Actor& GetFadeOutButtonImage();
+  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 
   /**
-   * Gets the background image that is fading out.
-   * @return A reference to the background image that is fading out.
+   * 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.
    */
-  Actor& GetFadeOutBackgroundImage();
+  static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
 
   /**
-   * Adds the actor to the fade in animation. It creates a fade in animation if needed.
-   * @param[in] actor The actor.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void AddToFadeInAnimation( const Actor& actor );
+  void SetButtonImage( Actor image );
 
   /**
-   * Starts the fade in animation.
-   * PushButton::FadeInAnimationFinished slot is called when the animation finishes.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void StartFadeInAnimation();
+  void SetBackgroundImage( Actor image );
 
   /**
-   * Stops the fade in animation.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void StopFadeInAnimation();
+  void SetSelectedImage( Actor image );
 
   /**
-   * Adds the actor to the fade out animation. It creates a fade out animation if needed.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void AddToFadeOutAnimation( const Actor& actor );
+  void SetSelectedBackgroundImage( Actor image );
 
   /**
-   * Starts the fade out animation.
-   * PushButton::FadeOutAnimationFinished slot is called when the animation finishes.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void StartFadeOutAnimation();
+  void SetDisabledBackgroundImage( Actor image );
 
   /**
-   * 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.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void StopFadeOutAnimation( bool remove = true );
+  void SetDisabledImage( Actor image );
 
   /**
-   * 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.
+   * Deprecated API for Setting Pushbutton image using an Actor
+   * @param[in] image, Image Actor that has a url which can be used to create an image visual
    */
-  void FadeInImage( Actor& image, float opacity = 0.f, int priority = -1 );
+  void SetDisabledSelectedImage( Actor image );
+
+private: // From Button
 
   /**
-   * 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.
+   * @copydoc Toolkit::Internal::Button::OnInitialize
    */
-  void FadeOutImage( ImageLayer layer, Actor& image, float opacity = 1.f );
+  virtual void OnInitialize();
 
-  // slots
+private:
 
   /**
-   * Called when the fade out animation finishes.
-   * It changes the check button paint state and removes actors from the root.
+   * @brief Sets the alignment mode to use to align the icon to the label.
+   *
+   * @param[in] iconAlignment The alignment mode to use
    */
-  void FadeOutAnimationFinished( Dali::Animation& source );
+  void SetIconAlignment( const PushButton::IconAlignment iconAlignment );
 
   /**
-   * Called when the fade in animation finishes.
-   * It changes the check button paint state.
+   * @brief Gets the alignment mode used to align the icon to the label.
+   *
+   * @return The alignment mode in use
    */
-  void FadeInAnimationFinished( Dali::Animation& source );
+  const PushButton::IconAlignment GetIconAlignment() const;
 
 private:
 
@@ -235,15 +168,7 @@ private:
 
 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.
+  IconAlignment  mIconAlignment;                 ///< The alignment of the icon against the label.
 };
 
 } // namespace Internal
@@ -272,4 +197,4 @@ inline const Toolkit::Internal::PushButton& GetImplementation( const Toolkit::Pu
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
+#endif // DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H