X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=2e918f0087527f72696e372a214f5c1f71c2e676;hb=HEAD;hp=77cb876b88cee6f4382436cc322c1f059048f380;hpb=306d2f61a1b64179e801fa8a0bb2bd7b4e9dd682;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 77cb876..2e918f0 100644 --- a/dali-toolkit/public-api/controls/control.cpp +++ b/dali-toolkit/public-api/controls/control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -15,173 +15,139 @@ * */ +// 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"; -const char* const Control::SIGNAL_TAPPED = "tapped"; -const char* const Control::SIGNAL_PANNED = "panned"; -const char* const Control::SIGNAL_PINCHED = "pinched"; -const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed"; - Control Control::New() { - return Internal::Control::New(); -} - -Control::Control() -{ -} - -Control::Control(const Control& uiControl) -: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL) -{ + return Toolkit::Internal::Control::New(); } -Control::~Control() +Control Control::New(ControlBehaviour additionalBehaviour) { + return Toolkit::Internal::Control::New(static_cast(additionalBehaviour)); } -Control& Control::operator=( const Control& handle ) +Control::Control() { - if( &handle != this ) - { - CustomActor::operator=( handle ); - } - return *this; } -Control Control::DownCast( BaseHandle handle ) -{ - return DownCast< Control, Internal::Control >(handle); -} +Control::Control(const Control& uiControl) = default; -Internal::Control& Control::GetImplementation() -{ - return static_cast(CustomActor::GetImplementation()); -} +Control::Control(Control&& rhs) noexcept = default; -const Internal::Control& Control::GetImplementation() const +Control::~Control() { - return static_cast(CustomActor::GetImplementation()); } -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) -{ - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); -} +Control& Control::operator=(const Control& handle) = default; -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const -{ - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); -} +Control& Control::operator=(Control&& rhs) noexcept = default; -void Control::SetMinimumSize( const Vector3& size ) +Control Control::DownCast(BaseHandle handle) { - GetImplementation().SetMinimumSize( size ); + return DownCast(handle); } -const Vector3& Control::GetMinimumSize() const +void Control::SetKeyInputFocus() { - return GetImplementation().GetMinimumSize(); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -void Control::SetMaximumSize( const Vector3& size ) +bool Control::HasKeyInputFocus() { - GetImplementation().SetMaximumSize( size ); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -const Vector3& Control::GetMaximumSize() const +void Control::ClearKeyInputFocus() { - return GetImplementation().GetMaximumSize(); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -Vector3 Control::GetNaturalSize() +PinchGestureDetector Control::GetPinchGestureDetector() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -float Control::GetHeightForWidth( float width ) +PanGestureDetector Control::GetPanGestureDetector() const { - return GetImplementation().GetHeightForWidth( width ); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -float Control::GetWidthForHeight( float height ) +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetWidthForHeight( height ); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -void Control::SetKeyInputFocus() +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - GetImplementation().SetKeyInputFocus(); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -bool Control::HasKeyInputFocus() +void Control::SetStyleName(const std::string& styleName) { - return GetImplementation().HasKeyInputFocus(); + Internal::GetImplementation(*this).SetStyleName(styleName); } -void Control::ClearKeyInputFocus() +const std::string& Control::GetStyleName() const { - GetImplementation().ClearKeyInputFocus(); + return Internal::GetImplementation(*this).GetStyleName(); } -PinchGestureDetector Control::GetPinchGestureDetector() const +void Control::SetBackgroundColor(const Vector4& color) { - return GetImplementation().GetPinchGestureDetector(); + Internal::GetImplementation(*this).SetBackgroundColor(color); } -PanGestureDetector Control::GetPanGestureDetector() const -{ - return GetImplementation().GetPanGestureDetector(); -} - -TapGestureDetector Control::GetTapGestureDetector() const +void Control::ClearBackground() { - return GetImplementation().GetTapGestureDetector(); + Internal::GetImplementation(*this).ClearBackground(); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +bool Control::IsResourceReady() const { - return GetImplementation().GetLongPressGestureDetector(); + return Internal::GetImplementation(*this).IsResourceReady(); } -void Control::SetBackgroundColor( const Vector4& color ) +Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus(Dali::Property::Index index) { - GetImplementation().SetBackgroundColor( color ); + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl); + return controlDataImpl.GetVisualResourceStatus(index); } -Vector4 Control::GetBackgroundColor() const +Control::KeyEventSignalType& Control::KeyEventSignal() { - return GetImplementation().GetBackgroundColor(); + return Internal::GetImplementation(*this).KeyEventSignal(); } -void Control::SetBackground( Image image ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - GetImplementation().SetBackground( image ); + return Internal::GetImplementation(*this).KeyInputFocusGainedSignal(); } -void Control::ClearBackground() +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - GetImplementation().ClearBackground(); + return Internal::GetImplementation(*this).KeyInputFocusLostSignal(); } -Actor Control::GetBackgroundActor() const +Control::ResourceReadySignalType& Control::ResourceReadySignal() { - return GetImplementation().GetBackgroundActor(); -} + Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this); + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl); -Control::KeyEventSignalType& Control::KeyEventSignal() -{ - return GetImplementation().KeyEventSignal(); + return controlImpl.mResourceReadySignal; } Control::Control(Internal::Control& implementation)