X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=5d28b912426b99f3dfbda446ddc733328d403961;hb=9601caa4c6862e87f072a6f0cba8a0a19036e55d;hp=6f75dfccaf7db866f313247158714bce29ebd9dc;hpb=1b1e10a3f4e486553200d8ddeb57d953c2284579;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..5d28b91 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,104 @@ Control Control::DownCast( BaseHandle handle ) return DownCast< Control, Internal::Control >(handle); } -Internal::Control& Control::GetImplementation() -{ - return static_cast(CustomActor::GetImplementation()); -} - -const Internal::Control& Control::GetImplementation() const -{ - return static_cast(CustomActor::GetImplementation()); -} - -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) +void Control::SetKeyInputFocus() { - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const +bool Control::HasKeyInputFocus() { - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -void Control::SetMinimumSize( const Vector3& size ) +void Control::ClearKeyInputFocus() { - GetImplementation().SetMinimumSize( size ); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -const Vector3& Control::GetMinimumSize() const +PinchGestureDetector Control::GetPinchGestureDetector() const { - return GetImplementation().GetMinimumSize(); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -void Control::SetMaximumSize( const Vector3& size ) +PanGestureDetector Control::GetPanGestureDetector() const { - GetImplementation().SetMaximumSize( size ); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -const Vector3& Control::GetMaximumSize() const +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetMaximumSize(); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -Vector3 Control::GetNaturalSize() +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -float Control::GetHeightForWidth( float width ) +void Control::SetStyleName( const std::string& styleName ) { - return GetImplementation().GetHeightForWidth( width ); + Internal::GetImplementation(*this).SetStyleName( styleName ); } -float Control::GetWidthForHeight( float height ) +const std::string& Control::GetStyleName() const { - return GetImplementation().GetWidthForHeight( height ); + return Internal::GetImplementation(*this).GetStyleName(); } -void Control::SetKeyInputFocus() +void Control::SetBackgroundColor( const Vector4& color ) { - GetImplementation().SetKeyInputFocus(); + Internal::GetImplementation(*this).SetBackgroundColor( color ); } -bool Control::HasKeyInputFocus() +Vector4 Control::GetBackgroundColor() const { - return GetImplementation().HasKeyInputFocus(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -void Control::ClearKeyInputFocus() -{ - GetImplementation().ClearKeyInputFocus(); + return Internal::GetImplementation(*this).GetBackgroundColor(); } -PinchGestureDetector Control::GetPinchGestureDetector() const +void Control::SetBackgroundImage( Image image ) { - return GetImplementation().GetPinchGestureDetector(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -PanGestureDetector Control::GetPanGestureDetector() const -{ - return GetImplementation().GetPanGestureDetector(); + Internal::GetImplementation(*this).SetBackgroundImage( image ); } -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(); -} + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); -void Control::SetBackgroundColor( const Vector4& color ) -{ - GetImplementation().SetBackgroundColor( color ); + return controlDataImpl.IsResourceReady(); } -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)