X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=d683c7f8ce83127c31dfe1f599fdf1f7eb714dbc;hp=31c1edf5973cfb1154307b69c366589205636b65;hb=8a647e87a01c5c78451653c1264a9eea81ac9b20;hpb=04807c7be2d762bb23e3865fd2642ace1b3f1855;ds=inline diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp old mode 100755 new mode 100644 index 31c1edf..d683c7f --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -733,6 +733,31 @@ void Controller::UpdateAfterFontChange( const std::string& newDefaultFont ) } } +void Controller::RetrieveSelection( std::string& selectedText ) const +{ + mImpl->RetrieveSelection( selectedText, false ); +} + +void Controller::SetSelection( int start, int end ) +{ + mImpl->SetSelection( start, end ); +} + +std::pair< int, int > Controller::GetSelectionIndexes() const +{ + return mImpl->GetSelectionIndexes(); +} + +void Controller::CopyStringToClipboard( const std::string& source ) +{ + mImpl->CopyStringToClipboard( source ); +} + +void Controller::SendSelectionToClipboard( bool deleteAfterSending ) +{ + mImpl->SendSelectionToClipboard( deleteAfterSending ); +} + // public : Default style & Input style void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily ) @@ -2447,13 +2472,17 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ // Insert at current cursor position. Vector& modifyText = mImpl->mModel->mLogicalModel->mText; + auto pos = modifyText.End(); if( cursorIndex < numberOfCharactersInModel ) { - modifyText.Insert( modifyText.Begin() + cursorIndex, utf32Characters.Begin(), utf32Characters.Begin() + maxSizeOfNewText ); + pos = modifyText.Begin() + cursorIndex; } - else + unsigned int realPos = pos - modifyText.Begin(); + modifyText.Insert( pos, utf32Characters.Begin(), utf32Characters.Begin() + maxSizeOfNewText ); + + if( NULL != mImpl->mEditableControlInterface ) { - modifyText.Insert( modifyText.End(), utf32Characters.Begin(), utf32Characters.Begin() + maxSizeOfNewText ); + mImpl->mEditableControlInterface->TextInserted( realPos, maxSizeOfNewText, text ); } // Mark the first paragraph to be updated. @@ -2621,6 +2650,13 @@ bool Controller::RemoveText( int cursorOffset, currentText.Erase( first, last ); + if( NULL != mImpl->mEditableControlInterface ) + { + std::string utf8; + Utf32ToUtf8( first, numberOfCharacters, utf8 ); + mImpl->mEditableControlInterface->TextDeleted( cursorIndex, numberOfCharacters, utf8 ); + } + // Cursor position retreat oldCursorIndex = cursorIndex; @@ -3044,6 +3080,14 @@ void Controller::ResetCursorPosition( CharacterIndex cursorIndex ) } } +CharacterIndex Controller::GetCursorPosition() +{ + if( !mImpl->mEventData ) + return 0; + + return mImpl->mEventData->mPrimaryCursorPosition; +} + void Controller::ResetScrollPosition() { if( NULL != mImpl->mEventData )