1 #ifndef __DALI_TOOLKIT_BUTTON_H__
2 #define __DALI_TOOLKIT_BUTTON_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/public-api/controls/control.h>
24 namespace Dali DALI_IMPORT_API
27 namespace Internal DALI_INTERNAL
35 namespace Internal DALI_INTERNAL
41 * @brief Button is a base class for different kind of buttons.
43 * This class provides the dimmed property and the clicked signal.
45 * A ClickedSignal() is emitted when the button is touched and the touch
46 * point doesn't leave the boundary of the button.
48 * When the \e dimmed property is set to \e true, no signal is emitted.
50 class Button : public Control
55 static const char* const SIGNAL_CLICKED; ///< name "clicked"
56 static const char* const SIGNAL_TOGGLED; ///< name "toggled"
59 static const Property::Index PROPERTY_DIMMED; ///< name "dimmed", @see SetDimmed(), type BOOLEAN
64 * @brief Create an uninitialized Button.
66 * Only derived versions can be instantiated. Calling member
67 * functions with an uninitialized Dali::Object is not allowed.
72 * @brief Copy constructor.
74 Button( const Button& button );
77 * @brief Assignment operator.
79 Button& operator=( const Button& button );
82 * @brief Downcast an Object handle to Button.
84 * If handle points to a Button the downcast produces valid
85 * handle. If not the returned handle is left uninitialized.
87 * @param[in] handle Handle to an object
88 * @return handle to a Button or an uninitialized handle
90 static Button DownCast( BaseHandle handle );
95 * This is non-virtual since derived Handle types must not contain data or virtual methods.
100 * @brief Sets the button as \e dimmed.
102 * No signals are emitted when the \e dimmed property is set.
104 * @param[in] dimmed property.
106 void SetDimmed( bool dimmed );
109 * @return \e true if the button is \e dimmed.
111 bool IsDimmed() const;
114 * @brief Sets the animation time.
116 * @param [in] animationTime The animation time in seconds.
118 void SetAnimationTime( float animationTime );
121 * @brief Retrieves button's animation time.
123 * @return The animation time in seconds.
125 float GetAnimationTime() const;
130 * @brief Button Clicked signal type
132 typedef SignalV2< bool ( Button ) > ClickedSignalV2;
135 * @brief Button toggled signal type
137 typedef SignalV2< bool ( Button, bool ) > ToggledSignalV2;
140 * @brief Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button.
142 ClickedSignalV2& ClickedSignal();
145 * @brief Signal emitted when the button's state is toggled.
147 ToggledSignalV2& ToggledSignal();
149 public: // Not intended for application developers
152 * @brief Creates a handle using the Toolkit::Internal implementation.
154 * @param[in] implementation The Control implementation.
156 Button( Internal::Button& implementation );
159 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
161 * @param[in] internal A pointer to the internal CustomActor.
163 Button( Dali::Internal::CustomActor* internal );
166 } // namespace Toolkit
170 #endif // __DALI_TOOLKIT_BUTTON_H__