2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
24 #include <dali-toolkit/internal/controls/buttons/push-button-impl.h>
25 #include <dali/public-api/actors/image-actor.h>
33 PushButton::PushButton()
38 PushButton::PushButton( Internal::PushButton& implementation )
39 : Button( implementation )
43 PushButton::PushButton( const PushButton& pushButton )
44 : Button( pushButton )
48 PushButton& PushButton::operator=( const PushButton& pushButton )
50 if( &pushButton != this )
52 Button::operator=( pushButton );
57 PushButton::PushButton( Dali::Internal::CustomActor* internal )
60 VerifyCustomActorPointer<Internal::PushButton>(internal);
63 PushButton::~PushButton()
67 PushButton PushButton::New()
69 return Internal::PushButton::New();
72 PushButton PushButton::DownCast( BaseHandle handle )
74 return Control::DownCast<PushButton, Internal::PushButton>(handle);
77 void PushButton::SetButtonImage( Image image )
79 Actor imageActor = ImageActor::New( image );
80 imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
81 Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor );
84 void PushButton::SetButtonImage( Actor image )
86 Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
89 Actor PushButton::GetButtonImage() const
91 return Dali::Toolkit::GetImplementation( *this ).GetButtonImage();
94 void PushButton::SetBackgroundImage( Image image )
96 Actor imageActor = ImageActor::New( image );
97 imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
98 Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( imageActor );
101 void PushButton::SetBackgroundImage( Actor image )
103 Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
106 Actor PushButton::GetBackgroundImage() const
108 return Dali::Toolkit::GetImplementation( *this ).GetBackgroundImage();
111 void PushButton::SetSelectedImage( Image image )
113 Actor imageActor = ImageActor::New( image );
114 imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
115 Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor );
118 void PushButton::SetSelectedImage( Actor image )
120 Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image );
123 Actor PushButton::GetSelectedImage() const
125 return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage();
128 void PushButton::SetSelectedBackgroundImage( Image image )
130 Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( ImageActor::New( image ) );
133 void PushButton::SetSelectedBackgroundImage( Actor image )
135 Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image );
138 Actor PushButton::GetSelectedBackgroundImage() const
140 return Dali::Toolkit::GetImplementation( *this ).GetSelectedBackgroundImage();
143 void PushButton::SetDisabledBackgroundImage( Image image )
145 Actor imageActor = ImageActor::New( image );
146 imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
147 Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( imageActor );
150 void PushButton::SetDisabledBackgroundImage( Actor image )
152 Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( image );
155 Actor PushButton::GetDisabledBackgroundImage() const
157 return Dali::Toolkit::GetImplementation( *this ).GetDisabledBackgroundImage();
160 void PushButton::SetDisabledImage( Image image )
162 Actor imageActor = ImageActor::New( image );
163 imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
164 Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( imageActor );
167 void PushButton::SetDisabledImage( Actor image )
169 Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( image );
172 Actor PushButton::GetDisabledImage() const
174 return Dali::Toolkit::GetImplementation( *this ).GetDisabledImage();
177 } // namespace Toolkit