X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=5762fffce3475c0af8695af004fd1bf9501c90e0;hb=e5208b9110e3aa0fb53d4db1cd19408cc958bfbb;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..5762fff 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 { @@ -24,14 +31,6 @@ 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(); @@ -41,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 ) { } @@ -64,135 +63,145 @@ 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" ); + + Internal::GetImplementation(*this).SetBackgroundImage( image ); } -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 ); + + return controlDataImpl.IsResourceReady(); } -PanGestureDetector Control::GetPanGestureDetector() const +Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index ) { - return GetImplementation().GetPanGestureDetector(); + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); + return controlDataImpl.GetVisualResourceStatus( index ); } -TapGestureDetector Control::GetTapGestureDetector() const +Control::KeyEventSignalType& Control::KeyEventSignal() { - return GetImplementation().GetTapGestureDetector(); + return Internal::GetImplementation(*this).KeyEventSignal(); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - return GetImplementation().GetLongPressGestureDetector(); + return Internal::GetImplementation(*this).KeyInputFocusGainedSignal(); } -void Control::SetBackgroundColor( const Vector4& color ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - GetImplementation().SetBackgroundColor( color ); + return Internal::GetImplementation(*this).KeyInputFocusLostSignal(); } -Vector4 Control::GetBackgroundColor() const +Control::ResourceReadySignalType& Control::ResourceReadySignal() { - return GetImplementation().GetBackgroundColor(); + Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl ); + + return controlImpl.mResourceReadySignal; } -void Control::SetBackground( Image image ) +Control::AccessibilityActivateSignalType& Control::AccessibilityActivateSignal() { - GetImplementation().SetBackground( image ); + return Internal::GetImplementation(*this).AccessibilityActivateSignal(); } -void Control::ClearBackground() + +Control::Control(Internal::Control& implementation) +: CustomActor(implementation) { - GetImplementation().ClearBackground(); } -Actor Control::GetBackgroundActor() const +Control::Control(Dali::Internal::CustomActor* internal) +: CustomActor(internal) { - return GetImplementation().GetBackgroundActor(); + VerifyCustomActorPointer(internal); } -Control::KeyEventSignalType& Control::KeyEventSignal() +void Control::AccessibilitySetAttribute( const std::string& key, + const std::string value ) { - return GetImplementation().KeyEventSignal(); + return Internal::GetImplementation( *this ).AccessibilitySetAttribute( key, + value ); } -Control::Control(Internal::Control& implementation) -: CustomActor(implementation) +std::string Control::AccessibilityGetAttribute( const std::string& key ) { + return Internal::GetImplementation( *this ).AccessibilityGetAttribute( key ); } -Control::Control(Dali::Internal::CustomActor* internal) -: CustomActor(internal) +void Control::AccessibilityEraseAttribute( std::string& key ) { - VerifyCustomActorPointer(internal); + return Internal::GetImplementation( *this ).AccessibilityEraseAttribute( key ); } } // namespace Toolkit