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