return fontDescriptionRun;
}
-// public : Constructor.
-
ControllerPtr Controller::New( ControlInterface& controlInterface )
{
return ControllerPtr( new Controller( controlInterface ) );
}
-// public : Configure the text controller.
-
void Controller::EnableTextInput( DecoratorPtr decorator )
{
if( NULL == mImpl->mEventData )
return false;
}
-void Controller::SetMaximumNumberOfCharacters( Length maxCharacters )
-{
- mImpl->mMaximumNumberOfCharacters = maxCharacters;
-}
-
-int Controller::GetMaximumNumberOfCharacters()
-{
- return mImpl->mMaximumNumberOfCharacters;
-}
-
-void Controller::SetEnableCursorBlink( bool enable )
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
-
- if( NULL != mImpl->mEventData )
- {
- mImpl->mEventData->mCursorBlinkEnabled = enable;
-
- if( !enable &&
- mImpl->mEventData->mDecorator )
- {
- mImpl->mEventData->mDecorator->StopCursorBlink();
- }
- }
-}
-
-bool Controller::GetEnableCursorBlink() const
-{
- if( NULL != mImpl->mEventData )
- {
- return mImpl->mEventData->mCursorBlinkEnabled;
- }
-
- return false;
-}
-
-void Controller::SetMultiLineEnabled( bool enable )
-{
- const LayoutEngine::Layout layout = enable ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
-
- if( layout != mImpl->mLayoutEngine.GetLayout() )
- {
- // Set the layout type.
- mImpl->mLayoutEngine.SetLayout( layout );
-
- // Set the flags to redo the layout operations
- const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
- UPDATE_LAYOUT_SIZE |
- ALIGN |
- REORDER );
-
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
-
- mImpl->RequestRelayout();
- }
-}
-
-bool Controller::IsMultiLineEnabled() const
-{
- return LayoutEngine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
-}
-
-void Controller::SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
-{
- if( alignment != mImpl->mLayoutEngine.GetHorizontalAlignment() )
- {
- // Set the alignment.
- mImpl->mLayoutEngine.SetHorizontalAlignment( alignment );
-
- // Set the flag to redo the alignment operation.
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
-
- mImpl->RequestRelayout();
- }
-}
-
-LayoutEngine::HorizontalAlignment Controller::GetHorizontalAlignment() const
-{
- return mImpl->mLayoutEngine.GetHorizontalAlignment();
-}
-
-void Controller::SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
-{
- if( alignment != mImpl->mLayoutEngine.GetVerticalAlignment() )
- {
- // Set the alignment.
- mImpl->mLayoutEngine.SetVerticalAlignment( alignment );
-
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
-
- mImpl->RequestRelayout();
- }
-}
-
-LayoutEngine::VerticalAlignment Controller::GetVerticalAlignment() const
-{
- return mImpl->mLayoutEngine.GetVerticalAlignment();
-}
-
-// public : Update
-
void Controller::SetText( const std::string& text )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
}
}
-void Controller::UpdateAfterFontChange( const std::string& newDefaultFont )
+void Controller::SetMaximumNumberOfCharacters( Length maxCharacters )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::UpdateAfterFontChange\n");
-
- if( !mImpl->mFontDefaults->familyDefined ) // If user defined font then should not update when system font changes
- {
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange newDefaultFont(%s)\n", newDefaultFont.c_str() );
- mImpl->mFontDefaults->mFontDescription.family = newDefaultFont;
-
- ClearFontData();
-
- mImpl->RequestRelayout();
- }
+ mImpl->mMaximumNumberOfCharacters = maxCharacters;
}
-// public : Default style & Input style
+int Controller::GetMaximumNumberOfCharacters()
+{
+ return mImpl->mMaximumNumberOfCharacters;
+}
void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
{
return 0.0f;
}
+void Controller::UpdateAfterFontChange( const std::string& newDefaultFont )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::UpdateAfterFontChange\n");
+
+ if( !mImpl->mFontDefaults->familyDefined ) // If user defined font then should not update when system font changes
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange newDefaultFont(%s)\n", newDefaultFont.c_str() );
+ mImpl->mFontDefaults->mFontDescription.family = newDefaultFont;
+
+ ClearFontData();
+
+ mImpl->RequestRelayout();
+ }
+}
+
void Controller::SetTextColor( const Vector4& textColor )
{
mImpl->mTextColor = textColor;
return mImpl->mTextColor;
}
+bool Controller::RemoveText( int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type )
+{
+ bool removed = false;
+
+ if( NULL == mImpl->mEventData )
+ {
+ return removed;
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n",
+ this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
+
+ if( !mImpl->IsShowingPlaceholderText() )
+ {
+ // Delete at current cursor position
+ Vector<Character>& currentText = mImpl->mLogicalModel->mText;
+ CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
+
+ CharacterIndex cursorIndex = oldCursorIndex;
+
+ // Validate the cursor position & number of characters
+ if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
+ {
+ cursorIndex = oldCursorIndex + cursorOffset;
+ }
+
+ if( ( cursorIndex + numberOfCharacters ) > currentText.Count() )
+ {
+ numberOfCharacters = currentText.Count() - cursorIndex;
+ }
+
+ if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
+ {
+ // Mark the paragraphs to be updated.
+ mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove += numberOfCharacters;
+
+ // Update the input style and remove the text's style before removing the text.
+
+ if( UPDATE_INPUT_STYLE == type )
+ {
+ // Keep a copy of the current input style.
+ InputStyle currentInputStyle;
+ currentInputStyle.Copy( mImpl->mEventData->mInputStyle );
+
+ // Set first the default input style.
+ mImpl->RetrieveDefaultInputStyle( mImpl->mEventData->mInputStyle );
+
+ // Update the input style.
+ mImpl->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
+
+ // Compare if the input style has changed.
+ const bool hasInputStyleChanged = !currentInputStyle.Equal( mImpl->mEventData->mInputStyle );
+
+ if( hasInputStyleChanged )
+ {
+ const InputStyle::Mask styleChangedMask = currentInputStyle.GetInputStyleChangeMask( mImpl->mEventData->mInputStyle );
+ // Queue the input style changed signal.
+ mImpl->mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
+ }
+ }
+
+ // Updates the text style runs by removing characters. Runs with no characters are removed.
+ mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
+
+ // Remove the characters.
+ Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
+ Vector<Character>::Iterator last = first + numberOfCharacters;
+
+ currentText.Erase( first, last );
+
+ // Cursor position retreat
+ oldCursorIndex = cursorIndex;
+
+ mImpl->mEventData->mScrollAfterDelete = true;
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", this, numberOfCharacters );
+ removed = true;
+ }
+ }
+
+ return removed;
+}
+
void Controller::SetPlaceholderTextColor( const Vector4& textColor )
{
if( NULL != mImpl->mEventData )
return GetDefaultOutlineProperties();
}
-// public : Queries & retrieves.
-
-LayoutEngine& Controller::GetLayoutEngine()
+void Controller::SetEnableCursorBlink( bool enable )
{
- return mImpl->mLayoutEngine;
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
+
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mCursorBlinkEnabled = enable;
+
+ if( !enable &&
+ mImpl->mEventData->mDecorator )
+ {
+ mImpl->mEventData->mDecorator->StopCursorBlink();
+ }
+ }
}
-View& Controller::GetView()
+bool Controller::GetEnableCursorBlink() const
{
- return mImpl->mView;
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mCursorBlinkEnabled;
+ }
+
+ return false;
}
const Vector2& Controller::GetScrollPosition() const
return layoutSize.height;
}
-// public : Relayout.
-
Controller::UpdateTextType Controller::Relayout( const Size& size )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, (mImpl->mAutoScrollEnabled)?"true":"false" );
return updateTextType;
}
-// public : Input style change signals.
-
-bool Controller::IsInputStyleChangedSignalsQueueEmpty()
+void Controller::ProcessModifyEvents()
{
- return ( NULL == mImpl->mEventData ) || ( 0u == mImpl->mEventData->mInputStyleChangedQueue.Count() );
-}
+ Vector<ModifyEvent>& events = mImpl->mModifyEvents;
-void Controller::ProcessInputStyleChangedSignals()
-{
- if( NULL == mImpl->mEventData )
+ if( 0u == events.Count() )
+ {
+ // Nothing to do.
+ return;
+ }
+
+ for( Vector<ModifyEvent>::ConstIterator it = events.Begin(),
+ endIt = events.End();
+ it != endIt;
+ ++it )
+ {
+ const ModifyEvent& event = *it;
+
+ if( ModifyEvent::TEXT_REPLACED == event.type )
+ {
+ // A (single) replace event should come first, otherwise we wasted time processing NOOP events
+ DALI_ASSERT_DEBUG( it == events.Begin() && "Unexpected TEXT_REPLACED event" );
+
+ TextReplacedEvent();
+ }
+ else if( ModifyEvent::TEXT_INSERTED == event.type )
+ {
+ TextInsertedEvent();
+ }
+ else if( ModifyEvent::TEXT_DELETED == event.type )
+ {
+ // Placeholder-text cannot be deleted
+ if( !mImpl->IsShowingPlaceholderText() )
+ {
+ TextDeletedEvent();
+ }
+ }
+ }
+
+ if( NULL != mImpl->mEventData )
+ {
+ // When the text is being modified, delay cursor blinking
+ mImpl->mEventData->mDecorator->DelayCursorBlink();
+ }
+
+ // Discard temporary text
+ events.Clear();
+}
+
+bool Controller::IsInputStyleChangedSignalsQueueEmpty()
+{
+ return ( NULL == mImpl->mEventData ) || ( 0u == mImpl->mEventData->mInputStyleChangedQueue.Count() );
+}
+
+void Controller::ProcessInputStyleChangedSignals()
+{
+ if( NULL == mImpl->mEventData )
{
// Nothing to do.
return;
mImpl->mEventData->mInputStyleChangedQueue.Clear();
}
-// public : Text-input Event Queuing.
-
-void Controller::KeyboardFocusGainEvent()
+void Controller::ResetText()
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusGainEvent" );
+ // Reset buffers.
+ mImpl->mLogicalModel->mText.Clear();
+
+ // We have cleared everything including the placeholder-text
+ mImpl->PlaceholderCleared();
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = 0u;
+
+ // Clear any previous text.
+ mImpl->mTextUpdateInfo.mClearAll = true;
+
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
+
+ // Apply modifications to the model
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
+void Controller::ResetCursorPosition( CharacterIndex cursorIndex )
+{
+ // Reset the cursor position
if( NULL != mImpl->mEventData )
{
- if( ( EventData::INACTIVE == mImpl->mEventData->mState ) ||
- ( EventData::INTERRUPTED == mImpl->mEventData->mState ) )
- {
- mImpl->ChangeState( EventData::EDITING );
- mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
- }
- mImpl->NotifyImfMultiLineStatus();
- if( mImpl->IsShowingPlaceholderText() )
+ mImpl->mEventData->mPrimaryCursorPosition = cursorIndex;
+
+ // Update the cursor if it's in editing mode.
+ if( EventData::IsEditingState( mImpl->mEventData->mState ) )
{
- // Show alternative placeholder-text when editing
- ShowPlaceholderText();
+ mImpl->mEventData->mUpdateCursorPosition = true;
}
-
- mImpl->RequestRelayout();
}
}
-void Controller::KeyboardFocusLostEvent()
+void Controller::ResetScrollPosition()
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusLostEvent" );
-
if( NULL != mImpl->mEventData )
{
- if( EventData::INTERRUPTED != mImpl->mEventData->mState )
- {
- mImpl->ChangeState( EventData::INACTIVE );
-
- if( !mImpl->IsShowingRealText() )
- {
- // Revert to regular placeholder-text when not editing
- ShowPlaceholderText();
- }
- }
+ // Reset the scroll position.
+ mImpl->mScrollPosition = Vector2::ZERO;
+ mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
- mImpl->RequestRelayout();
}
-bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
+void Controller::TextReplacedEvent()
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" );
-
- bool textChanged( false );
-
- if( ( NULL != mImpl->mEventData ) &&
- ( keyEvent.state == KeyEvent::Down ) )
- {
- int keyCode = keyEvent.keyCode;
- const std::string& keyString = keyEvent.keyPressed;
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
- // Pre-process to separate modifying events from non-modifying input events.
- if( Dali::DALI_KEY_ESCAPE == keyCode )
- {
- // Escape key is a special case which causes focus loss
- KeyboardFocusLostEvent();
- }
- else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_UP == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) )
- {
- Event event( Event::CURSOR_KEY_EVENT );
- event.p1.mInt = keyCode;
- mImpl->mEventData->mEventQueue.push_back( event );
- }
- else if( Dali::DALI_KEY_BACKSPACE == keyCode )
- {
- 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 ) ||
- IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
- {
- 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
- }
- else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
- {
- // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled
- // and a character is typed after the type of a upper case latin character.
+ // Apply modifications to the model
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
- // Do nothing.
- }
- else
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
+void Controller::TextInsertedEvent()
+{
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextInsertedEvent" );
- // IMF manager is no longer handling key-events
- mImpl->ClearPreEditFlag();
+ if( NULL == mImpl->mEventData )
+ {
+ return;
+ }
- InsertText( keyString, COMMIT );
- textChanged = true;
- }
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
- if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
- ( mImpl->mEventData->mState != EventData::INACTIVE ) &&
- ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
- {
- // Should not change the state if the key is the shift send by the imf manager.
- // Otherwise, when the state is SELECTING the text controller can't send the right
- // surrounding info to the imf.
- mImpl->ChangeState( EventData::EDITING );
- }
+ // Apply modifications to the model; TODO - Optimize this
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
- mImpl->RequestRelayout();
- }
+void Controller::TextDeletedEvent()
+{
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextDeletedEvent" );
- if( textChanged )
+ if( NULL == mImpl->mEventData )
{
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ return;
}
- return true;
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
+
+ // Apply modifications to the model; TODO - Optimize this
+ mImpl->mOperationsPending = ALL_OPERATIONS;
}
-void Controller::TapEvent( unsigned int tapCount, float x, float y )
+bool Controller::DoRelayout( const Size& size,
+ OperationsMask operationsRequired,
+ Size& layoutSize )
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
+ bool viewUpdated( false );
- if( NULL != mImpl->mEventData )
+ // Calculate the operations to be done.
+ const OperationsMask operations = static_cast<OperationsMask>( mImpl->mOperationsPending & operationsRequired );
+
+ const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
+ const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
+
+ // Get the current layout size.
+ layoutSize = mImpl->mVisualModel->GetLayoutSize();
+
+ if( NO_OPERATION != ( LAYOUT & operations ) )
{
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "TapEvent state:%d \n", mImpl->mEventData->mState );
- EventData::State state( mImpl->mEventData->mState );
- bool relayoutNeeded( false ); // to avoid unnecessary relayouts when tapping an empty text-field
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
- if( mImpl->IsClipboardVisible() )
+ // Some vectors with data needed to layout and reorder may be void
+ // after the first time the text has been laid out.
+ // Fill the vectors again.
+
+ // Calculate the number of glyphs to layout.
+ const Vector<GlyphIndex>& charactersToGlyph = mImpl->mVisualModel->mCharactersToGlyph;
+ const Vector<Length>& glyphsPerCharacter = mImpl->mVisualModel->mGlyphsPerCharacter;
+ const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
+
+ const CharacterIndex lastIndex = startIndex + ( ( requestedNumberOfCharacters > 0u ) ? requestedNumberOfCharacters - 1u : 0u );
+ const GlyphIndex startGlyphIndex = mImpl->mTextUpdateInfo.mStartGlyphIndex;
+ const Length numberOfGlyphs = ( requestedNumberOfCharacters > 0u ) ? *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex : 0u;
+ const Length totalNumberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count();
+
+ if( 0u == totalNumberOfGlyphs )
{
- if( EventData::INACTIVE == state || EventData::EDITING == state)
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
- mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
+ mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
}
- relayoutNeeded = true;
- }
- else if( 1u == tapCount )
+
+ // Nothing else to do if there is no glyphs.
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
+ return true;
+ }
+
+ const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
+ const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
+ const Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
+ const Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
+ const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
+ const Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
+ const Character* const textBuffer = mImpl->mLogicalModel->mText.Begin();
+
+ // Set the layout parameters.
+ LayoutParameters layoutParameters( size,
+ textBuffer,
+ lineBreakInfo.Begin(),
+ wordBreakInfo.Begin(),
+ ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
+ glyphs.Begin(),
+ glyphsToCharactersMap.Begin(),
+ charactersPerGlyph.Begin(),
+ charactersToGlyphBuffer,
+ glyphsPerCharacterBuffer,
+ totalNumberOfGlyphs );
+
+ // Resize the vector of positions to have the same size than the vector of glyphs.
+ Vector<Vector2>& glyphPositions = mImpl->mVisualModel->mGlyphPositions;
+ glyphPositions.Resize( totalNumberOfGlyphs );
+
+ // Whether the last character is a new paragraph character.
+ mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mLogicalModel->mText.Count() - 1u ) ) );
+ layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
+
+ // The initial glyph and the number of glyphs to layout.
+ layoutParameters.startGlyphIndex = startGlyphIndex;
+ layoutParameters.numberOfGlyphs = numberOfGlyphs;
+ layoutParameters.startLineIndex = mImpl->mTextUpdateInfo.mStartLineIndex;
+ layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
+
+ // Update the visual model.
+ Size newLayoutSize;
+ viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
+ glyphPositions,
+ mImpl->mVisualModel->mLines,
+ newLayoutSize );
+
+ viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
+
+ if( viewUpdated )
{
- if( EventData::EDITING_WITH_POPUP == state || EventData::EDITING_WITH_PASTE_POPUP == state )
- {
- mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); // If Popup shown hide it here so can be shown again if required.
- }
+ layoutSize = newLayoutSize;
- if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != state ) )
+ if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
{
- mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
- relayoutNeeded = true;
+ mImpl->mAutoScrollDirectionRTL = false;
}
- else
+
+ // Reorder the lines
+ if( NO_OPERATION != ( REORDER & operations ) )
{
- if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() )
- {
- // Hide placeholder text
- ResetText();
- }
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mLogicalModel->mBidirectionalParagraphInfo;
+ Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mLogicalModel->mBidirectionalLineInfo;
- if( EventData::INACTIVE == state )
- {
- mImpl->ChangeState( EventData::EDITING );
- }
- else if( !mImpl->IsClipboardEmpty() )
+ // Check first if there are paragraphs with bidirectional info.
+ if( 0u != bidirectionalInfo.Count() )
{
- mImpl->ChangeState( EventData::EDITING_WITH_POPUP );
+ // Get the lines
+ const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
+
+ // Reorder the lines.
+ bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
+ ReorderLines( bidirectionalInfo,
+ startIndex,
+ requestedNumberOfCharacters,
+ mImpl->mVisualModel->mLines,
+ bidirectionalLineInfo );
+
+ // Set the bidirectional info per line into the layout parameters.
+ layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
+ layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
+
+ // Re-layout the text. Reorder those lines with right to left characters.
+ mImpl->mLayoutEngine.ReLayoutRightToLeftLines( layoutParameters,
+ startIndex,
+ requestedNumberOfCharacters,
+ glyphPositions );
+
+ if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
+ {
+ const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
+ if ( firstline )
+ {
+ mImpl->mAutoScrollDirectionRTL = firstline->direction;
+ }
+ }
}
- relayoutNeeded = true;
- }
- }
- else if( 2u == tapCount )
- {
- if( mImpl->mEventData->mSelectionEnabled &&
- mImpl->IsShowingRealText() )
+ } // REORDER
+
+ // Sets the layout size.
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
- SelectEvent( x, y, false );
+ mImpl->mVisualModel->SetLayoutSize( layoutSize );
}
- }
- // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
- if( relayoutNeeded )
- {
- Event event( Event::TAP_EVENT );
- event.p1.mUint = tapCount;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ } // view updated
- mImpl->RequestRelayout();
- }
+ // Store the size used to layout the text.
+ mImpl->mVisualModel->mControlSize = size;
}
- // Reset keyboard as tap event has occurred.
- mImpl->ResetImfManager();
+ if( NO_OPERATION != ( ALIGN & operations ) )
+ {
+ // The laid-out lines.
+ Vector<LineRun>& lines = mImpl->mVisualModel->mLines;
+
+ mImpl->mLayoutEngine.Align( size,
+ startIndex,
+ requestedNumberOfCharacters,
+ lines );
+
+ viewUpdated = true;
+ }
+#if defined(DEBUG_ENABLED)
+ std::string currentText;
+ GetText( currentText );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::DoRelayout [%p] mImpl->mAutoScrollDirectionRTL[%s] [%s]\n", this, (mImpl->mAutoScrollDirectionRTL)?"true":"false", currentText.c_str() );
+#endif
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
+ return viewUpdated;
}
-void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
+void Controller::SetMultiLineEnabled( bool enable )
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
+ const LayoutEngine::Layout layout = enable ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
- if( NULL != mImpl->mEventData )
+ if( layout != mImpl->mLayoutEngine.GetLayout() )
{
- Event event( Event::PAN_EVENT );
- event.p1.mInt = state;
- event.p2.mFloat = displacement.x;
- event.p3.mFloat = displacement.y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ // Set the layout type.
+ mImpl->mLayoutEngine.SetLayout( layout );
+
+ // Set the flags to redo the layout operations
+ const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
+ UPDATE_LAYOUT_SIZE |
+ ALIGN |
+ REORDER );
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
mImpl->RequestRelayout();
}
}
-void Controller::LongPressEvent( Gesture::State state, float x, float y )
+bool Controller::IsMultiLineEnabled() const
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" );
+ return LayoutEngine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
+}
- if( ( state == Gesture::Started ) &&
- ( NULL != mImpl->mEventData ) )
+void Controller::SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
+{
+ if( alignment != mImpl->mLayoutEngine.GetHorizontalAlignment() )
{
- if( !mImpl->IsShowingRealText() )
- {
- Event event( Event::LONG_PRESS_EVENT );
- event.p1.mInt = state;
- mImpl->mEventData->mEventQueue.push_back( event );
- mImpl->RequestRelayout();
- }
- else
- {
- // The 1st long-press on inactive text-field is treated as tap
- if( EventData::INACTIVE == mImpl->mEventData->mState )
- {
- mImpl->ChangeState( EventData::EDITING );
+ // Set the alignment.
+ mImpl->mLayoutEngine.SetHorizontalAlignment( alignment );
- Event event( Event::TAP_EVENT );
- event.p1.mUint = 1;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ // Set the flag to redo the alignment operation.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
- mImpl->RequestRelayout();
- }
- else if( !mImpl->IsClipboardVisible() )
- {
- // Reset the imf manger to commit the pre-edit before selecting the text.
- mImpl->ResetImfManager();
+ mImpl->RequestRelayout();
+ }
+}
- SelectEvent( x, y, false );
- }
- }
+LayoutEngine::HorizontalAlignment Controller::GetHorizontalAlignment() const
+{
+ return mImpl->mLayoutEngine.GetHorizontalAlignment();
+}
+
+void Controller::SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
+{
+ if( alignment != mImpl->mLayoutEngine.GetVerticalAlignment() )
+ {
+ // Set the alignment.
+ mImpl->mLayoutEngine.SetVerticalAlignment( alignment );
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
+
+ mImpl->RequestRelayout();
}
}
-ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
+LayoutEngine::VerticalAlignment Controller::GetVerticalAlignment() const
{
- // Whether the text needs to be relaid-out.
- bool requestRelayout = false;
+ return mImpl->mLayoutEngine.GetVerticalAlignment();
+}
- // Whether to retrieve the text and cursor position to be sent to the IMF manager.
- bool retrieveText = false;
- bool retrieveCursor = false;
+void Controller::CalculateVerticalOffset( const Size& controlSize )
+{
+ Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
- switch( imfEvent.eventName )
+ if( fabsf( layoutSize.height ) < Math::MACHINE_EPSILON_1000 )
{
- case ImfManager::COMMIT:
- {
- InsertText( imfEvent.predictiveString, Text::Controller::COMMIT );
- requestRelayout = true;
- retrieveCursor = true;
- break;
- }
- case ImfManager::PREEDIT:
- {
- InsertText( imfEvent.predictiveString, Text::Controller::PRE_EDIT );
- requestRelayout = true;
- retrieveCursor = true;
- break;
- }
- case ImfManager::DELETESURROUNDING:
- {
- const bool textDeleted = RemoveText( imfEvent.cursorOffset,
- imfEvent.numberOfChars,
- DONT_UPDATE_INPUT_STYLE );
-
- if( textDeleted )
- {
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
- !mImpl->IsPlaceholderAvailable() )
- {
- mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
- }
- else
- {
- ShowPlaceholderText();
- }
- mImpl->mEventData->mUpdateCursorPosition = true;
- mImpl->mEventData->mScrollAfterDelete = true;
+ // Get the line height of the default font.
+ layoutSize.height = mImpl->GetDefaultFontLineHeight();
+ }
- requestRelayout = true;
- }
- break;
- }
- case ImfManager::GETSURROUNDING:
+ switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
+ {
+ case LayoutEngine::VERTICAL_ALIGN_TOP:
{
- retrieveText = true;
- retrieveCursor = true;
+ mImpl->mScrollPosition.y = 0.f;
break;
}
- case ImfManager::VOID:
+ case LayoutEngine::VERTICAL_ALIGN_CENTER:
{
- // do nothing
+ mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
break;
}
- } // end switch
-
- if( requestRelayout )
- {
- mImpl->mOperationsPending = ALL_OPERATIONS;
- mImpl->RequestRelayout();
- }
-
- std::string text;
- CharacterIndex cursorPosition = 0u;
- Length numberOfWhiteSpaces = 0u;
-
- if( retrieveCursor )
- {
- numberOfWhiteSpaces = mImpl->GetNumberOfWhiteSpaces( 0u );
-
- cursorPosition = mImpl->GetLogicalCursorPosition();
-
- if( cursorPosition < numberOfWhiteSpaces )
- {
- cursorPosition = 0u;
- }
- else
+ case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
{
- cursorPosition -= numberOfWhiteSpaces;
+ mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
+ break;
}
}
-
- if( retrieveText )
- {
- mImpl->GetText( numberOfWhiteSpaces, text );
- }
-
- ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
-
- if( requestRelayout )
- {
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
- }
-
- return callbackData;
-}
-
-void Controller::PasteClipboardItemEvent()
-{
- // Retrieve the clipboard contents first
- ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
- std::string stringToPaste( notifier.GetContent() );
-
- // Commit the current pre-edit text; the contents of the clipboard should be appended
- mImpl->ResetImfManager();
-
- // Temporary disable hiding clipboard
- mImpl->SetClipboardHideEnable( false );
-
- // Paste
- PasteText( stringToPaste );
-
- mImpl->SetClipboardHideEnable( true );
}
-// protected : Inherit from Text::Decorator::ControllerInterface.
-
-void Controller::GetTargetSize( Vector2& targetSize )
+LayoutEngine& Controller::GetLayoutEngine()
{
- targetSize = mImpl->mVisualModel->mControlSize;
+ return mImpl->mLayoutEngine;
}
-void Controller::AddDecoration( Actor& actor, bool needsClipping )
+View& Controller::GetView()
{
- mImpl->mControlInterface.AddDecoration( actor, needsClipping );
+ return mImpl->mView;
}
-void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
+void Controller::KeyboardFocusGainEvent()
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected DecorationEvent" );
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusGainEvent" );
if( NULL != mImpl->mEventData )
{
- switch( handleType )
+ if( ( EventData::INACTIVE == mImpl->mEventData->mState ) ||
+ ( EventData::INTERRUPTED == mImpl->mEventData->mState ) )
{
- case GRAB_HANDLE:
- {
- Event event( Event::GRAB_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
-
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
- }
- case LEFT_SELECTION_HANDLE:
- {
- Event event( Event::LEFT_SELECTION_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
-
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
- }
- case RIGHT_SELECTION_HANDLE:
- {
- Event event( Event::RIGHT_SELECTION_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
-
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
- }
- case LEFT_SELECTION_HANDLE_MARKER:
- case RIGHT_SELECTION_HANDLE_MARKER:
- {
- // Markers do not move the handles.
- break;
- }
- case HANDLE_TYPE_COUNT:
- {
- DALI_ASSERT_DEBUG( !"Controller::HandleEvent. Unexpected handle type" );
- }
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
+ }
+ mImpl->NotifyImfMultiLineStatus();
+ if( mImpl->IsShowingPlaceholderText() )
+ {
+ // Show alternative placeholder-text when editing
+ ShowPlaceholderText();
}
mImpl->RequestRelayout();
}
}
-// protected : Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
-
-void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
+void Controller::KeyboardFocusLostEvent()
{
- if( NULL == mImpl->mEventData )
- {
- return;
- }
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusLostEvent" );
- switch( button )
+ if( NULL != mImpl->mEventData )
{
- case Toolkit::TextSelectionPopup::CUT:
+ if( EventData::INTERRUPTED != mImpl->mEventData->mState )
{
- mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
- mImpl->mOperationsPending = ALL_OPERATIONS;
+ mImpl->ChangeState( EventData::INACTIVE );
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
- !mImpl->IsPlaceholderAvailable() )
- {
- mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
- }
- else
+ if( !mImpl->IsShowingRealText() )
{
+ // Revert to regular placeholder-text when not editing
ShowPlaceholderText();
}
+ }
+ }
+ mImpl->RequestRelayout();
+}
- mImpl->mEventData->mUpdateCursorPosition = true;
- mImpl->mEventData->mScrollAfterDelete = true;
+bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
+{
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" );
- mImpl->RequestRelayout();
- mImpl->mControlInterface.TextChanged();
- break;
- }
- case Toolkit::TextSelectionPopup::COPY:
- {
- mImpl->SendSelectionToClipboard( false ); // Text not modified
+ bool textChanged( false );
- mImpl->mEventData->mUpdateCursorPosition = true;
+ if( ( NULL != mImpl->mEventData ) &&
+ ( keyEvent.state == KeyEvent::Down ) )
+ {
+ int keyCode = keyEvent.keyCode;
+ const std::string& keyString = keyEvent.keyPressed;
- mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup
- break;
- }
- case Toolkit::TextSelectionPopup::PASTE:
+ // Pre-process to separate modifying events from non-modifying input events.
+ if( Dali::DALI_KEY_ESCAPE == keyCode )
{
- mImpl->RequestGetTextFromClipboard(); // Request clipboard service to retrieve an item
- break;
+ // Escape key is a special case which causes focus loss
+ KeyboardFocusLostEvent();
}
- case Toolkit::TextSelectionPopup::SELECT:
+ else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_UP == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) )
{
- const Vector2& currentCursorPosition = mImpl->mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
-
- if( mImpl->mEventData->mSelectionEnabled )
- {
- // Creates a SELECT event.
- SelectEvent( currentCursorPosition.x, currentCursorPosition.y, false );
- }
- break;
+ Event event( Event::CURSOR_KEY_EVENT );
+ event.p1.mInt = keyCode;
+ mImpl->mEventData->mEventQueue.push_back( event );
}
- case Toolkit::TextSelectionPopup::SELECT_ALL:
+ else if( Dali::DALI_KEY_BACKSPACE == keyCode )
{
- // Creates a SELECT_ALL event
- SelectEvent( 0.f, 0.f, true );
- break;
+ textChanged = BackspaceKeyEvent();
}
- case Toolkit::TextSelectionPopup::CLIPBOARD:
+ else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) )
{
- mImpl->ShowClipboard();
- break;
+ 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
}
- case Toolkit::TextSelectionPopup::NONE:
+ else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
+ IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
{
- // Nothing to do.
- break;
+ 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
+ }
+ else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
+ {
+ // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled
+ // and a character is typed after the type of a upper case latin character.
+
+ // Do nothing.
+ }
+ else
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
+
+ // IMF manager is no longer handling key-events
+ mImpl->ClearPreEditFlag();
+
+ InsertText( keyString, COMMIT );
+ textChanged = true;
+ }
+
+ if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
+ ( mImpl->mEventData->mState != EventData::INACTIVE ) &&
+ ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
+ {
+ // Should not change the state if the key is the shift send by the imf manager.
+ // Otherwise, when the state is SELECTING the text controller can't send the right
+ // surrounding info to the imf.
+ mImpl->ChangeState( EventData::EDITING );
}
+
+ mImpl->RequestRelayout();
+ }
+
+ if( textChanged )
+ {
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
}
-}
-// private : Update.
+ return true;
+}
void Controller::InsertText( const std::string& text, Controller::InsertType type )
{
}
}
-void Controller::PasteText( const std::string& stringToPaste )
-{
- InsertText( stringToPaste, Text::Controller::COMMIT );
- mImpl->ChangeState( EventData::EDITING );
- mImpl->RequestRelayout();
-
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
-}
-
-bool Controller::RemoveText( int cursorOffset,
- int numberOfCharacters,
- UpdateInputStyleType type )
+bool Controller::RemoveSelectedText()
{
- bool removed = false;
+ bool textRemoved( false );
- if( NULL == mImpl->mEventData )
+ if( EventData::SELECTING == mImpl->mEventData->mState )
{
- return removed;
- }
+ std::string removedString;
+ mImpl->RetrieveSelection( removedString, true );
- DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n",
- this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
+ if( !removedString.empty() )
+ {
+ textRemoved = true;
+ mImpl->ChangeState( EventData::EDITING );
+ }
+ }
- if( !mImpl->IsShowingPlaceholderText() )
- {
- // Delete at current cursor position
- Vector<Character>& currentText = mImpl->mLogicalModel->mText;
- CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
+ return textRemoved;
+}
- CharacterIndex cursorIndex = oldCursorIndex;
+void Controller::TapEvent( unsigned int tapCount, float x, float y )
+{
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
- // Validate the cursor position & number of characters
- if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
- {
- cursorIndex = oldCursorIndex + cursorOffset;
- }
+ if( NULL != mImpl->mEventData )
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "TapEvent state:%d \n", mImpl->mEventData->mState );
+ EventData::State state( mImpl->mEventData->mState );
+ bool relayoutNeeded( false ); // to avoid unnecessary relayouts when tapping an empty text-field
- if( ( cursorIndex + numberOfCharacters ) > currentText.Count() )
+ if( mImpl->IsClipboardVisible() )
{
- numberOfCharacters = currentText.Count() - cursorIndex;
+ if( EventData::INACTIVE == state || EventData::EDITING == state)
+ {
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
+ }
+ relayoutNeeded = true;
}
-
- if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
+ else if( 1u == tapCount )
{
- // Mark the paragraphs to be updated.
- mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove += numberOfCharacters;
-
- // Update the input style and remove the text's style before removing the text.
-
- if( UPDATE_INPUT_STYLE == type )
+ if( EventData::EDITING_WITH_POPUP == state || EventData::EDITING_WITH_PASTE_POPUP == state )
{
- // Keep a copy of the current input style.
- InputStyle currentInputStyle;
- currentInputStyle.Copy( mImpl->mEventData->mInputStyle );
-
- // Set first the default input style.
- mImpl->RetrieveDefaultInputStyle( mImpl->mEventData->mInputStyle );
-
- // Update the input style.
- mImpl->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); // If Popup shown hide it here so can be shown again if required.
+ }
- // Compare if the input style has changed.
- const bool hasInputStyleChanged = !currentInputStyle.Equal( mImpl->mEventData->mInputStyle );
+ if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != state ) )
+ {
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
+ relayoutNeeded = true;
+ }
+ else
+ {
+ if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() )
+ {
+ // Hide placeholder text
+ ResetText();
+ }
- if( hasInputStyleChanged )
+ if( EventData::INACTIVE == state )
{
- const InputStyle::Mask styleChangedMask = currentInputStyle.GetInputStyleChangeMask( mImpl->mEventData->mInputStyle );
- // Queue the input style changed signal.
- mImpl->mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
+ mImpl->ChangeState( EventData::EDITING );
+ }
+ else if( !mImpl->IsClipboardEmpty() )
+ {
+ mImpl->ChangeState( EventData::EDITING_WITH_POPUP );
}
+ relayoutNeeded = true;
}
+ }
+ else if( 2u == tapCount )
+ {
+ if( mImpl->mEventData->mSelectionEnabled &&
+ mImpl->IsShowingRealText() )
+ {
+ SelectEvent( x, y, false );
+ }
+ }
+ // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
+ if( relayoutNeeded )
+ {
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = tapCount;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
- // Updates the text style runs by removing characters. Runs with no characters are removed.
- mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
-
- // Remove the characters.
- Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
- Vector<Character>::Iterator last = first + numberOfCharacters;
-
- currentText.Erase( first, last );
-
- // Cursor position retreat
- oldCursorIndex = cursorIndex;
-
- mImpl->mEventData->mScrollAfterDelete = true;
-
- DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", this, numberOfCharacters );
- removed = true;
+ mImpl->RequestRelayout();
}
}
- return removed;
+ // Reset keyboard as tap event has occurred.
+ mImpl->ResetImfManager();
}
-bool Controller::RemoveSelectedText()
+void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
{
- bool textRemoved( false );
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
- if( EventData::SELECTING == mImpl->mEventData->mState )
+ if( NULL != mImpl->mEventData )
{
- std::string removedString;
- mImpl->RetrieveSelection( removedString, true );
+ Event event( Event::PAN_EVENT );
+ event.p1.mInt = state;
+ event.p2.mFloat = displacement.x;
+ event.p3.mFloat = displacement.y;
+ mImpl->mEventData->mEventQueue.push_back( event );
- if( !removedString.empty() )
- {
- textRemoved = true;
- mImpl->ChangeState( EventData::EDITING );
- }
+ mImpl->RequestRelayout();
}
-
- return textRemoved;
}
-// private : Relayout.
-
-bool Controller::DoRelayout( const Size& size,
- OperationsMask operationsRequired,
- Size& layoutSize )
+void Controller::LongPressEvent( Gesture::State state, float x, float y )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
- bool viewUpdated( false );
-
- // Calculate the operations to be done.
- const OperationsMask operations = static_cast<OperationsMask>( mImpl->mOperationsPending & operationsRequired );
-
- const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
- const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
-
- // Get the current layout size.
- layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" );
- if( NO_OPERATION != ( LAYOUT & operations ) )
+ if( ( state == Gesture::Started ) &&
+ ( NULL != mImpl->mEventData ) )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
-
- // Some vectors with data needed to layout and reorder may be void
- // after the first time the text has been laid out.
- // Fill the vectors again.
-
- // Calculate the number of glyphs to layout.
- const Vector<GlyphIndex>& charactersToGlyph = mImpl->mVisualModel->mCharactersToGlyph;
- const Vector<Length>& glyphsPerCharacter = mImpl->mVisualModel->mGlyphsPerCharacter;
- const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
-
- const CharacterIndex lastIndex = startIndex + ( ( requestedNumberOfCharacters > 0u ) ? requestedNumberOfCharacters - 1u : 0u );
- const GlyphIndex startGlyphIndex = mImpl->mTextUpdateInfo.mStartGlyphIndex;
- const Length numberOfGlyphs = ( requestedNumberOfCharacters > 0u ) ? *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex : 0u;
- const Length totalNumberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count();
-
- if( 0u == totalNumberOfGlyphs )
+ if( !mImpl->IsShowingRealText() )
{
- if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
+ Event event( Event::LONG_PRESS_EVENT );
+ event.p1.mInt = state;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ mImpl->RequestRelayout();
+ }
+ else
+ {
+ // The 1st long-press on inactive text-field is treated as tap
+ if( EventData::INACTIVE == mImpl->mEventData->mState )
{
- mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
+ mImpl->ChangeState( EventData::EDITING );
+
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = 1;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+
+ mImpl->RequestRelayout();
}
+ else if( !mImpl->IsClipboardVisible() )
+ {
+ // Reset the imf manger to commit the pre-edit before selecting the text.
+ mImpl->ResetImfManager();
- // Nothing else to do if there is no glyphs.
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
- return true;
+ SelectEvent( x, y, false );
+ }
}
+ }
+}
- const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
- const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
- const Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
- const Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
- const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
- const Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
- const Character* const textBuffer = mImpl->mLogicalModel->mText.Begin();
-
- // Set the layout parameters.
- LayoutParameters layoutParameters( size,
- textBuffer,
- lineBreakInfo.Begin(),
- wordBreakInfo.Begin(),
- ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
- glyphs.Begin(),
- glyphsToCharactersMap.Begin(),
- charactersPerGlyph.Begin(),
- charactersToGlyphBuffer,
- glyphsPerCharacterBuffer,
- totalNumberOfGlyphs );
+void Controller::SelectEvent( float x, float y, bool selectAll )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SelectEvent\n" );
- // Resize the vector of positions to have the same size than the vector of glyphs.
- Vector<Vector2>& glyphPositions = mImpl->mVisualModel->mGlyphPositions;
- glyphPositions.Resize( totalNumberOfGlyphs );
+ if( NULL != mImpl->mEventData )
+ {
+ if( selectAll )
+ {
+ Event event( Event::SELECT_ALL );
+ mImpl->mEventData->mEventQueue.push_back( event );
+ }
+ else
+ {
+ Event event( Event::SELECT );
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ }
- // Whether the last character is a new paragraph character.
- mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mLogicalModel->mText.Count() - 1u ) ) );
- layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
+ mImpl->RequestRelayout();
+ }
+}
- // The initial glyph and the number of glyphs to layout.
- layoutParameters.startGlyphIndex = startGlyphIndex;
- layoutParameters.numberOfGlyphs = numberOfGlyphs;
- layoutParameters.startLineIndex = mImpl->mTextUpdateInfo.mStartLineIndex;
- layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
+void Controller::GetTargetSize( Vector2& targetSize )
+{
+ targetSize = mImpl->mVisualModel->mControlSize;
+}
- // Update the visual model.
- Size newLayoutSize;
- viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
- glyphPositions,
- mImpl->mVisualModel->mLines,
- newLayoutSize );
+void Controller::AddDecoration( Actor& actor, bool needsClipping )
+{
+ mImpl->mControlInterface.AddDecoration( actor, needsClipping );
+}
- viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
+void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
+{
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected DecorationEvent" );
- if( viewUpdated )
+ if( NULL != mImpl->mEventData )
+ {
+ switch( handleType )
{
- layoutSize = newLayoutSize;
+ case GRAB_HANDLE:
+ {
+ Event event( Event::GRAB_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
- if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
+ }
+ case LEFT_SELECTION_HANDLE:
{
- mImpl->mAutoScrollDirectionRTL = false;
+ Event event( Event::LEFT_SELECTION_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
}
+ case RIGHT_SELECTION_HANDLE:
+ {
+ Event event( Event::RIGHT_SELECTION_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
- // Reorder the lines
- if( NO_OPERATION != ( REORDER & operations ) )
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
+ }
+ case LEFT_SELECTION_HANDLE_MARKER:
+ case RIGHT_SELECTION_HANDLE_MARKER:
{
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mLogicalModel->mBidirectionalParagraphInfo;
- Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mLogicalModel->mBidirectionalLineInfo;
+ // Markers do not move the handles.
+ break;
+ }
+ case HANDLE_TYPE_COUNT:
+ {
+ DALI_ASSERT_DEBUG( !"Controller::HandleEvent. Unexpected handle type" );
+ }
+ }
- // Check first if there are paragraphs with bidirectional info.
- if( 0u != bidirectionalInfo.Count() )
- {
- // Get the lines
- const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
+ mImpl->RequestRelayout();
+ }
+}
- // Reorder the lines.
- bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
- ReorderLines( bidirectionalInfo,
- startIndex,
- requestedNumberOfCharacters,
- mImpl->mVisualModel->mLines,
- bidirectionalLineInfo );
+void Controller::PasteText( const std::string& stringToPaste )
+{
+ InsertText( stringToPaste, Text::Controller::COMMIT );
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->RequestRelayout();
- // Set the bidirectional info per line into the layout parameters.
- layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
- layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
+}
- // Re-layout the text. Reorder those lines with right to left characters.
- mImpl->mLayoutEngine.ReLayoutRightToLeftLines( layoutParameters,
- startIndex,
- requestedNumberOfCharacters,
- glyphPositions );
+void Controller::PasteClipboardItemEvent()
+{
+ // Retrieve the clipboard contents first
+ ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+ std::string stringToPaste( notifier.GetContent() );
- if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
- {
- const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
- if ( firstline )
- {
- mImpl->mAutoScrollDirectionRTL = firstline->direction;
- }
- }
- }
- } // REORDER
+ // Commit the current pre-edit text; the contents of the clipboard should be appended
+ mImpl->ResetImfManager();
- // Sets the layout size.
- if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
- {
- mImpl->mVisualModel->SetLayoutSize( layoutSize );
- }
- } // view updated
+ // Temporary disable hiding clipboard
+ mImpl->SetClipboardHideEnable( false );
- // Store the size used to layout the text.
- mImpl->mVisualModel->mControlSize = size;
+ // Paste
+ PasteText( stringToPaste );
+
+ mImpl->SetClipboardHideEnable( true );
+}
+
+void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
+{
+ if( NULL == mImpl->mEventData )
+ {
+ return;
}
- if( NO_OPERATION != ( ALIGN & operations ) )
+ switch( button )
{
- // The laid-out lines.
- Vector<LineRun>& lines = mImpl->mVisualModel->mLines;
+ case Toolkit::TextSelectionPopup::CUT:
+ {
+ mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
+ mImpl->mOperationsPending = ALL_OPERATIONS;
- mImpl->mLayoutEngine.Align( size,
- startIndex,
- requestedNumberOfCharacters,
- lines );
+ if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ !mImpl->IsPlaceholderAvailable() )
+ {
+ mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+ }
+ else
+ {
+ ShowPlaceholderText();
+ }
- viewUpdated = true;
- }
-#if defined(DEBUG_ENABLED)
- std::string currentText;
- GetText( currentText );
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::DoRelayout [%p] mImpl->mAutoScrollDirectionRTL[%s] [%s]\n", this, (mImpl->mAutoScrollDirectionRTL)?"true":"false", currentText.c_str() );
-#endif
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
- return viewUpdated;
-}
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ mImpl->mEventData->mScrollAfterDelete = true;
+
+ mImpl->RequestRelayout();
+ mImpl->mControlInterface.TextChanged();
+ break;
+ }
+ case Toolkit::TextSelectionPopup::COPY:
+ {
+ mImpl->SendSelectionToClipboard( false ); // Text not modified
-void Controller::CalculateVerticalOffset( const Size& controlSize )
-{
- Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ mImpl->mEventData->mUpdateCursorPosition = true;
- if( fabsf( layoutSize.height ) < Math::MACHINE_EPSILON_1000 )
- {
- // Get the line height of the default font.
- layoutSize.height = mImpl->GetDefaultFontLineHeight();
- }
+ mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup
+ break;
+ }
+ case Toolkit::TextSelectionPopup::PASTE:
+ {
+ mImpl->RequestGetTextFromClipboard(); // Request clipboard service to retrieve an item
+ break;
+ }
+ case Toolkit::TextSelectionPopup::SELECT:
+ {
+ const Vector2& currentCursorPosition = mImpl->mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
- switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
- {
- case LayoutEngine::VERTICAL_ALIGN_TOP:
+ if( mImpl->mEventData->mSelectionEnabled )
+ {
+ // Creates a SELECT event.
+ SelectEvent( currentCursorPosition.x, currentCursorPosition.y, false );
+ }
+ break;
+ }
+ case Toolkit::TextSelectionPopup::SELECT_ALL:
{
- mImpl->mScrollPosition.y = 0.f;
+ // Creates a SELECT_ALL event
+ SelectEvent( 0.f, 0.f, true );
break;
}
- case LayoutEngine::VERTICAL_ALIGN_CENTER:
+ case Toolkit::TextSelectionPopup::CLIPBOARD:
{
- mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
+ mImpl->ShowClipboard();
break;
}
- case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
+ case Toolkit::TextSelectionPopup::NONE:
{
- mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
+ // Nothing to do.
break;
}
}
}
-// private : Events.
-
-void Controller::ProcessModifyEvents()
+ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
{
- Vector<ModifyEvent>& events = mImpl->mModifyEvents;
+ // Whether the text needs to be relaid-out.
+ bool requestRelayout = false;
- if( 0u == events.Count() )
- {
- // Nothing to do.
- return;
- }
+ // Whether to retrieve the text and cursor position to be sent to the IMF manager.
+ bool retrieveText = false;
+ bool retrieveCursor = false;
- for( Vector<ModifyEvent>::ConstIterator it = events.Begin(),
- endIt = events.End();
- it != endIt;
- ++it )
+ switch( imfEvent.eventName )
{
- const ModifyEvent& event = *it;
-
- if( ModifyEvent::TEXT_REPLACED == event.type )
+ case ImfManager::COMMIT:
{
- // A (single) replace event should come first, otherwise we wasted time processing NOOP events
- DALI_ASSERT_DEBUG( it == events.Begin() && "Unexpected TEXT_REPLACED event" );
-
- TextReplacedEvent();
+ InsertText( imfEvent.predictiveString, Text::Controller::COMMIT );
+ requestRelayout = true;
+ retrieveCursor = true;
+ break;
}
- else if( ModifyEvent::TEXT_INSERTED == event.type )
+ case ImfManager::PREEDIT:
{
- TextInsertedEvent();
+ InsertText( imfEvent.predictiveString, Text::Controller::PRE_EDIT );
+ requestRelayout = true;
+ retrieveCursor = true;
+ break;
}
- else if( ModifyEvent::TEXT_DELETED == event.type )
+ case ImfManager::DELETESURROUNDING:
{
- // Placeholder-text cannot be deleted
- if( !mImpl->IsShowingPlaceholderText() )
+ const bool textDeleted = RemoveText( imfEvent.cursorOffset,
+ imfEvent.numberOfChars,
+ DONT_UPDATE_INPUT_STYLE );
+
+ if( textDeleted )
{
- TextDeletedEvent();
+ if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ !mImpl->IsPlaceholderAvailable() )
+ {
+ mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+ }
+ else
+ {
+ ShowPlaceholderText();
+ }
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ mImpl->mEventData->mScrollAfterDelete = true;
+
+ requestRelayout = true;
}
+ break;
}
- }
+ case ImfManager::GETSURROUNDING:
+ {
+ retrieveText = true;
+ retrieveCursor = true;
+ break;
+ }
+ case ImfManager::VOID:
+ {
+ // do nothing
+ break;
+ }
+ } // end switch
- if( NULL != mImpl->mEventData )
+ if( requestRelayout )
{
- // When the text is being modified, delay cursor blinking
- mImpl->mEventData->mDecorator->DelayCursorBlink();
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+ mImpl->RequestRelayout();
}
- // Discard temporary text
- events.Clear();
-}
+ std::string text;
+ CharacterIndex cursorPosition = 0u;
+ Length numberOfWhiteSpaces = 0u;
-void Controller::TextReplacedEvent()
-{
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
+ if( retrieveCursor )
+ {
+ numberOfWhiteSpaces = mImpl->GetNumberOfWhiteSpaces( 0u );
- // Apply modifications to the model
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
+ cursorPosition = mImpl->GetLogicalCursorPosition();
-void Controller::TextInsertedEvent()
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextInsertedEvent" );
+ if( cursorPosition < numberOfWhiteSpaces )
+ {
+ cursorPosition = 0u;
+ }
+ else
+ {
+ cursorPosition -= numberOfWhiteSpaces;
+ }
+ }
- if( NULL == mImpl->mEventData )
+ if( retrieveText )
{
- return;
+ mImpl->GetText( numberOfWhiteSpaces, text );
}
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
-
- // Apply modifications to the model; TODO - Optimize this
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
-
-void Controller::TextDeletedEvent()
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextDeletedEvent" );
+ ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
- if( NULL == mImpl->mEventData )
+ if( requestRelayout )
{
- return;
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
}
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
-
- // Apply modifications to the model; TODO - Optimize this
- mImpl->mOperationsPending = ALL_OPERATIONS;
+ return callbackData;
}
-void Controller::SelectEvent( float x, float y, bool selectAll )
+Controller::~Controller()
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SelectEvent\n" );
-
- if( NULL != mImpl->mEventData )
- {
- if( selectAll )
- {
- Event event( Event::SELECT_ALL );
- mImpl->mEventData->mEventQueue.push_back( event );
- }
- else
- {
- Event event( Event::SELECT );
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
- }
-
- mImpl->RequestRelayout();
- }
+ delete mImpl;
}
bool Controller::BackspaceKeyEvent()
return removed;
}
-// private : Helpers.
-
-void Controller::ResetText()
-{
- // Reset buffers.
- mImpl->mLogicalModel->mText.Clear();
-
- // We have cleared everything including the placeholder-text
- mImpl->PlaceholderCleared();
-
- mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = 0u;
-
- // Clear any previous text.
- mImpl->mTextUpdateInfo.mClearAll = true;
-
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
-
- // Apply modifications to the model
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
-
void Controller::ShowPlaceholderText()
{
if( mImpl->IsPlaceholderAvailable() )
mImpl->mLogicalModel->ClearFontDescriptionRuns();
}
-void Controller::ResetCursorPosition( CharacterIndex cursorIndex )
-{
- // Reset the cursor position
- if( NULL != mImpl->mEventData )
- {
- mImpl->mEventData->mPrimaryCursorPosition = cursorIndex;
-
- // Update the cursor if it's in editing mode.
- if( EventData::IsEditingState( mImpl->mEventData->mState ) )
- {
- mImpl->mEventData->mUpdateCursorPosition = true;
- }
- }
-}
-
-void Controller::ResetScrollPosition()
-{
- if( NULL != mImpl->mEventData )
- {
- // Reset the scroll position.
- mImpl->mScrollPosition = Vector2::ZERO;
- mImpl->mEventData->mScrollAfterUpdatePosition = true;
- }
-}
-
-// private : Private contructors & copy operator.
-
Controller::Controller( ControlInterface& controlInterface )
: mImpl( NULL )
{
mImpl = new Controller::Impl( controlInterface );
}
-// The copy constructor and operator are left unimplemented.
-
-// protected : Destructor.
-
-Controller::~Controller()
-{
- delete mImpl;
-}
-
} // namespace Text
} // namespace Toolkit
typedef Dali::Toolkit::Text::ControlInterface ControlInterface;
/**
+ * @brief Different placeholder-text can be shown when the control is active/inactive.
+ */
+enum PlaceholderType
+{
+ PLACEHOLDER_TYPE_ACTIVE,
+ PLACEHOLDER_TYPE_INACTIVE,
+};
+
+/**
* @brief A Text Controller is used by UI Controls which display text.
*
* It manipulates the Logical & Visual text models on behalf of the UI Controls.
*/
class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface
{
-public: // Enumerated types.
+public:
/**
* @brief Text related operations to be done in the relayout process.
DONT_UPDATE_INPUT_STYLE
};
- /**
- * @brief Used to specify what has been updated after the Relayout() method has been called.
- */
enum UpdateTextType
{
- NONE_UPDATED = 0x0, ///< Nothing has been updated.
- MODEL_UPDATED = 0x1, ///< The text's model has been updated.
- DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
+ NONE_UPDATED = 0x0,
+ MODEL_UPDATED = 0x1,
+ DECORATOR_UPDATED = 0x2
};
/**
- * @brief Different placeholder-text can be shown when the control is active/inactive.
- */
- enum PlaceholderType
- {
- PLACEHOLDER_TYPE_ACTIVE,
- PLACEHOLDER_TYPE_INACTIVE,
- };
-
-public: // Constructor.
-
- /**
* @brief Create a new instance of a Controller.
*
* @param[in] controlInterface An interface used to request a text relayout.
*/
static ControllerPtr New( ControlInterface& controlInterface );
-public: // Configure the text controller.
-
/**
* @brief Called to enable text input.
*
bool IsSmoothHandlePanEnabled() const;
/**
- * @brief Sets the maximum number of characters that can be inserted into the TextModel
- *
- * @param[in] maxCharacters maximum number of characters to be accepted
- */
- void SetMaximumNumberOfCharacters( Length maxCharacters );
-
- /**
- * @brief Sets the maximum number of characters that can be inserted into the TextModel
- *
- * @param[in] maxCharacters maximum number of characters to be accepted
- */
- int GetMaximumNumberOfCharacters();
-
- /**
- * @brief Called to enable/disable cursor blink.
- *
- * @note Only editable controls should calls this.
- * @param[in] enabled Whether the cursor should blink or not.
- */
- void SetEnableCursorBlink( bool enable );
-
- /**
- * @brief Query whether cursor blink is enabled.
- *
- * @return Whether the cursor should blink or not.
- */
- bool GetEnableCursorBlink() const;
-
- /**
- * @brief Whether to enable the multi-line layout.
- *
- * @param[in] enable \e true enables the multi-line (by default)
- */
- void SetMultiLineEnabled( bool enable );
-
- /**
- * @return Whether the multi-line layout is enabled.
- */
- bool IsMultiLineEnabled() const;
-
- /**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
- */
- void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
-
- /**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
- */
- LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
-
- /**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
- */
- void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
-
- /**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
- */
- LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
-
-public: // Update.
-
- /**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
void GetText( std::string& text ) const;
/**
+ * @brief Remove a given number of characters
+ *
+ * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
+ * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
+ * style when pre-edit text is removed.
+ *
+ * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
+ * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
+ * @param[in] type Whether to update the input style.
+ * @return True if the remove was successful.
+ */
+ bool RemoveText( int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type );
+
+ /**
* @brief Replaces any placeholder text previously set.
*
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
void GetPlaceholderText( PlaceholderType type, std::string& text ) const;
/**
- * @ brief Update the text after a font change
- * @param[in] newDefaultFont The new font to change to
+ * @brief Sets the maximum number of characters that can be inserted into the TextModel
+ *
+ * @param[in] maxCharacters maximum number of characters to be accepted
*/
- void UpdateAfterFontChange( const std::string& newDefaultFont );
+ void SetMaximumNumberOfCharacters( Length maxCharacters );
-public: // Default style & Input style
+ /**
+ * @brief Sets the maximum number of characters that can be inserted into the TextModel
+ *
+ * @param[in] maxCharacters maximum number of characters to be accepted
+ */
+ int GetMaximumNumberOfCharacters();
/**
* @brief Set the default font family.
float GetDefaultPointSize() const;
/**
+ * @ brief Update the text after a font change
+ * @param[in] newDefaultFont The new font to change to
+ */
+ void UpdateAfterFontChange( const std::string& newDefaultFont );
+
+ /**
* @brief Set the text color
*
* @param textColor The text color
*/
const std::string& GetInputOutlineProperties() const;
-public: // Queries & retrieves.
-
/**
- * @brief Return the layout engine.
+ * @brief Called to enable/disable cursor blink.
*
- * @return A reference to the layout engine.
+ * @note Only editable controls should calls this.
+ * @param[in] enabled Whether the cursor should blink or not.
*/
- LayoutEngine& GetLayoutEngine();
+ void SetEnableCursorBlink( bool enable );
/**
- * @brief Return a view of the text.
+ * @brief Query whether cursor blink is enabled.
*
- * @return A reference to the view.
+ * @return Whether the cursor should blink or not.
*/
- View& GetView();
+ bool GetEnableCursorBlink() const;
/**
* @brief Query the current scroll position; the UI control is responsible for moving actors to this position.
*/
float GetHeightForWidth( float width );
-public: // Relayout.
-
/**
* @brief Triggers a relayout which updates View (if necessary).
*
*/
UpdateTextType Relayout( const Size& size );
-public: // Input style change signals.
+ /**
+ * @brief Process queued events which modify the model.
+ */
+ void ProcessModifyEvents();
/**
* @return Whether the queue of input style changed signals is empty.
*/
void ProcessInputStyleChangedSignals();
-public: // Text-input Event Queuing.
+ /**
+ * @brief Used to remove placeholder text.
+ */
+ void ResetText();
/**
- * @brief Called by editable UI controls when keyboard focus is gained.
+ * @brief Used to reset the cursor position after setting a new text.
+ *
+ * @param[in] cursorIndex Where to place the cursor.
*/
- void KeyboardFocusGainEvent();
+ void ResetCursorPosition( CharacterIndex cursorIndex );
/**
- * @brief Called by editable UI controls when focus is lost.
+ * @brief Used to reset the scroll position after setting a new text.
*/
- void KeyboardFocusLostEvent();
+ void ResetScrollPosition();
/**
- * @brief Called by editable UI controls when key events are received.
- *
- * @param[in] event The key event.
- * @param[in] type Used to distinguish between regular key events and IMF events.
+ * @brief Used to process an event queued from SetText()
*/
- bool KeyEvent( const Dali::KeyEvent& event );
+ void TextReplacedEvent();
/**
- * @brief Called by editable UI controls when a tap gesture occurs.
- * @param[in] tapCount The number of taps.
- * @param[in] x The x position relative to the top-left of the parent control.
- * @param[in] y The y position relative to the top-left of the parent control.
+ * @brief Used to process an event queued from key events etc.
*/
- void TapEvent( unsigned int tapCount, float x, float y );
+ void TextInsertedEvent();
/**
- * @brief Called by editable UI controls when a pan gesture occurs.
- *
- * @param[in] state The state of the gesture.
- * @param[in] displacement This distance panned since the last pan gesture.
+ * @brief Used to process an event queued from backspace key etc.
*/
- void PanEvent( Gesture::State state, const Vector2& displacement );
+ void TextDeletedEvent();
/**
- * @brief Called by editable UI controls when a long press gesture occurs.
+ * @brief Lays-out the text.
*
- * @param[in] state The state of the gesture.
- * @param[in] x The x position relative to the top-left of the parent control.
- * @param[in] y The y position relative to the top-left of the parent control.
+ * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
+ *
+ * @param[in] size A the size of a bounding box to layout text within.
+ * @param[in] operations The layout operations which need to be done.
+ * @param[out] layoutSize The size of the laid-out text.
*/
- void LongPressEvent( Gesture::State state, float x, float y );
+ bool DoRelayout( const Size& size,
+ OperationsMask operations,
+ Size& layoutSize );
/**
- * @brief Event received from IMF manager
+ * @brief Whether to enable the multi-line layout.
*
- * @param[in] imfManager The IMF manager.
- * @param[in] imfEvent The event received.
- * @return A data struture indicating if update is needed, cursor position and current text.
+ * @param[in] enable \e true enables the multi-line (by default)
*/
- ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
+ void SetMultiLineEnabled( bool enable );
/**
- * @brief Event from Clipboard notifying an Item has been selected for pasting
+ * @return Whether the multi-line layout is enabled.
*/
- void PasteClipboardItemEvent();
-
-protected: // Inherit from Text::Decorator::ControllerInterface.
+ bool IsMultiLineEnabled() const;
/**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
*/
- virtual void GetTargetSize( Vector2& targetSize );
+ void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
/**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
*/
- virtual void AddDecoration( Actor& actor, bool needsClipping );
+ LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
/**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
*/
- virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
-
-protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
+ void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
/**
- * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
*/
- virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
-
-private: // Update.
+ LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
/**
- * @brief Called by editable UI controls when key events are received.
+ * @brief Calulates the vertical offset to align the text inside the bounding box.
*
- * @param[in] text The text to insert.
- * @param[in] type Used to distinguish between regular key events and IMF events.
+ * @param[in] size The size of the bounding box.
*/
- void InsertText( const std::string& text, InsertType type );
+ void CalculateVerticalOffset( const Size& size );
/**
- * @brief Paste given string into Text model
- * @param[in] stringToPaste this string will be inserted into the text model
+ * @brief Return the layout engine.
+ *
+ * @return A reference to the layout engine.
*/
- void PasteText( const std::string& stringToPaste );
+ LayoutEngine& GetLayoutEngine();
/**
- * @brief Remove a given number of characters
- *
- * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
- * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
- * style when pre-edit text is removed.
+ * @brief Return a view of the text.
*
- * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
- * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
- * @param[in] type Whether to update the input style.
- * @return True if the remove was successful.
+ * @return A reference to the view.
*/
- bool RemoveText( int cursorOffset,
- int numberOfCharacters,
- UpdateInputStyleType type );
+ View& GetView();
+
+ // Text-input Event Queuing
/**
- * @brief Checks if text is selected and if so removes it.
- * @return true if text was removed
+ * @brief Called by editable UI controls when keyboard focus is gained.
*/
- bool RemoveSelectedText();
+ void KeyboardFocusGainEvent();
-private: // Relayout.
+ /**
+ * @brief Called by editable UI controls when focus is lost.
+ */
+ void KeyboardFocusLostEvent();
/**
- * @brief Lays-out the text.
- *
- * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
+ * @brief Called by editable UI controls when key events are received.
*
- * @param[in] size A the size of a bounding box to layout text within.
- * @param[in] operations The layout operations which need to be done.
- * @param[out] layoutSize The size of the laid-out text.
+ * @param[in] event The key event.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
*/
- bool DoRelayout( const Size& size,
- OperationsMask operations,
- Size& layoutSize );
+ bool KeyEvent( const Dali::KeyEvent& event );
/**
- * @brief Calulates the vertical offset to align the text inside the bounding box.
+ * @brief Called by editable UI controls when key events are received.
*
- * @param[in] size The size of the bounding box.
+ * @param[in] text The text to insert.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
*/
- void CalculateVerticalOffset( const Size& size );
-
-private: // Events.
+ void InsertText( const std::string& text, InsertType type );
/**
- * @brief Process queued events which modify the model.
+ * @brief Checks if text is selected and if so removes it.
+ * @return true if text was removed
*/
- void ProcessModifyEvents();
+ bool RemoveSelectedText();
/**
- * @brief Used to process an event queued from SetText()
+ * @brief Called by editable UI controls when a tap gesture occurs.
+ * @param[in] tapCount The number of taps.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
*/
- void TextReplacedEvent();
+ void TapEvent( unsigned int tapCount, float x, float y );
/**
- * @brief Used to process an event queued from key events etc.
+ * @brief Called by editable UI controls when a pan gesture occurs.
+ *
+ * @param[in] state The state of the gesture.
+ * @param[in] displacement This distance panned since the last pan gesture.
*/
- void TextInsertedEvent();
+ void PanEvent( Gesture::State state, const Vector2& displacement );
/**
- * @brief Used to process an event queued from backspace key etc.
+ * @brief Called by editable UI controls when a long press gesture occurs.
+ *
+ * @param[in] state The state of the gesture.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
*/
- void TextDeletedEvent();
+ void LongPressEvent( Gesture::State state, float x, float y );
/**
* @brief Creates a selection event.
void SelectEvent( float x, float y, bool selectAll );
/**
- * @brief Helper to KeyEvent() to handle the backspace case.
+ * @brief Event received from IMF manager
*
- * @return True if a character was deleted.
+ * @param[in] imfManager The IMF manager.
+ * @param[in] imfEvent The event received.
+ * @return A data struture indicating if update is needed, cursor position and current text.
*/
- bool BackspaceKeyEvent();
+ ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
-private: // Helpers.
+ /**
+ * @brief Paste given string into Text model
+ * @param[in] stringToPaste this string will be inserted into the text model
+ */
+ void PasteText( const std::string& stringToPaste );
/**
- * @brief Used to remove the text included the placeholder text.
+ * @brief Event from Clipboard notifying an Item has been selected for pasting
*/
- void ResetText();
+ void PasteClipboardItemEvent();
/**
- * @brief Helper to show the place holder text..
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
*/
- void ShowPlaceholderText();
+ virtual void GetTargetSize( Vector2& targetSize );
/**
- * @brief Helper to clear font-specific data (only).
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
*/
- void ClearFontData();
+ virtual void AddDecoration( Actor& actor, bool needsClipping );
/**
- * @brief Helper to clear text's style data.
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
*/
- void ClearStyleData();
+ virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
/**
- * @brief Used to reset the cursor position after setting a new text.
+ * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
+ */
+ virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~Controller();
+
+private:
+
+ /**
+ * @brief Helper to KeyEvent() to handle the backspace case.
*
- * @param[in] cursorIndex Where to place the cursor.
+ * @return True if a character was deleted.
*/
- void ResetCursorPosition( CharacterIndex cursorIndex );
+ bool BackspaceKeyEvent();
/**
- * @brief Used to reset the scroll position after setting a new text.
+ * @brief Helper to clear font-specific data.
*/
- void ResetScrollPosition();
+ void ShowPlaceholderText();
+
+ /**
+ * @brief Helper to clear font-specific data (only).
+ */
+ void ClearFontData();
-private: // Private contructors & copy operator.
+ /**
+ * @brief Helper to clear text's style data.
+ */
+ void ClearStyleData();
/**
* @brief Private constructor.
// Undefined
Controller& operator=( const Controller& handle );
-protected: // Destructor.
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- virtual ~Controller();
-
private:
struct Impl;