2 * Copyright (c) 2017 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.
19 #include <dali-toolkit/public-api/controls/control.h>
22 #include <dali/integration-api/debug.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
34 Control Control::New()
36 return Internal::Control::New();
43 Control::Control( const Control& uiControl )
44 : CustomActor( uiControl )
52 Control& Control::operator=( const Control& handle )
56 CustomActor::operator=( handle );
61 Control Control::DownCast( BaseHandle handle )
63 return DownCast< Control, Internal::Control >(handle);
66 void Control::SetKeyInputFocus()
68 Internal::GetImplementation(*this).SetKeyInputFocus();
71 bool Control::HasKeyInputFocus()
73 return Internal::GetImplementation(*this).HasKeyInputFocus();
76 void Control::ClearKeyInputFocus()
78 Internal::GetImplementation(*this).ClearKeyInputFocus();
81 PinchGestureDetector Control::GetPinchGestureDetector() const
83 return Internal::GetImplementation(*this).GetPinchGestureDetector();
86 PanGestureDetector Control::GetPanGestureDetector() const
88 return Internal::GetImplementation(*this).GetPanGestureDetector();
91 TapGestureDetector Control::GetTapGestureDetector() const
93 return Internal::GetImplementation(*this).GetTapGestureDetector();
96 LongPressGestureDetector Control::GetLongPressGestureDetector() const
98 return Internal::GetImplementation(*this).GetLongPressGestureDetector();
101 void Control::SetStyleName( const std::string& styleName )
103 Internal::GetImplementation(*this).SetStyleName( styleName );
106 const std::string& Control::GetStyleName() const
108 return Internal::GetImplementation(*this).GetStyleName();
111 void Control::SetBackgroundColor( const Vector4& color )
113 Internal::GetImplementation(*this).SetBackgroundColor( color );
116 Vector4 Control::GetBackgroundColor() const
118 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
120 return Internal::GetImplementation(*this).GetBackgroundColor();
123 void Control::SetBackgroundImage( Image image )
125 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
127 Internal::GetImplementation(*this).SetBackgroundImage( image );
130 void Control::ClearBackground()
132 Internal::GetImplementation(*this).ClearBackground();
135 bool Control::IsResourceReady() const
137 const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
138 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
140 return controlDataImpl.IsResourceReady();
143 Control::KeyEventSignalType& Control::KeyEventSignal()
145 return Internal::GetImplementation(*this).KeyEventSignal();
148 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
150 return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
153 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
155 return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
158 Control::ResourceReadySignalType& Control::ResourceReadySignal()
160 Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
161 Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
163 return controlImpl.mResourceReadySignal;
166 Control::Control(Internal::Control& implementation)
167 : CustomActor(implementation)
171 Control::Control(Dali::Internal::CustomActor* internal)
172 : CustomActor(internal)
174 VerifyCustomActorPointer<Internal::Control>(internal);
177 } // namespace Toolkit