Moved PushButton::SetButtonImage etc to Button base class.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / push-button.h
index 09c480c..a74610a 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_PUSH_BUTTON_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
@@ -39,27 +39,27 @@ class PushButton;
 /**
  * @brief A PushButton changes its appearance when is pressed and returns to its original when is released.
  *
- * By default a PushButton emits a PushButton::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked
- * and a PushButton::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button.
+ * By default a PushButton emits a Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked
+ * and a Button::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button.
  *
  * PushButton provides the following properties which modify signals emitted:
  * <ul>
  *   <li>\e autorepeating
  *
- *       When \e autorepeating is set to \e true, a PushButton::PressedSignal(), PushButton::ReleasedSignal() and Button::ClickedSignal() signals are emitted at regular
+ *       When \e autorepeating is set to \e true, a Button::PressedSignal(), Button::ReleasedSignal() and Button::ClickedSignal() signals are emitted at regular
  *       intervals while the button is touched.
  *
  *       The intervals could be modified with the PushButton::SetInitialAutoRepeatingDelay and PushButton::SetNextAutoRepeatingDelay methods.
  *
- *       A \e toggle button can't be \e autorepeating. If the \e autorepeating property is set to \e true, then the \e toggled property is set to
+ *       A \e togglable button can't be \e autorepeating. If the \e autorepeating property is set to \e true, then the \e togglable property is set to
  *       false but no signal is emitted.
  *
- *   <li>\e toggle
+ *   <li>\e togglable
  *
- *       When \e toggle is set to \e true, a Button::StateChangedSignal() signal is emitted, with the toggle state, every time the button is touched instead
- *       of emit PushButton::PressedSignal(), Button::ClickedSignal() and PushButton::ReleasedSignal() signals.
+ *       When \e togglable is set to \e true, a Button::StateChangedSignal() signal is emitted, with the selected state, every time the button is touched instead
+ *       of emit Button::PressedSignal(), Button::ClickedSignal() and Button::ReleasedSignal() signals.
  *
- *       An \e autorepeating button can't be \e toggle. If the \e toggled property is set to \e true, then the \e autorepeating property is set to false.
+ *       An \e autorepeating button can't be \e togglable. If the \e togglable property is set to \e true, then the \e autorepeating property is set to false.
  * </ul>
  *
  * The button's appearance could be modified by setting images or actors with PushButton::SetButtonImage, PushButton::SetBackgroundImage,
@@ -79,15 +79,6 @@ class DALI_IMPORT_API PushButton : public Button
 {
 public:
 
-  //Signal Names
-  static const char* const SIGNAL_PRESSED; ///< name "pressed"
-  static const char* const SIGNAL_RELEASED; ///< name "released"
-
-  //Action Names
-  static const char* const ACTION_PUSH_BUTTON_CLICK; ///< name "push-button-click"
-
-public:
-
   /**
    * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
    *
@@ -130,90 +121,15 @@ public:
    */
   static PushButton DownCast( BaseHandle handle );
 
-  /**
-   * @brief Sets the \e autorepeating property.
-   *
-   * If the \e autorepeating property is set to \e true, then the \e toggled property is set to false
-   * but no signal is emitted.
-   *
-   * @param[in] autoRepeating \e autorepeating property.
-   */
-  void SetAutoRepeating( bool autoRepeating );
-
-  /**
-   * @return \e true if the \e autorepeating property is set.
-   */
-  bool IsAutoRepeating() const;
+  using Button::SetButtonImage;
 
   /**
-   * @brief Sets the initial autorepeating delay.
+   * @brief SetButtonImage
    *
-   * By default this value is set to 0.15 seconds.
-   *
-   * @pre initialAutoRepeatingDelay must be greater than zero.
-   * @param[in] initialAutoRepeatingDelay in seconds.
-   */
-  void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay );
-
-  /**
-   * @return the initial autorepeating delay in seconds.
-   */
-  float GetInitialAutoRepeatingDelay() const;
-
-  /**
-   * @brief Sets the next autorepeating delay.
-   *
-   * By default this value is set to 0.05 seconds.
-   *
-   * @pre nextAutoRepeatingDelay must be greater than zero.
-   * @param[in] nextAutoRepeatingDelay in seconds.
-   */
-  void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay );
-
-  /**
-   * @return the next autorepeating delay in seconds.
-   */
-  float GetNextAutoRepeatingDelay() const;
-
-  /**
-   * @brief Sets the \e toggled property.
-   *
-   * If the \e toggled property is set to \e true, then the \e autorepeating property is set to false.
-   *
-   * @param[in] toggle property.
-   */
-  void SetToggleButton( bool toggle );
-
-  /**
-   * @return \e true if the \e toggled property is set.
-   */
-  bool IsToggleButton() const;
-
-  /**
-   * @brief Sets the button as toggled or not toggled.
-   *
-   * \e toggled property must be set to \e true.
-   *
-   * Emits a Button::StateChangedSignal() signal.
-   *
-   * @param[in] toggle state.
-   */
-  void SetToggled( bool toggle );
-
-  /**
-   * @return \e true if the \e toggled property is set and the button is toggled.
-   */
-  bool IsToggled() const;
-
-  /**
-   * @brief Sets the button image.
+   * @param[in] image The Actor to be used as the button image.
    *
-   * @param[in] image The button image.
-   */
-  void SetButtonImage( Image image );
-
-  /**
-   * @copydoc SetButtonImage( Image image )
+   * The natural size of the button would be the size of this Actor
+   * if it's larger than the background and label
    */
   void SetButtonImage( Actor image );
 
@@ -224,15 +140,15 @@ public:
    */
   Actor GetButtonImage() const;
 
-  /**
-   * @brief Sets the background image.
-   *
-   * @param[in] image The background image.
-   */
-  void SetBackgroundImage( Image image );
+  using Button::SetBackgroundImage;
 
   /**
-   * @copydoc SetBackgroundImage( Image image )
+   * @brief SetBackgroundImage
+   *
+   * @param[in] image The Actor to be used as the background image.
+   *
+   * The natural size of the button would be the size of this Actor
+   * if it's larger than the button and label
    */
   void SetBackgroundImage( Actor image );
 
@@ -243,12 +159,7 @@ public:
    */
   Actor GetBackgroundImage() const;
 
-  /**
-   * @brief Sets the selected image.
-   *
-   * @param[in] image The selected image.
-   */
-  void SetSelectedImage( Image image );
+  using Button::SetSelectedImage;
 
   /**
    * @copydoc SetSelectedImage( Image image )
@@ -262,12 +173,21 @@ public:
    */
   Actor GetSelectedImage() const;
 
+  using Button::SetSelectedBackgroundImage;
+
+  /**
+   * @copydoc SetSelectedBackgroundImage( Image image )
+   */
+  void SetSelectedBackgroundImage( Actor image );
+
   /**
-   * @brief Sets the disabled background image.
+   * @brief Gets the selected background image.
    *
-   * @param[in] image The disabled background image.
+   * @return An actor with the selected background image.
    */
-  void SetDisabledBackgroundImage( Image image );
+  Actor GetSelectedBackgroundImage() const;
+
+  using Button::SetDisabledBackgroundImage;
 
   /**
    * @copydoc SetDisabledBackgroundImage( Image image )
@@ -281,12 +201,7 @@ public:
    */
   Actor GetDisabledBackgroundImage() const;
 
-  /**
-   * @brief Sets the disabled button image.
-   *
-   * @param[in] image The disabled button image.
-   */
-  void SetDisabledImage( Image image );
+  using Button::SetDisabledImage;
 
   /**
    * @copydoc SetDisabledImage( Image image )
@@ -300,43 +215,6 @@ public:
    */
   Actor GetDisabledImage() const;
 
-  /**
-   * @brief Sets the button label.
-   *
-   * @param[in] label The button label.
-   */
-  void SetLabel( const std::string& label );
-
-  /**
-   * @copydoc SetLabel( const std::string& label )
-   */
-  void SetLabel( Actor label );
-
-  /**
-   * @brief Gets the label.
-   *
-   * @return An actor with the label.
-   */
-  Actor GetLabel() const;
-
-public: //Signals
-
-  /// @brief PushButton Pressed signal type.
-  typedef Signal< bool ( Button ) > PressedSignalType;
-
-  /// @brief PushButton Released signal type.
-  typedef Signal< bool ( Button ) > ReleasedSignalType;
-
-  /**
-   * @brief Signal emitted when the button is touched.
-   */
-  PressedSignalType& PressedSignal();
-
-  /**
-   * @brief Signal emitted when the button is touched and the touch point leaves the boundary of the button.
-   */
-  ReleasedSignalType& ReleasedSignal();
-
 public: // Not intended for application developers
 
   /**