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