89aefc564bf71b629a20f7f5650a7d557d02f59d
[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_CLICKED = "clicked";
33 const char* const Button::SIGNAL_STATE_CHANGED = "state-changed";
34
35 Button::Button()
36 {}
37
38 Button::Button( const Button& button )
39 : Control( button )
40 {
41 }
42
43 Button& Button::operator=( const Button& button )
44 {
45   if( &button != this )
46   {
47     Control::operator=( button );
48   }
49   return *this;
50 }
51
52 Button::~Button()
53 {
54 }
55
56 Button Button::DownCast( BaseHandle handle )
57 {
58   return Control::DownCast<Button, Internal::Button>(handle);
59 }
60
61 void Button::SetDisabled( bool disabled )
62 {
63   Dali::Toolkit::GetImplementation( *this ).SetDisabled( disabled );
64 }
65
66 bool Button::IsDisabled() const
67 {
68   return Dali::Toolkit::GetImplementation( *this ).IsDisabled();
69 }
70
71 void Button::SetAnimationTime( float animationTime )
72 {
73   Dali::Toolkit::GetImplementation( *this ).SetAnimationTime( animationTime );
74 }
75
76 float Button::GetAnimationTime() const
77 {
78   return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime();
79 }
80
81 Button::ClickedSignalType& Button::ClickedSignal()
82 {
83   return Dali::Toolkit::GetImplementation( *this ).ClickedSignal();
84 }
85
86 Button::StateChangedSignalType& Button::StateChangedSignal()
87 {
88   return Dali::Toolkit::GetImplementation( *this ).StateChangedSignal();
89 }
90
91 Button::Button( Internal::Button& implementation )
92 : Control( implementation )
93 {
94 }
95
96 Button::Button( Dali::Internal::CustomActor* internal )
97 : Control( internal )
98 {
99   VerifyCustomActorPointer<Internal::Button>(internal);
100 }
101
102 } // namespace Toolkit
103
104 } // namespace Dali