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