Ensure Button Set and Get works with Image/Actor API
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / push-button.cpp
1 /*
2  * Copyright (c) 2015 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 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 #include <dali/public-api/images/resource-image.h>
25
26 // INTERNAL INCLUDES
27 #include <dali-toolkit/internal/controls/buttons/push-button-impl.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 PushButton::PushButton()
36 : Button()
37 {
38 }
39
40 PushButton::PushButton( Internal::PushButton& implementation )
41 : Button( implementation )
42 {
43 }
44
45 PushButton::PushButton( const PushButton& pushButton )
46 : Button( pushButton )
47 {
48 }
49
50 PushButton& PushButton::operator=( const PushButton& pushButton )
51 {
52   if( &pushButton != this )
53   {
54     Button::operator=( pushButton );
55   }
56   return *this;
57 }
58
59 PushButton::PushButton( Dali::Internal::CustomActor* internal )
60 : Button( internal )
61 {
62   VerifyCustomActorPointer<Internal::PushButton>(internal);
63 }
64
65 PushButton::~PushButton()
66 {
67 }
68
69 PushButton PushButton::New()
70 {
71   return Internal::PushButton::New();
72 }
73
74 PushButton PushButton::DownCast( BaseHandle handle )
75 {
76   return Control::DownCast<PushButton, Internal::PushButton>(handle);
77 }
78
79 // Deprecated API
80
81 void PushButton::SetButtonImage( Actor image )
82 {
83   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetButtonImage() is deprecated and will be removed from next release. Use Button.SetProperty UNSELECTED_STATE_IMAGE or Styling file instead.\n" );
84
85   Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
86 }
87
88 void PushButton::SetBackgroundImage( Actor image )
89 {
90   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release.\n" );
91
92   Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
93 }
94
95 void PushButton::SetSelectedImage( Actor image )
96 {
97   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use Button.SetProperty SELECTED_STATE_IMAGE or Styling file instead.\n" );
98
99   Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image );
100 }
101
102 void PushButton::SetSelectedBackgroundImage( Actor image )
103 {
104   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedBackgroundImage() is deprecated and will be removed from next release.\n" );
105
106   Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image );
107 }
108
109 void PushButton::SetDisabledBackgroundImage( Actor image )
110 {
111   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledBackgroundImage() is deprecated and will be removed from next release.\n" );
112
113   Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( image );
114 }
115
116 void PushButton::SetDisabledImage( Actor image )
117 {
118   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledImage() is deprecated and will be removed from next release. Use Button.SetProperty DISABLED_STATE_IMAGE or Styling file instead.\n" );
119
120   Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( image );
121 }
122
123 void PushButton::SetDisabledSelectedImage( Actor image )
124 {
125   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledSelectedImage() is deprecated and will be removed from next release.\n" );
126
127   Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( image );
128 }
129
130 } // namespace Toolkit
131
132 } // namespace Dali