X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=14205f908b10eab1ac6c3ea80e19bcac32880ced;hb=f20180dbb4cd52afb0305f2aa7889e81f55ef19e;hp=6f75dfccaf7db866f313247158714bce29ebd9dc;hpb=ee3bdc95f623f41feb37be10f21bef1d9da1e805;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 6f75dfc..14205f9 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) 2017 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,8 +15,15 @@ * */ +// CLASS HEADER #include + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES #include +#include namespace Dali { @@ -33,8 +40,8 @@ Control::Control() { } -Control::Control(const Control& uiControl) -: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL) +Control::Control( const Control& uiControl ) +: CustomActor( uiControl ) { } @@ -56,124 +63,111 @@ Control Control::DownCast( BaseHandle handle ) return DownCast< Control, Internal::Control >(handle); } -Internal::Control& Control::GetImplementation() +void Control::SetKeyInputFocus() { - return static_cast(CustomActor::GetImplementation()); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -const Internal::Control& Control::GetImplementation() const +bool Control::HasKeyInputFocus() { - return static_cast(CustomActor::GetImplementation()); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) +void Control::ClearKeyInputFocus() { - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const +PinchGestureDetector Control::GetPinchGestureDetector() const { - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -void Control::SetMinimumSize( const Vector3& size ) +PanGestureDetector Control::GetPanGestureDetector() const { - GetImplementation().SetMinimumSize( size ); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -const Vector3& Control::GetMinimumSize() const +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetMinimumSize(); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -void Control::SetMaximumSize( const Vector3& size ) +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - GetImplementation().SetMaximumSize( size ); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -const Vector3& Control::GetMaximumSize() const +void Control::SetStyleName( const std::string& styleName ) { - return GetImplementation().GetMaximumSize(); + Internal::GetImplementation(*this).SetStyleName( styleName ); } -Vector3 Control::GetNaturalSize() +const std::string& Control::GetStyleName() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetStyleName(); } -float Control::GetHeightForWidth( float width ) +void Control::SetBackgroundColor( const Vector4& color ) { - return GetImplementation().GetHeightForWidth( width ); + Internal::GetImplementation(*this).SetBackgroundColor( color ); } -float Control::GetWidthForHeight( float height ) +Vector4 Control::GetBackgroundColor() const { - return GetImplementation().GetWidthForHeight( height ); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -void Control::SetKeyInputFocus() -{ - GetImplementation().SetKeyInputFocus(); + return Internal::GetImplementation(*this).GetBackgroundColor(); } -bool Control::HasKeyInputFocus() +void Control::SetBackgroundImage( Image image ) { - return GetImplementation().HasKeyInputFocus(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -void Control::ClearKeyInputFocus() -{ - GetImplementation().ClearKeyInputFocus(); + Internal::GetImplementation(*this).SetBackgroundImage( image ); } -PinchGestureDetector Control::GetPinchGestureDetector() const +void Control::ClearBackground() { - return GetImplementation().GetPinchGestureDetector(); + Internal::GetImplementation(*this).ClearBackground(); } -PanGestureDetector Control::GetPanGestureDetector() const +bool Control::IsResourceReady() const { - return GetImplementation().GetPanGestureDetector(); -} + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); -TapGestureDetector Control::GetTapGestureDetector() const -{ - return GetImplementation().GetTapGestureDetector(); + return controlDataImpl.IsResourceReady(); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index ) { - return GetImplementation().GetLongPressGestureDetector(); + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); + return controlDataImpl.GetVisualResourceStatus( index ); } -void Control::SetBackgroundColor( const Vector4& color ) -{ - GetImplementation().SetBackgroundColor( color ); -} - -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)