1 #ifndef __DALI_TOOLKIT_BUTTON_H__
2 #define __DALI_TOOLKIT_BUTTON_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 * @addtogroup CAPI_DALI_TOOLKIT_BUTTONS_MODULE
26 #include <dali-toolkit/public-api/controls/control.h>
28 namespace Dali DALI_IMPORT_API
31 namespace Internal DALI_INTERNAL
39 namespace Internal DALI_INTERNAL
45 * @brief Button is a base class for different kind of buttons.
47 * This class provides the dimmed property and the clicked signal.
49 * A ClickedSignal() is emitted when the button is touched and the touch
50 * point doesn't leave the boundary of the button.
52 * When the \e dimmed property is set to \e true, no signal is emitted.
54 class Button : public Control
59 static const char* const SIGNAL_CLICKED; ///< name "clicked"
62 static const Property::Index PROPERTY_DIMMED; ///< name "dimmed", @see SetDimmed(), type BOOLEAN
67 * @brief Create an uninitialized Button.
69 * Only derived versions can be instantiated. Calling member
70 * functions with an uninitialized Dali::Object is not allowed.
75 * @brief Copy constructor.
77 Button( const Button& button );
80 * @brief Assignment operator.
82 Button& operator=( const Button& button );
85 * @brief Downcast an Object handle to Button.
87 * If handle points to a Button the downcast produces valid
88 * handle. If not the returned handle is left uninitialized.
90 * @param[in] handle Handle to an object
91 * @return handle to a Button or an uninitialized handle
93 static Button DownCast( BaseHandle handle );
96 * @brief Virtual destructor.
98 * Dali::Object derived classes typically do not contain member data.
103 * @brief Sets the button as \e dimmed.
105 * No signals are emitted when the \e dimmed property is set.
107 * @param[in] dimmed property.
109 void SetDimmed( bool dimmed );
112 * @return \e true if the button is \e dimmed.
114 bool IsDimmed() const;
117 * @brief Sets the animation time.
119 * @param [in] animationTime The animation time in seconds.
121 void SetAnimationTime( float animationTime );
124 * @brief Retrieves button's animation time.
126 * @return The animation time in seconds.
128 float GetAnimationTime() const;
133 * @brief Button Clicked signal type
135 typedef SignalV2< bool ( Button ) > ClickedSignalV2;
138 * @brief Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button.
140 ClickedSignalV2& ClickedSignal();
142 public: // Not intended for application developers
145 * @brief Creates a handle using the Toolkit::Internal implementation.
147 * @param[in] implementation The Control implementation.
149 Button( Internal::Button& implementation );
152 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
154 * @param[in] internal A pointer to the internal CustomActor.
156 Button( Dali::Internal::CustomActor* internal );
159 } // namespace Toolkit
166 #endif // __DALI_TOOLKIT_BUTTON_H__