2 * Copyright (c) 2019 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>
33 Control Control::New()
35 return Internal::Control::New();
42 Control::Control( const Control& uiControl )
43 : CustomActor( uiControl )
51 Control& Control::operator=( const Control& handle )
55 CustomActor::operator=( handle );
60 Control Control::DownCast( BaseHandle handle )
62 return DownCast< Control, Internal::Control >(handle);
65 void Control::SetKeyInputFocus()
67 Internal::GetImplementation(*this).SetKeyInputFocus();
70 bool Control::HasKeyInputFocus()
72 return Internal::GetImplementation(*this).HasKeyInputFocus();
75 void Control::ClearKeyInputFocus()
77 Internal::GetImplementation(*this).ClearKeyInputFocus();
80 PinchGestureDetector Control::GetPinchGestureDetector() const
82 return Internal::GetImplementation(*this).GetPinchGestureDetector();
85 PanGestureDetector Control::GetPanGestureDetector() const
87 return Internal::GetImplementation(*this).GetPanGestureDetector();
90 TapGestureDetector Control::GetTapGestureDetector() const
92 return Internal::GetImplementation(*this).GetTapGestureDetector();
95 LongPressGestureDetector Control::GetLongPressGestureDetector() const
97 return Internal::GetImplementation(*this).GetLongPressGestureDetector();
100 void Control::SetStyleName( const std::string& styleName )
102 Internal::GetImplementation(*this).SetStyleName( styleName );
105 const std::string& Control::GetStyleName() const
107 return Internal::GetImplementation(*this).GetStyleName();
110 void Control::SetBackgroundColor( const Vector4& color )
112 Internal::GetImplementation(*this).SetBackgroundColor( color );
115 void Control::ClearBackground()
117 Internal::GetImplementation(*this).ClearBackground();
120 bool Control::IsResourceReady() const
122 const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
123 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
125 return controlDataImpl.IsResourceReady();
128 Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index )
130 const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
131 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
132 return controlDataImpl.GetVisualResourceStatus( index );
135 Control::KeyEventSignalType& Control::KeyEventSignal()
137 return Internal::GetImplementation(*this).KeyEventSignal();
140 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
142 return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
145 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
147 return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
150 Control::ResourceReadySignalType& Control::ResourceReadySignal()
152 Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
153 Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
155 return controlImpl.mResourceReadySignal;
158 Control::Control(Internal::Control& implementation)
159 : CustomActor(implementation)
163 Control::Control(Dali::Internal::CustomActor* internal)
164 : CustomActor(internal)
166 VerifyCustomActorPointer<Internal::Control>(internal);
169 } // namespace Toolkit