X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-field-impl.cpp;h=6a1f1c9d67c7af4005b519df5188ed727c6a6d2c;hp=71680317197b7d6f58fbdea92135e1d66c3483da;hb=41d36118a13932bcf1db39b780ac437fcda8aa08;hpb=dfc446045beee475f6523e1bf94b52ce11463d1d diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 7168031..6a1f1c9 100755 --- 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) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -27,7 +27,6 @@ #include #include #include -#include #include // INTERNAL INCLUDES @@ -45,6 +44,7 @@ #include #include #include +#include using namespace Dali::Toolkit::Text; @@ -91,6 +91,8 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "horizontalAlignment", DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "verticalAlignment", STRING, VERTICAL_ALIGNMENT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "textColor", VECTOR4, TEXT_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "reservedProperty01", STRING, RESERVED_PROPERTY_01 ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "reservedProperty02", STRING, RESERVED_PROPERTY_02 ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "primaryCursorColor", VECTOR4, PRIMARY_CURSOR_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "secondaryCursorColor", VECTOR4, SECONDARY_CURSOR_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableCursorBlink", BOOLEAN, ENABLE_CURSOR_BLINK ) @@ -131,6 +133,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "ellipsis", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableShiftSelection", BOOLEAN, ENABLE_SHIFT_SELECTION ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -762,6 +765,17 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: + { + if (impl.mController) + { + const bool grabHandlePopupEnabled = value.Get(); + DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled); + + impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled); + break; + } + } } // switch } // textfield } @@ -1169,12 +1183,29 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: + { + if (impl.mController) + { + value = impl.mController->IsGrabHandlePopupEnabled(); + } + break; + } } //switch } return value; } +void TextField::SelectWholeText() +{ + if( mController && mController->IsShowingRealText() ) + { + mController->SelectEvent( 0.f, 0.f, true ); + SetKeyInputFocus(); + } +} + InputMethodContext TextField::GetInputMethodContext() { return mInputMethodContext; @@ -1236,7 +1267,7 @@ void TextField::OnInitialize() mDecorator = Text::Decorator::New( *mController, *mController ); - mInputMethodContext = InputMethodContext::New(); + mInputMethodContext = InputMethodContext::New( self ); mController->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX ); @@ -1432,8 +1463,14 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) if( renderableActor != mRenderableActor ) { + UnparentAndReset( mBackgroundActor ); UnparentAndReset( mRenderableActor ); mRenderableActor = renderableActor; + + if ( mRenderableActor ) + { + mBackgroundActor = mController->CreateBackgroundActor(); + } } } @@ -1441,9 +1478,12 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) { const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition(); + float renderableActorPositionX, renderableActorPositionY; + if( mStencil ) { - mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y ); + renderableActorPositionX = scrollOffset.x + mAlignmentOffset; + renderableActorPositionY = scrollOffset.y; } else { @@ -1457,13 +1497,17 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) std::swap( padding.start, padding.end ); } - mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset + padding.start, scrollOffset.y + padding.top ); + renderableActorPositionX = scrollOffset.x + mAlignmentOffset + padding.start; + renderableActorPositionY = scrollOffset.y + padding.top; } + mRenderableActor.SetPosition( renderableActorPositionX, renderableActorPositionY ); // Make sure the actors are parented correctly with/without clipping Actor self = mStencil ? mStencil : Self(); + Actor highlightActor; + for( std::vector::iterator it = mClippingDecorationActors.begin(), endIt = mClippingDecorationActors.end(); it != endIt; @@ -1471,10 +1515,31 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) { self.Add( *it ); it->LowerToBottom(); + + if ( it->GetName() == "HighlightActor" ) + { + highlightActor = *it; + } } mClippingDecorationActors.clear(); self.Add( mRenderableActor ); + + if ( mBackgroundActor ) + { + if ( mDecorator && mDecorator->IsHighlightVisible() ) + { + self.Add( mBackgroundActor ); + mBackgroundActor.SetPosition( renderableActorPositionX, renderableActorPositionY); // In text field's coords. + mBackgroundActor.LowerBelow( highlightActor ); + } + else + { + mRenderableActor.Add( mBackgroundActor ); + mBackgroundActor.SetPosition( 0.0f, 0.0f ); // In renderable actor's coords. + mBackgroundActor.LowerToBottom(); + } + } } }