Merge "Button Refactoring phase 1" into tizen
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / button.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19
20 #include <dali-toolkit/public-api/controls/buttons/button.h>
21
22 // INTERNAL INCLUDES
23
24 #include <dali-toolkit/internal/controls/buttons/button-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 const char* const Button::SIGNAL_PRESSED = "pressed";
33 const char* const Button::SIGNAL_RELEASED = "released";
34 const char* const Button::SIGNAL_CLICKED = "clicked";
35 const char* const Button::SIGNAL_STATE_CHANGED = "state-changed";
36
37 const char* const Button::ACTION_BUTTON_CLICK = "button-click";
38
39 Button::Button()
40 {}
41
42 Button::Button( const Button& button )
43 : Control( button )
44 {
45 }
46
47 Button& Button::operator=( const Button& button )
48 {
49   if( &button != this )
50   {
51     Control::operator=( button );
52   }
53   return *this;
54 }
55
56 Button::~Button()
57 {
58 }
59
60 Button Button::DownCast( BaseHandle handle )
61 {
62   return Control::DownCast<Button, Internal::Button>(handle);
63 }
64
65 void Button::SetDisabled( bool disabled )
66 {
67   Dali::Toolkit::GetImplementation( *this ).SetDisabled( disabled );
68 }
69
70 bool Button::IsDisabled() const
71 {
72   return Dali::Toolkit::GetImplementation( *this ).IsDisabled();
73 }
74
75 void Button::SetAutoRepeating( bool autoRepeating )
76 {
77   Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating );
78 }
79
80 bool Button::IsAutoRepeating() const
81 {
82   return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating();
83 }
84
85 void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
86 {
87   Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay );
88 }
89
90 float Button::GetInitialAutoRepeatingDelay() const
91 {
92   return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay();
93 }
94
95 void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
96 {
97   Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay );
98 }
99
100 float Button::GetNextAutoRepeatingDelay() const
101 {
102   return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay();
103 }
104
105 void Button::SetTogglableButton( bool togglable )
106 {
107   Dali::Toolkit::GetImplementation( *this ).SetTogglableButton( togglable );
108 }
109
110 bool Button::IsTogglableButton() const
111 {
112   return Dali::Toolkit::GetImplementation( *this ).IsTogglableButton();
113 }
114
115 void Button::SetSelected( bool selected )
116 {
117   Dali::Toolkit::GetImplementation( *this ).SetSelected( selected );
118 }
119
120 bool Button::IsSelected() const
121 {
122   return Dali::Toolkit::GetImplementation( *this ).IsSelected();
123 }
124
125 void Button::SetAnimationTime( float animationTime )
126 {
127   Dali::Toolkit::GetImplementation( *this ).SetAnimationTime( animationTime );
128 }
129
130 float Button::GetAnimationTime() const
131 {
132   return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime();
133 }
134
135 void Button::SetLabel( const std::string& label )
136 {
137   Dali::Toolkit::GetImplementation( *this ).SetLabel( label );
138 }
139
140 void Button::SetLabel( Actor label )
141 {
142   Dali::Toolkit::GetImplementation( *this ).SetLabel( label );
143 }
144
145 Actor Button::GetLabel() const
146 {
147   return Dali::Toolkit::GetImplementation( *this ).GetLabel();
148 }
149
150 Button::ButtonSignalType& Button::PressedSignal()
151 {
152   return Dali::Toolkit::GetImplementation( *this ).PressedSignal();
153 }
154
155 Button::ButtonSignalType& Button::ReleasedSignal()
156 {
157   return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal();
158 }
159
160 Button::ButtonSignalType& Button::ClickedSignal()
161 {
162   return Dali::Toolkit::GetImplementation( *this ).ClickedSignal();
163 }
164
165 Button::ButtonSignalType& Button::StateChangedSignal()
166 {
167   return Dali::Toolkit::GetImplementation( *this ).StateChangedSignal();
168 }
169
170 Button::Button( Internal::Button& implementation )
171 : Control( implementation )
172 {
173 }
174
175 Button::Button( Dali::Internal::CustomActor* internal )
176 : Control( internal )
177 {
178   VerifyCustomActorPointer<Internal::Button>(internal);
179 }
180
181 } // namespace Toolkit
182
183 } // namespace Dali