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_FRAMEWORK
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 * Button is a base class for different kind of buttons.
46 * This class provides the dimmed property and the clicked signal.
48 * A ClickedSignal() is emitted when the button is touched and the touch
49 * point doesn't leave the boundary of the button.
51 * When the \e dimmed property is set to \e true, no signal is emitted.
53 class Button : public Control
57 static const char* const SIGNAL_CLICKED;
60 * The names of custom properties installed by this control.
63 static const char* const PROPERTY_DIMMED; ///< name "dimmed", type bool.
68 * Create an uninitialized Button. Only derived versions can be instantiated.
69 * Calling member functions with an uninitialized Dali::Object is not allowed.
76 Button( const Button& button );
79 * Assignment operator.
81 Button& operator=( const Button& button );
84 * Downcast an Object handle to Button. If handle points to a Button the
85 * downcast produces valid handle. If not the returned handle is left uninitialized.
86 * @param[in] handle Handle to an object
87 * @return handle to a Button or an uninitialized handle
89 static Button DownCast( BaseHandle handle );
93 * Dali::Object derived classes typically do not contain member data.
98 * Sets the button as \e dimmed.
100 * No signals are emitted when the \e dimmed property is set.
102 * @param[in] dimmed property.
104 void SetDimmed( bool dimmed );
107 * @return \e true if the button is \e dimmed.
109 bool IsDimmed() const;
112 * Sets the animation time.
113 * @param [in] animationTime The animation time in seconds.
115 void SetAnimationTime( float animationTime );
118 * Retrieves button's animation time.
119 * @return The animation time in seconds.
121 float GetAnimationTime() const;
127 typedef SignalV2< bool ( Button ) > ClickedSignalV2;
130 * Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button.
132 ClickedSignalV2& ClickedSignal();
134 public: // Not intended for application developers
137 * Creates a handle using the Toolkit::Internal implementation.
138 * @param[in] implementation The Control implementation.
140 Button( Internal::Button& implementation );
143 * Allows the creation of this Control from an Internal::CustomActor pointer.
144 * @param[in] internal A pointer to the internal CustomActor.
146 Button( Dali::Internal::CustomActor* internal );
149 } // namespace Toolkit
156 #endif // __DALI_TOOLKIT_BUTTON_H__