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=36167e6b5b450d551cdb2d62fbf2cb13af18b530;hp=fbd26bfa832c98b807fe88e4d5b3f89e48f4a170;hb=76f9ffa0234acd1b72f3d92c631052a5b4147a83;hpb=6b496cacd2a596235a246c912a6b507a72d67ad4 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index fbd26bf..36167e6 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -392,6 +392,34 @@ Layout::VerticalAlignment Controller::GetVerticalAlignment() const return mImpl->mModel->mVerticalAlignment; } +void Controller::SetLineWrapMode( Layout::LineWrap::Mode lineWrapMode ) +{ + if( lineWrapMode != mImpl->mModel->mLineWrapMode ) + { + // Set the text wrap mode. + mImpl->mModel->mLineWrapMode = lineWrapMode; + + + // Update Text layout for applying wrap mode + mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | + ALIGN | + LAYOUT | + UPDATE_LAYOUT_SIZE | + REORDER ); + mImpl->mTextUpdateInfo.mCharacterIndex = 0u; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + + // Request relayout + mImpl->RequestRelayout(); + } +} + +Layout::LineWrap::Mode Controller::GetLineWrapMode() const +{ + return mImpl->mModel->mLineWrapMode; +} + void Controller::SetTextElideEnabled( bool enabled ) { mImpl->mModel->mElideEnabled = enabled; @@ -1715,14 +1743,14 @@ Vector3 Controller::GetNaturalSize() mImpl->UpdateModel( onlyOnceOperations ); // Layout the text for the new width. - mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT ); + mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT | REORDER ); // Store the actual control's size to restore later. const Size actualControlSize = mImpl->mModel->mVisualModel->mControlSize; DoRelayout( Size( MAX_FLOAT, MAX_FLOAT ), static_cast( onlyOnceOperations | - LAYOUT ), + LAYOUT | REORDER ), naturalSize.GetVectorXY() ); // Do not do again the only once operations. @@ -1769,7 +1797,8 @@ float Controller::GetHeightForWidth( float width ) Size layoutSize; if( fabsf( width - mImpl->mModel->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 || - mImpl->mTextUpdateInfo.mFullRelayoutNeeded ) + mImpl->mTextUpdateInfo.mFullRelayoutNeeded || + mImpl->mTextUpdateInfo.mClearAll ) { // Operations that can be done only once until the text changes. const OperationsMask onlyOnceOperations = static_cast( CONVERT_TO_UTF32 | @@ -2191,14 +2220,12 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) { // In some platforms arrive key events with no key code. // Do nothing. + return false; } - else if( Dali::DALI_KEY_ESCAPE == keyCode ) + else if( Dali::DALI_KEY_ESCAPE == keyCode || Dali::DALI_KEY_BACK == keyCode ) { - // Escape key is a special case which causes focus loss - KeyboardFocusLostEvent(); - - // Will request for relayout. - relayoutNeeded = true; + // Do nothing + return false; } else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) || ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) || @@ -2260,11 +2287,13 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) // and a character is typed after the type of a upper case latin character. // Do nothing. + return false; } else if( ( Dali::DALI_KEY_VOLUME_UP == keyCode ) || ( Dali::DALI_KEY_VOLUME_DOWN == keyCode ) ) { // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text. // Do nothing. + return false; } else { @@ -3195,7 +3224,8 @@ bool Controller::DoRelayout( const Size& size, charactersToGlyphBuffer, glyphsPerCharacterBuffer, totalNumberOfGlyphs, - mImpl->mModel->mHorizontalAlignment ); + mImpl->mModel->mHorizontalAlignment, + mImpl->mModel->mLineWrapMode ); // Resize the vector of positions to have the same size than the vector of glyphs. Vector& glyphPositions = mImpl->mModel->mVisualModel->mGlyphPositions; @@ -3650,6 +3680,16 @@ void Controller::ResetScrollPosition() } } +void Controller::SetControlInterface( ControlInterface* controlInterface ) +{ + mImpl->mControlInterface = controlInterface; +} + +bool Controller::ShouldClearFocusOnEscape() const +{ + return mImpl->mShouldClearFocusOnEscape; +} + // private : Private contructors & copy operator. Controller::Controller()