Controls no longer have property names.
[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_FRAMEWORK
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  * Button is a base class for different kind of buttons.
46  * This class provides the dimmed property and the clicked signal.
47  *
48  * A ClickedSignal() is emitted when the button is touched and the touch
49  * point doesn't leave the boundary of the button.
50  *
51  * When the \e dimmed property is set to \e true, no signal is emitted.
52  */
53 class Button : public Control
54 {
55 public:
56
57   // Signal Names
58   static const char* const SIGNAL_CLICKED;
59
60 public:
61
62   /**
63    * Create an uninitialized Button. Only derived versions can be instantiated.
64    * Calling member functions with an uninitialized Dali::Object is not allowed.
65    */
66   Button();
67
68   /**
69    * Copy constructor.
70    */
71   Button( const Button& button );
72
73   /**
74    * Assignment operator.
75    */
76   Button& operator=( const Button& button );
77
78   /**
79    * Downcast an Object handle to Button. If handle points to a Button the
80    * downcast produces valid handle. If not the returned handle is left uninitialized.
81    * @param[in] handle Handle to an object
82    * @return handle to a Button or an uninitialized handle
83    */
84   static Button DownCast( BaseHandle handle );
85
86   /**
87    * Virtual destructor.
88    * Dali::Object derived classes typically do not contain member data.
89    */
90   virtual ~Button();
91
92   /**
93    * Sets the button as \e dimmed.
94    *
95    * No signals are emitted when the \e dimmed property is set.
96    *
97    * @param[in] dimmed property.
98    */
99   void SetDimmed( bool dimmed );
100
101   /**
102    * @return \e true if the button is \e dimmed.
103    */
104   bool IsDimmed() const;
105
106   /**
107    * Sets the animation time.
108    * @param [in] animationTime The animation time in seconds.
109    */
110   void SetAnimationTime( float animationTime );
111
112   /**
113    * Retrieves button's animation time.
114    * @return The animation time in seconds.
115    */
116   float GetAnimationTime() const;
117
118 public: //Signals
119
120   // Button Clicked
121
122   typedef SignalV2< bool ( Button ) > ClickedSignalV2;
123
124   /**
125    * Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button.
126    */
127   ClickedSignalV2& ClickedSignal();
128
129 public: // Not intended for application developers
130
131   /**
132    * Creates a handle using the Toolkit::Internal implementation.
133    * @param[in]  implementation  The Control implementation.
134    */
135   Button( Internal::Button& implementation );
136
137   /**
138    * Allows the creation of this Control from an Internal::CustomActor pointer.
139    * @param[in]  internal  A pointer to the internal CustomActor.
140    */
141   Button( Dali::Internal::CustomActor* internal );
142 };
143
144 } // namespace Toolkit
145
146 } // namespace Dali
147
148 /**
149  * @}
150  */
151 #endif // __DALI_TOOLKIT_BUTTON_H__