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