X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fbuttons%2Fpush-button.h;h=e237cc8551bba9701b09d155939bb4490f6ccc29;hp=c887574a298a247fc9a5c67dcee78fa9449eb801;hb=dea624eb348a4926d8761c8a1364f03f9f71acf5;hpb=933609809da8a14c306789bc01b461a5116180ed diff --git a/dali-toolkit/public-api/controls/buttons/push-button.h b/dali-toolkit/public-api/controls/buttons/push-button.h index c887574..e237cc8 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.h +++ b/dali-toolkit/public-api/controls/buttons/push-button.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_PUSH_BUTTON_H__ -#define __DALI_TOOLKIT_PUSH_BUTTON_H__ +#ifndef DALI_TOOLKIT_PUSH_BUTTON_H +#define DALI_TOOLKIT_PUSH_BUTTON_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -43,179 +43,168 @@ 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 Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked + * 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. * - * See Button for more detail on signals and modifying appearance via properties. + * Usage example: - + * + * @code + * // in Creating a DALi Application + * void HelloWorldExample::Create( Application& application ) + * { + * PushButton button = PushButton::New(); + * button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + * button.SetProperty( Button::Property::LABEL, "Press" ); + * Stage::GetCurrent().Add( button ); + * + * // 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 ); + * } + * + * bool HelloWorldExample::OnButtonClicked( Button button ) + * { + * // Do something when the button is clicked + * return true; + * } + * + * bool HelloWorldExample::OnButtonPressed( Button button ) + * { + * // Do something when the button is pressed + * return true; + * } + * + * bool HelloWorldExample::OnButtonReleased( Button button ) + * { + * // Do something when the button is released + * return true; + * } + * @endcode + * + * See Button for more details on signals and modifying appearance via properties. + * @SINCE_1_0.0 */ -class DALI_IMPORT_API PushButton : public Button +class DALI_TOOLKIT_API PushButton : public Button { public: /** - * @brief The start and end property ranges for this control. + * @brief Enumeration for the start and end property ranges for this control. + * @SINCE_1_0.0 */ enum PropertyRange { - PROPERTY_START_INDEX = Button::PROPERTY_END_INDEX + 1, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices + 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. + * @brief Enumeration for the instance of properties belonging to the PushButton class. + * @SINCE_1_0.0 */ struct Property { + /** + * @brief Enumeration for the instance of properties belonging to the PushButton class. + * @SINCE_1_0.0 + */ enum { - UNSELECTED_ICON = PROPERTY_START_INDEX, ///< Property, name "unselected-icon", type std::string - SELECTED_ICON, ///< Property, name "selected-icon", type std::string - ICON_ALIGNMENT, ///< Property, name "icon-alignment", type std::string - LABEL_PADDING, ///< Property, name "label-padding", type Vector4 - ICON_PADDING, ///< Property, name "icon-padding", type Vector4 + LABEL_PADDING = PROPERTY_START_INDEX, ///< 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(). + * @brief Creates 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 + * @param[in] pushButton Handle to an object */ PushButton( const PushButton& pushButton ); /** - * @brief Assignment operator. - */ - PushButton& operator=( const PushButton& pushButton ); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~PushButton(); - - /** - * @brief Create an initialized PushButton. + * @brief Move constructor + * @SINCE_1_9.23 * - * @return A handle to a newly allocated Dali resource. + * @param[in] rhs A reference to the moved handle */ - static PushButton New(); + PushButton( PushButton&& rhs ); /** - * @brief Downcast an Object handle to PushButton. - * - * If handle points to a PushButton the downcast produces valid - * handle. If not the returned handle is left uninitialized. - * - * @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; - - /** - * @deprecated DALi 1.0.50 - * - * @brief Sets the unselected image with an Actor. - * - * @param[in] image The Actor to use. - */ - void SetButtonImage( Actor image ); - - using Button::SetBackgroundImage; - - /** - * @deprecated DALi 1.0.50 - * - * @brief Sets the background image with an Actor. - * - * @param[in] image The Actor to use. - */ - void SetBackgroundImage( Actor image ); - - using Button::SetSelectedImage; - - /** - * @deprecated DALi 1.0.50 - * - * @brief Sets the selected image with an Actor. - * - * @param[in] image The Actor to use. + * @brief Assignment operator. + * @SINCE_1_0.0 + * @param[in] pushButton Handle to an object + * @return A reference to this */ - void SetSelectedImage( Actor image ); - - using Button::SetSelectedBackgroundImage; + PushButton& operator=( const PushButton& pushButton ); /** - * @deprecated DALi 1.0.50 - * - * @brief Sets the selected background image with an Actor. + * @brief Move assignment + * @SINCE_1_9.23 * - * @param[in] image The Actor to use. + * @param[in] rhs A reference to the moved handle + * @return A reference to this */ - void SetSelectedBackgroundImage( Actor image ); - - using Button::SetDisabledBackgroundImage; + PushButton& operator=( PushButton&& rhs ); /** - * @deprecated DALi 1.0.50 - * - * @brief Sets the disabled background image with an Actor. + * @brief Destructor. * - * @param[in] image The Actor to use. + * This is non-virtual since derived Handle types must not contain data or virtual methods. + * @SINCE_1_0.0 */ - void SetDisabledBackgroundImage( Actor image ); - - using Button::SetDisabledImage; + ~PushButton(); /** - * @deprecated DALi 1.0.50 + * @brief Creates an initialized PushButton. * - * @brief Sets the disabled image with an Actor. - * - * @param[in] image The Actor to use. + * @SINCE_1_0.0 + * @return A handle to a newly allocated Dali resource */ - void SetDisabledImage( Actor image ); - - using Button::SetDisabledSelectedImage; + static PushButton New(); /** - * @deprecated DALi 1.0.50 + * @brief Downcasts a handle to PushButton handle. * - * @brief Sets the disabled selected image with an Actor. + * If handle points to a PushButton, the downcast produces valid handle. + * If not, the returned handle is left uninitialized. * - * @param[in] image The Actor to use. + * @SINCE_1_0.0 + * @param[in] handle Handle to an object + * @return handle to a PushButton or an uninitialized handle */ - void SetDisabledSelectedImage( Actor image ); - + static PushButton DownCast( BaseHandle handle ); public: // Not intended for application developers + /// @cond internal /** * @brief Creates a handle using the Toolkit::Internal implementation. * - * @param[in] implementation The Control 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. * - * @param[in] internal A pointer to the internal CustomActor. + * @SINCE_1_0.0 + * @param[in] internal A pointer to the internal CustomActor */ DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal ); + /// @endcond }; /** @@ -225,4 +214,4 @@ public: // Not intended for application developers } // namespace Dali -#endif // __DALI_TOOLKIT_PUSH_BUTTON_H__ +#endif // DALI_TOOLKIT_PUSH_BUTTON_H