2 * Copyright (c) 2022 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/internal/controls/control/control-data-impl.h>
26 #include <dali-toolkit/public-api/controls/control-impl.h>
32 Control Control::New()
34 return Toolkit::Internal::Control::New();
37 Control Control::New(ControlBehaviour additionalBehaviour)
39 return Toolkit::Internal::Control::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
46 Control::Control(const Control& uiControl) = default;
48 Control::Control(Control&& rhs) = default;
54 Control& Control::operator=(const Control& handle) = default;
56 Control& Control::operator=(Control&& rhs) = default;
58 Control Control::DownCast(BaseHandle handle)
60 return DownCast<Control, Internal::Control>(handle);
63 void Control::SetKeyInputFocus()
65 Internal::GetImplementation(*this).SetKeyInputFocus();
68 bool Control::HasKeyInputFocus()
70 return Internal::GetImplementation(*this).HasKeyInputFocus();
73 void Control::ClearKeyInputFocus()
75 Internal::GetImplementation(*this).ClearKeyInputFocus();
78 PinchGestureDetector Control::GetPinchGestureDetector() const
80 return Internal::GetImplementation(*this).GetPinchGestureDetector();
83 PanGestureDetector Control::GetPanGestureDetector() const
85 return Internal::GetImplementation(*this).GetPanGestureDetector();
88 TapGestureDetector Control::GetTapGestureDetector() const
90 return Internal::GetImplementation(*this).GetTapGestureDetector();
93 LongPressGestureDetector Control::GetLongPressGestureDetector() const
95 return Internal::GetImplementation(*this).GetLongPressGestureDetector();
98 void Control::SetStyleName(const std::string& styleName)
100 Internal::GetImplementation(*this).SetStyleName(styleName);
103 const std::string& Control::GetStyleName() const
105 return Internal::GetImplementation(*this).GetStyleName();
108 void Control::SetBackgroundColor(const Vector4& color)
110 Internal::GetImplementation(*this).SetBackgroundColor(color);
113 void Control::ClearBackground()
115 Internal::GetImplementation(*this).ClearBackground();
118 bool Control::IsResourceReady() const
120 const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
121 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
123 return controlDataImpl.IsResourceReady();
126 Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus(Dali::Property::Index index)
128 const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
129 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
130 return controlDataImpl.GetVisualResourceStatus(index);
133 Control::KeyEventSignalType& Control::KeyEventSignal()
135 return Internal::GetImplementation(*this).KeyEventSignal();
138 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
140 return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
143 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
145 return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
148 Control::ResourceReadySignalType& Control::ResourceReadySignal()
150 Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
151 Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
153 return controlImpl.mResourceReadySignal;
156 Control::Control(Internal::Control& implementation)
157 : CustomActor(implementation)
161 Control::Control(Dali::Internal::CustomActor* internal)
162 : CustomActor(internal)
164 VerifyCustomActorPointer<Internal::Control>(internal);
167 } // namespace Toolkit