X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=245bdd5e889691645147bf2a05bde6fdb6cfc35a;hb=cef6d2324d9ecca71abf3c9e63db8e371a636b8a;hp=bf3d9cc1825d7d5ee2d5fe155e8d2fa1189ca08e;hpb=818994dc0acac601b0b27c0b715259b504ef4ceb;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/control.cpp b/dali-toolkit/public-api/controls/control.cpp index bf3d9cc..245bdd5 100644 --- a/dali-toolkit/public-api/controls/control.cpp +++ b/dali-toolkit/public-api/controls/control.cpp @@ -1,184 +1,159 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +// CLASS HEADER #include + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include #include namespace Dali { - namespace Toolkit { - -const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated"; -const char* const Control::SIGNAL_KEY_EVENT = "key-event"; - Control Control::New() { - return ControlImpl::New(); + return Toolkit::Internal::Control::New(); } -Control::Control() +Control Control::New(ControlBehaviour additionalBehaviour) { + return Toolkit::Internal::Control::New(static_cast(additionalBehaviour)); } -Control::Control(const Control& uiControl) -: CustomActor( uiControl ? static_cast( uiControl.GetImplementation() ).GetOwner() : NULL) +Control::Control() { } -Control::~Control() -{ -} +Control::Control(const Control& uiControl) = default; -Control& Control::operator=( const Control& handle ) -{ - if( &handle != this ) - { - CustomActor::operator=( handle ); - } - return *this; -} +Control::Control(Control&& rhs) = default; -Control Control::DownCast( BaseHandle handle ) +Control::~Control() { - return DownCast(handle); } -ControlImpl& Control::GetImplementation() -{ - return static_cast(CustomActor::GetImplementation()); -} +Control& Control::operator=(const Control& handle) = default; -const ControlImpl& Control::GetImplementation() const -{ - return static_cast(CustomActor::GetImplementation()); -} +Control& Control::operator=(Control&& rhs) = default; -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) +Control Control::DownCast(BaseHandle handle) { - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); + return DownCast(handle); } -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const +void Control::SetKeyInputFocus() { - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -void Control::SetMinimumSize( const Vector3& size ) +bool Control::HasKeyInputFocus() { - GetImplementation().SetMinimumSize( size ); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -const Vector3& Control::GetMinimumSize() const +void Control::ClearKeyInputFocus() { - return GetImplementation().GetMinimumSize(); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -void Control::SetMaximumSize( const Vector3& size ) +PinchGestureDetector Control::GetPinchGestureDetector() const { - GetImplementation().SetMaximumSize( size ); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -const Vector3& Control::GetMaximumSize() const +PanGestureDetector Control::GetPanGestureDetector() const { - return GetImplementation().GetMaximumSize(); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -Vector3 Control::GetNaturalSize() +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -float Control::GetHeightForWidth( float width ) +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - return GetImplementation().GetHeightForWidth( width ); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -float Control::GetWidthForHeight( float height ) +void Control::SetStyleName(const std::string& styleName) { - return GetImplementation().GetWidthForHeight( height ); + Internal::GetImplementation(*this).SetStyleName(styleName); } -void Control::SetKeyInputFocus() +const std::string& Control::GetStyleName() const { - GetImplementation().SetKeyInputFocus(); + return Internal::GetImplementation(*this).GetStyleName(); } -bool Control::HasKeyInputFocus() +void Control::SetBackgroundColor(const Vector4& color) { - return GetImplementation().HasKeyInputFocus(); + Internal::GetImplementation(*this).SetBackgroundColor(color); } -void Control::ClearKeyInputFocus() +void Control::ClearBackground() { - GetImplementation().ClearKeyInputFocus(); + Internal::GetImplementation(*this).ClearBackground(); } -PinchGestureDetector Control::GetPinchGestureDetector() const +bool Control::IsResourceReady() const { - return GetImplementation().GetPinchGestureDetector(); -} + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl); -PanGestureDetector Control::GetPanGestureDetector() const -{ - return GetImplementation().GetPanGestureDetector(); + return controlDataImpl.IsResourceReady(); } -TapGestureDetector Control::GetTapGestureDetector() const +Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus(Dali::Property::Index index) { - return GetImplementation().GetTapGestureDetector(); + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl); + return controlDataImpl.GetVisualResourceStatus(index); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +Control::KeyEventSignalType& Control::KeyEventSignal() { - return GetImplementation().GetLongPressGestureDetector(); + return Internal::GetImplementation(*this).KeyEventSignal(); } -Control::KeyEventSignalV2& Control::KeyEventSignal() +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - return GetImplementation().KeyEventSignal(); + return Internal::GetImplementation(*this).KeyInputFocusGainedSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalConnected - */ -void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - GetImplementation().SignalConnected(slotObserver, callback ); + return Internal::GetImplementation(*this).KeyInputFocusLostSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalDisconnected - */ -void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::ResourceReadySignalType& Control::ResourceReadySignal() { - GetImplementation().SignalDisconnected(slotObserver, callback ); -} + Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this); + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl); -/** - * @copydoc ConnectionTrackerInterface::GetConnectionCount - */ -std::size_t Control::GetConnectionCount() const -{ - return GetImplementation().GetConnectionCount( ); + return controlImpl.mResourceReadySignal; } - -Control::Control(ControlImpl& implementation) +Control::Control(Internal::Control& implementation) : CustomActor(implementation) { } @@ -186,7 +161,7 @@ Control::Control(ControlImpl& implementation) Control::Control(Dali::Internal::CustomActor* internal) : CustomActor(internal) { - VerifyCustomActorPointer(internal); + VerifyCustomActorPointer(internal); } } // namespace Toolkit