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=889ca68600577ff4697d9008495c0151214685d4;hp=e07e29cdf9cd0ff3b9c0bac04cb1aa01d9b67ed1;hb=c3f7ea6cb0c0b75c2276193aff88b5c7a679a2d5;hpb=511ab5d892c68a8bbbc3846e85fc5ec8f7323470 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index e07e29c..889ca68 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -73,9 +73,6 @@ void Controller::EnableTextInput( DecoratorPtr decorator ) void Controller::SetText( const std::string& text ) { - // Cancel previously queued inserts etc. - mImpl->mModifyEvents.clear(); - // Remove the previously set text ResetText(); @@ -126,6 +123,9 @@ void Controller::SetText( const std::string& text ) // Reset keyboard as text changed mImpl->ResetImfManager(); + + // Do this last since it provides callbacks into application code + mImpl->mControlInterface.TextChanged(); } void Controller::GetText( std::string& text ) const @@ -1089,6 +1089,8 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) { DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" ); + bool textChanged( false ); + if( mImpl->mEventData && keyEvent.state == KeyEvent::Down ) { @@ -1131,6 +1133,8 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) { mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED ); } + + textChanged = true; } } else @@ -1141,6 +1145,8 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) mImpl->ClearPreEditFlag(); InsertText( keyString, COMMIT ); + + textChanged = true; } mImpl->ChangeState( EventData::EDITING ); // todo Confirm this is the best place to change the state of @@ -1148,6 +1154,12 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) mImpl->RequestRelayout(); } + if( textChanged ) + { + // Do this last since it provides callbacks into application code + mImpl->mControlInterface.TextChanged(); + } + return false; } @@ -1261,9 +1273,10 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mLogicalModel->mText.Count() ); - mImpl->mControlInterface.MaxLengthReached(); - mImpl->ResetImfManager(); + + // Do this last since it provides callbacks into application code + mImpl->mControlInterface.MaxLengthReached(); } } @@ -1432,6 +1445,9 @@ ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons { mImpl->mOperationsPending = ALL_OPERATIONS; mImpl->RequestRelayout(); + + // Do this last since it provides callbacks into application code + mImpl->mControlInterface.TextChanged(); } ImfManager::ImfCallbackData callbackData( update, cursorPosition, text, false ); @@ -1453,9 +1469,6 @@ void Controller::ShowPlaceholderText() mImpl->mEventData->mIsShowingPlaceholderText = true; - // Cancel previously queued inserts etc. - mImpl->mModifyEvents.clear(); - // Disable handles when showing place-holder text mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, false ); mImpl->mEventData->mDecorator->SetHandleActive( LEFT_SELECTION_HANDLE, false );