Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / buttons / button.h
1 #ifndef __DALI_TOOLKIT_BUTTON_H__
2 #define __DALI_TOOLKIT_BUTTON_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 /**
21  * @addtogroup CAPI_DALI_TOOLKIT_BUTTONS_MODULE
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/controls/control.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class CustomActor;
34 }
35
36 namespace Toolkit
37 {
38
39 namespace Internal DALI_INTERNAL
40 {
41 class Button;
42 }
43
44 /**
45  * @brief Button is a base class for different kind of buttons.
46  *
47  * This class provides the dimmed property and the clicked signal.
48  *
49  * A ClickedSignal() is emitted when the button is touched and the touch
50  * point doesn't leave the boundary of the button.
51  *
52  * When the \e dimmed property is set to \e true, no signal is emitted.
53  */
54 class Button : public Control
55 {
56 public:
57
58   // Signal Names
59   static const char* const SIGNAL_CLICKED; ///< name "clicked"
60
61   // Properties
62   static const Property::Index PROPERTY_DIMMED; ///< name "dimmed", @see SetDimmed(), type BOOLEAN
63
64 public:
65
66   /**
67    * @brief Create an uninitialized Button.
68    *
69    * Only derived versions can be instantiated.  Calling member
70    * functions with an uninitialized Dali::Object is not allowed.
71    */
72   Button();
73
74   /**
75    * @brief Copy constructor.
76    */
77   Button( const Button& button );
78
79   /**
80    * @brief Assignment operator.
81    */
82   Button& operator=( const Button& button );
83
84   /**
85    * @brief Downcast an Object handle to Button.
86    *
87    * If handle points to a Button the downcast produces valid
88    * handle. If not the returned handle is left uninitialized.
89    *
90    * @param[in] handle Handle to an object
91    * @return handle to a Button or an uninitialized handle
92    */
93   static Button DownCast( BaseHandle handle );
94
95   /**
96    * @brief Virtual destructor.
97    *
98    * Dali::Object derived classes typically do not contain member data.
99    */
100   virtual ~Button();
101
102   /**
103    * @brief Sets the button as \e dimmed.
104    *
105    * No signals are emitted when the \e dimmed property is set.
106    *
107    * @param[in] dimmed property.
108    */
109   void SetDimmed( bool dimmed );
110
111   /**
112    * @return \e true if the button is \e dimmed.
113    */
114   bool IsDimmed() const;
115
116   /**
117    * @brief Sets the animation time.
118    *
119    * @param [in] animationTime The animation time in seconds.
120    */
121   void SetAnimationTime( float animationTime );
122
123   /**
124    * @brief Retrieves button's animation time.
125    *
126    * @return The animation time in seconds.
127    */
128   float GetAnimationTime() const;
129
130 public: //Signals
131
132   /**
133    * @brief Button Clicked signal type
134    */
135   typedef SignalV2< bool ( Button ) > ClickedSignalV2;
136
137   /**
138    * @brief Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button.
139    */
140   ClickedSignalV2& ClickedSignal();
141
142 public: // Not intended for application developers
143
144   /**
145    * @brief Creates a handle using the Toolkit::Internal implementation.
146    *
147    * @param[in]  implementation  The Control implementation.
148    */
149   Button( Internal::Button& implementation );
150
151   /**
152    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
153    *
154    * @param[in]  internal  A pointer to the internal CustomActor.
155    */
156   Button( Dali::Internal::CustomActor* internal );
157 };
158
159 } // namespace Toolkit
160
161 } // namespace Dali
162
163 /**
164  * @}
165  */
166 #endif // __DALI_TOOLKIT_BUTTON_H__