From: Adeel Kazmi Date: Fri, 12 Jun 2020 10:32:35 +0000 (+0000) Subject: Merge "(Text Decorator) Remove Image class Usage" into devel/master X-Git-Tag: dali_1.9.17~17 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=d257a3f941ed77bd4f6750f3ea6de642a587d16c;hp=ccbe150d1585639228e76d30f930732ef8b69630 Merge "(Text Decorator) Remove Image class Usage" into devel/master --- diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp old mode 100755 new mode 100644 index 0ddac75..68aac48 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -145,6 +145,24 @@ DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPU DALI_TYPE_REGISTRATION_END() +const char * const IMAGE_MAP_FILENAME_STRING = "filename"; + +/// Retrieves a filename from a value that is a Property::Map +std::string GetImageFileNameFromPropertyValue( const Property::Value& value ) +{ + std::string filename; + const Property::Map* map = value.GetMap(); + if( map ) + { + const Property::Value* filenameValue = map->Find( IMAGE_MAP_FILENAME_STRING ); + if( filenameValue ) + { + filenameValue->Get( filename ); + } + } + return filename; +} + } // namespace Toolkit::TextEditor TextEditor::New() @@ -351,90 +369,90 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE: { - const ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() ); + const std::string imageFileName = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName ); - if( impl.mDecorator ) + if( impl.mDecorator && imageFileName.size() ) { - impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE: { - const ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() ); + const std::string imageFileName = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName ); - if( impl.mDecorator ) + if( impl.mDecorator && imageFileName.size() ) { - impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; @@ -892,11 +910,7 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind { if( impl.mDecorator ) { - ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); } break; } @@ -904,11 +918,7 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind { if( impl.mDecorator ) { - ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); } break; } @@ -1772,14 +1782,9 @@ void TextEditor::GetHandleImagePropertyValue( Property::Value& value, Text::Han { if( mDecorator ) { - ResourceImage image = ResourceImage::DownCast( mDecorator->GetHandleImage( handleType, handleImageType ) ); - - if ( image ) - { - Property::Map map; - Scripting::CreatePropertyMap( image, map ); - value = map; - } + Property::Map map; + map[ IMAGE_MAP_FILENAME_STRING ] = mDecorator->GetHandleImage( handleType, handleImageType ); + value = map; } } diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp old mode 100755 new mode 100644 index 7e2d143..d496944 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -143,6 +143,24 @@ DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "inputStyleChanged", SIGNAL_INPUT DALI_TYPE_REGISTRATION_END() +const char * const IMAGE_MAP_FILENAME_STRING = "filename"; + +/// Retrieves a filename from a value that is a Property::Map +std::string GetImageFileNameFromPropertyValue( const Property::Value& value ) +{ + std::string filename; + const Property::Map* map = value.GetMap(); + if( map ) + { + const Property::Value* filenameValue = map->Find( IMAGE_MAP_FILENAME_STRING ); + if( filenameValue ) + { + filenameValue->Get( filename ); + } + } + return filename; +} + } // namespace Toolkit::TextField TextField::New() @@ -415,24 +433,24 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE: { - const ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() ); + const std::string imageFileName = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName ); - if( impl.mDecorator ) + if( impl.mDecorator && imageFileName.size() ) { - impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE: { - const ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() ); + const std::string imageFileName = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName ); - if( impl.mDecorator ) + if( impl.mDecorator && imageFileName.size() ) { - impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName ); impl.RequestTextRelayout(); } break; @@ -461,66 +479,66 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; } case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT: { - const Image image = Scripting::NewImage( value ); + const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && image ) + if( impl.mDecorator && filename.size() ) { - impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); + impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); } break; @@ -967,11 +985,7 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde { if( impl.mDecorator ) { - ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); } break; } @@ -979,11 +993,7 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde { if( impl.mDecorator ) { - ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); } break; } @@ -1800,14 +1810,9 @@ void TextField::GetHandleImagePropertyValue( Property::Value& value, Text::Hand { if( mDecorator ) { - ResourceImage image = ResourceImage::DownCast( mDecorator->GetHandleImage( handleType, handleImageType ) ); - - if ( image ) - { - Property::Map map; - Scripting::CreatePropertyMap( image, map ); - value = map; - } + Property::Map map; + map[ IMAGE_MAP_FILENAME_STRING ] = mDecorator->GetHandleImage( handleType, handleImageType ); + value = map; } } diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 65a5f68..5eafd84 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -29,6 +29,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -795,7 +796,7 @@ struct Decorator::Impl : public ConnectionTracker HandleImpl& grabHandle = mHandle[GRAB_HANDLE]; if( !grabHandle.actor ) { - if( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ) + if( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED].size() ) { grabHandle.actor = ImageView::New( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ); GetImpl( grabHandle.actor).SetDepthIndex( DepthIndex::DECORATION ); @@ -848,9 +849,9 @@ struct Decorator::Impl : public ConnectionTracker } } - void CreateHandleMarker( HandleImpl& handle, Image& image, HandleType handleType ) + void CreateHandleMarker( HandleImpl& handle, const std::string& image, HandleType handleType ) { - if( image ) + if( image.size() ) { handle.markerActor = ImageView::New( image ); handle.markerActor.SetProperty( Actor::Property::COLOR, mHandleColor ); @@ -876,7 +877,7 @@ struct Decorator::Impl : public ConnectionTracker HandleImpl& primary = mHandle[ LEFT_SELECTION_HANDLE ]; if( !primary.actor ) { - if( mHandleImages[LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] ) + if( mHandleImages[LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED].size() ) { primary.actor = ImageView::New( mHandleImages[LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] ); #ifdef DECORATOR_DEBUG @@ -920,7 +921,7 @@ struct Decorator::Impl : public ConnectionTracker HandleImpl& secondary = mHandle[ RIGHT_SELECTION_HANDLE ]; if( !secondary.actor ) { - if( mHandleImages[RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] ) + if( mHandleImages[RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED].size() ) { secondary.actor = ImageView::New( mHandleImages[RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] ); #ifdef DECORATOR_DEBUG @@ -1121,7 +1122,7 @@ struct Decorator::Impl : public ConnectionTracker // Chooses between the released or pressed image. It checks whether the pressed image exists. if( handle.actor ) { - const HandleImageType imageType = ( handle.pressed ? ( mHandleImages[type][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); + const HandleImageType imageType = ( handle.pressed ? ( mHandleImages[type][HANDLE_IMAGE_PRESSED].size() ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); handle.actor.SetImage( mHandleImages[type][imageType] ); } @@ -1130,7 +1131,7 @@ struct Decorator::Impl : public ConnectionTracker { if( handle.markerActor ) { - const HandleImageType markerImageType = ( handle.pressed ? ( mHandleImages[markerType][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); + const HandleImageType markerImageType = ( handle.pressed ? ( mHandleImages[markerType][HANDLE_IMAGE_PRESSED].size() ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); handle.markerActor.SetImage( mHandleImages[markerType][markerImageType] ); } } @@ -1755,12 +1756,14 @@ struct Decorator::Impl : public ConnectionTracker mPopupBottomExceedNotification.NotifySignal().Connect( this, &Decorator::Impl::PopUpLeavesBottomBoundary ); } - void SetHandleImage( HandleType handleType, HandleImageType handleImageType, Dali::Image image ) + void SetHandleImage( HandleType handleType, HandleImageType handleImageType, const std::string& imageFileName ) { + ImageDimensions dimensions = Dali::GetOriginalImageSize( imageFileName ); + HandleImpl& handle = mHandle[handleType]; - handle.size = Size( image.GetWidth(), image.GetHeight() ); + handle.size = Size( dimensions.GetWidth(), dimensions.GetHeight() ); - mHandleImages[handleType][handleImageType] = image; + mHandleImages[handleType][handleImageType] = imageFileName; } void SetScrollThreshold( float threshold ) @@ -1898,7 +1901,7 @@ struct Decorator::Impl : public ConnectionTracker TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons TextSelectionPopupCallbackInterface& mTextSelectionPopupCallbackInterface; - Image mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT]; + std::string mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT]; Vector4 mHandleColor; CursorImpl mCursor[CURSOR_COUNT]; @@ -2109,11 +2112,11 @@ void Decorator::SetHandleActive( HandleType handleType, bool active ) // The problem is the handle actor does not receive the touch event with the Interrupt // state when the power button is pressed and the application goes to background. mImpl->mHandle[handleType].pressed = false; - Image imageReleased = mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED]; + const bool imageReleased = mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED].size(); ImageView imageView = mImpl->mHandle[handleType].actor; if( imageReleased && imageView ) { - imageView.SetImage( imageReleased ); + imageView.SetImage( mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED] ); } } @@ -2124,12 +2127,12 @@ bool Decorator::IsHandleActive( HandleType handleType ) const return mImpl->mHandle[handleType].active ; } -void Decorator::SetHandleImage( HandleType handleType, HandleImageType handleImageType, Dali::Image image ) +void Decorator::SetHandleImage( HandleType handleType, HandleImageType handleImageType, const std::string& imageFileName ) { - mImpl->SetHandleImage( handleType, handleImageType, image ); + mImpl->SetHandleImage( handleType, handleImageType, imageFileName ); } -Dali::Image Decorator::GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const +const std::string& Decorator::GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const { return mImpl->mHandleImages[handleType][handleImageType]; } diff --git a/dali-toolkit/internal/text/decorator/text-decorator.h b/dali-toolkit/internal/text/decorator/text-decorator.h index 36adee4..8d0894f 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.h +++ b/dali-toolkit/internal/text/decorator/text-decorator.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_DECORATOR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -353,23 +353,23 @@ public: bool IsHandleActive( HandleType handleType ) const; /** - * @brief Sets the image for one of the handles. + * @brief Sets the image file name for one of the handles. * * @param[in] handleType One of the handles. * @param[in] handleImageType A different image can be set for the pressed/released states. - * @param[in] image The image to use. + * @param[in] imageFileName The image filename to use. */ - void SetHandleImage( HandleType handleType, HandleImageType handleImageType, Dali::Image image ); + void SetHandleImage( HandleType handleType, HandleImageType handleImageType, const std::string& imageFileName ); /** - * @brief Retrieves the image for one of the handles. + * @brief Retrieves the file name of the image for one of the handles. * * @param[in] handleType One of the handles. * @param[in] handleImageType A different image can be set for the pressed/released states. * - * @return The grab handle image. + * @return The grab handle image string. */ - Dali::Image GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const; + const std::string& GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const; /** * @brief Sets the color of the handles