class PushButton;
}
+/**
+ * @addtogroup dali_toolkit_controls_buttons
+ * @{
+ */
/**
* @brief A PushButton changes its appearance when is pressed and returns to its original when is released.
* 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 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 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 togglable
- *
- * 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.
+ * Usage example: -
*
- * 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>
+ * @code
+ * // in Creating a DALi Application
+ * void HelloWorldExample::Create( Application& application )
+ * {
+ * PushButton button = PushButton::New();
+ * button.SetParentOrigin( ParentOrigin::CENTER );
+ * button.SetLabelText( "Press" );
+ * Stage::GetCurrent().Add( button );
*
- * The button's appearance could be modified by setting images or actors with PushButton::SetButtonImage, PushButton::SetBackgroundImage,
- * PushButton::SetSelectedImage, PushButton::SetDisabledBackgroundImage and PushButton::SetDisabledImage or setting a text with
- * PushButton::SetLabel.
+ * // Connect to button signals emitted by the button
+ * button.ClickedSignal().Connect( this, &HelloWorldExample::OnButtonClicked );
+ * button.PressedSignal().Connect( this, &HelloWorldExample::OnButtonPressed );
+ * button.ReleasedSignal().Connect( this, &HelloWorldExample::OnButtonReleased );
+ * }
*
- * The \e background is always shown and doesn't change if the button is pressed or released. The \e button image is shown over the \e background image when the
- * button is not pressed and is replaced by the \e selected image when the button is pressed. The text label is placed always on the top of all images.
+ * bool HelloWorldExample::OnButtonClicked( Button button )
+ * {
+ * // Do something when the button is clicked
+ * return true;
+ * }
*
- * When the button is disabled, \e background, \e button and \e selected images are replaced by their \e disabled images.
+ * bool HelloWorldExample::OnButtonPressed( Button button )
+ * {
+ * // Do something when the button is pressed
+ * return true;
+ * }
*
- * The methods used to modify the button's appearance could receive Dali::Actor objects as a parameter, so more complex images could be defined.
+ * bool HelloWorldExample::OnButtonReleased( Button button )
+ * {
+ * // Do something when the button is released
+ * return true;
+ * }
+ * @endcode
*
- * Is not mandatory set all images. A button could be defined only by setting its \e background image or by setting its \e background and \e selected images.
+ * See Button for more detail on signals and modifying appearance via properties.
+ * @SINCE_1_0.0
*/
class DALI_IMPORT_API PushButton : public Button
{
public:
/**
+ * @brief The start and end property ranges for this control.
+ * @SINCE_1_0.0
+ */
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Button::PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices @SINCE_1_0.0
+ };
+
+ /**
+ * @brief An enumeration of properties belonging to the PushButton class.
+ * @SINCE_1_0.0
+ */
+ struct Property
+ {
+ enum
+ {
+ UNSELECTED_ICON = PROPERTY_START_INDEX, ///< Property, name "unselectedIcon", type std::string @SINCE_1_0.0
+ SELECTED_ICON, ///< Property, name "selectedIcon", type std::string @SINCE_1_0.0
+ ICON_ALIGNMENT, ///< Property, name "iconAlignment", type std::string @SINCE_1_0.0
+ LABEL_PADDING, ///< Property, name "labelPadding", type Vector4 @SINCE_1_0.0
+ ICON_PADDING, ///< Property, name "iconPadding", type Vector4 @SINCE_1_0.0
+ };
+ };
+
+public:
+
+ /**
* @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
*
* Calling member functions with an uninitialized Dali::Object is not allowed.
+ * @SINCE_1_0.0
*/
PushButton();
/**
* @brief Copy constructor.
+ * @SINCE_1_0.0
*/
PushButton( const PushButton& pushButton );
/**
* @brief Assignment operator.
+ * @SINCE_1_0.0
*/
PushButton& operator=( const PushButton& pushButton );
* @brief Destructor
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @SINCE_1_0.0
*/
~PushButton();
/**
* @brief Create an initialized PushButton.
*
+ * @SINCE_1_0.0
* @return A handle to a newly allocated Dali resource.
*/
static PushButton New();
/**
- * @brief Downcast an Object handle to PushButton.
+ * @brief Downcast a handle to PushButton handle.
*
* If handle points to a PushButton the downcast produces valid
* handle. If not the returned handle is left uninitialized.
*
+ * @SINCE_1_0.0
* @param[in] handle Handle to an object
* @return handle to a PushButton or an uninitialized handle
*/
static PushButton DownCast( BaseHandle handle );
+
+ // Deprecated API
+
using Button::SetButtonImage;
/**
- * @brief SetButtonImage
+ * @DEPRECATED_1_0.50. Instead, use Button::SetUnselectedImage.
*
- * @param[in] image The Actor to be used as the button image.
+ * @brief Sets the unselected image with an Actor.
*
- * The natural size of the button would be the size of this Actor
- * if it's larger than the background and label
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
void SetButtonImage( Actor image );
- /**
- * @brief Gets the button image.
- *
- * @return An actor with the button image.
- */
- Actor GetButtonImage() const;
-
using Button::SetBackgroundImage;
/**
- * @brief SetBackgroundImage
+ * @DEPRECATED_1_0.50. Instead, use Button::SetBackgroundImage.
*
- * @param[in] image The Actor to be used as the background image.
+ * @brief Sets the background image with an Actor.
*
- * The natural size of the button would be the size of this Actor
- * if it's larger than the button and label
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
void SetBackgroundImage( Actor image );
- /**
- * @brief Gets the background image.
- *
- * @return An actor with the background image.
- */
- Actor GetBackgroundImage() const;
-
using Button::SetSelectedImage;
/**
- * @copydoc SetSelectedImage( Image image )
- */
- void SetSelectedImage( Actor image );
-
- /**
- * @brief Gets the selected image.
+ * @DEPRECATED_1_0.50. Instead, use Button::SetSelectedImage( const std::string& filename ).
*
- * @return An actor with the selected image.
+ * @brief Sets the selected image with an Actor.
+ *
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
- Actor GetSelectedImage() const;
+ void SetSelectedImage( Actor image );
using Button::SetSelectedBackgroundImage;
/**
- * @copydoc SetSelectedBackgroundImage( Image image )
- */
- void SetSelectedBackgroundImage( Actor image );
-
- /**
- * @brief Gets the selected background image.
+ * @DEPRECATED_1_0.50. Instead, use Button::SetSelectedBackgroundImage.
*
- * @return An actor with the selected background image.
+ * @brief Sets the selected background image with an Actor.
+ *
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
- Actor GetSelectedBackgroundImage() const;
+ void SetSelectedBackgroundImage( Actor image );
using Button::SetDisabledBackgroundImage;
/**
- * @copydoc SetDisabledBackgroundImage( Image image )
- */
- void SetDisabledBackgroundImage( Actor image );
-
- /**
- * @brief Gets the disabled background image.
+ * @DEPRECATED_1_0.50. Instead, use Button::SetDisabledBackgroundImage.
*
- * @return An actor with the disabled background image.
+ * @brief Sets the disabled background image with an Actor.
+ *
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
- Actor GetDisabledBackgroundImage() const;
+ void SetDisabledBackgroundImage( Actor image );
using Button::SetDisabledImage;
/**
- * @copydoc SetDisabledImage( Image image )
+ * @DEPRECATED_1_0.50. Instead, use Button::SetDisabledImage.
+ *
+ * @brief Sets the disabled image with an Actor.
+ *
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
void SetDisabledImage( Actor image );
+ using Button::SetDisabledSelectedImage;
+
/**
- * @brief Gets the disabled image.
+ * @DEPRECATED_1_0.50. Instead, use Button::SetDisabledSelectedImage.
+ *
+ * @brief Sets the disabled selected image with an Actor.
*
- * @return An actor with the disabled image.
+ * @SINCE_1_0.0
+ * @param[in] image The Actor to use.
*/
- Actor GetDisabledImage() const;
+ void SetDisabledSelectedImage( Actor image );
+
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
+ * @SINCE_1_0.0
* @param[in] implementation The Control implementation.
*/
DALI_INTERNAL PushButton( Internal::PushButton& implementation );
/**
* @brief Allows the creation of this Control from an Internal::CustomActor pointer.
*
+ * @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
+/**
+ * @}
+ */
} // namespace Toolkit
} // namespace Dali