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=b9e94eced80fe2fafbec2889d9c0dd639304ccfb;hp=831fd9cf83737e4a0442bd9c4efd612a85b669fc;hb=9dc9e248aa53b097c6a41fb043c3d5341f93ec45;hpb=fbb1f2f599b2fc1a54b327039ce6111f4b4ba4cf diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 831fd9c..b9e94ec 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1313,6 +1313,23 @@ const std::string& Controller::GetInputOutlineProperties() const return GetDefaultOutlineProperties(); } +void Controller::SetInputModePassword( bool passwordInput ) +{ + if( NULL != mImpl->mEventData ) + { + mImpl->mEventData->mPasswordInput = passwordInput; + } +} + +bool Controller::IsInputModePassword() +{ + if( NULL != mImpl->mEventData ) + { + return mImpl->mEventData->mPasswordInput; + } + return false; +} + // public : Queries & retrieves. Layout::Engine& Controller::GetLayoutEngine() @@ -1701,8 +1718,29 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) ( Dali::DALI_KEY_CURSOR_UP == keyCode ) || ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) ) { - mImpl->mEventData->mCheckScrollAmount = true; + // If don't have any text, do nothing. + if( !mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) + { + return false; + } + uint32_t cursorPosition = mImpl->mEventData->mPrimaryCursorPosition; + uint32_t numberOfCharacters = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + uint32_t cursorLine = mImpl->mModel->mVisualModel->GetLineOfCharacter( cursorPosition ); + uint32_t numberOfLines = mImpl->mModel->GetNumberOfLines(); + + // Logic to determine whether this text control will lose focus or not. + if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode && 0 == cursorPosition ) || + ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode && numberOfCharacters == cursorPosition) || + ( Dali::DALI_KEY_CURSOR_DOWN == keyCode && cursorLine == numberOfLines -1 ) || + ( Dali::DALI_KEY_CURSOR_DOWN == keyCode && numberOfCharacters == cursorPosition && cursorLine -1 == numberOfLines -1 ) || + ( Dali::DALI_KEY_CURSOR_UP == keyCode && cursorLine == 0 ) || + ( Dali::DALI_KEY_CURSOR_UP == keyCode && numberOfCharacters == cursorPosition && cursorLine == 1 ) ) + { + return false; + } + + mImpl->mEventData->mCheckScrollAmount = true; Event event( Event::CURSOR_KEY_EVENT ); event.p1.mInt = keyCode; mImpl->mEventData->mEventQueue.push_back( event ); @@ -1711,17 +1749,14 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) { textChanged = BackspaceKeyEvent(); } - else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) ) - { - mImpl->ChangeState( EventData::INTERRUPTED ); // State is not INACTIVE as expect to return to edit mode. - // Avoids calling the InsertText() method which can delete selected text - } - else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) || + else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) || + IsKey( keyEvent, Dali::DALI_KEY_MENU ) || IsKey( keyEvent, Dali::DALI_KEY_HOME ) ) { + // Power key/Menu/Home key behaviour does not allow edit mode to resume. mImpl->ChangeState( EventData::INACTIVE ); - // Menu/Home key behaviour does not allow edit mode to resume like Power key - // Avoids calling the InsertText() method which can delete selected text + + // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text. } else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode ) {