{
INACTIVE,
SELECTING,
- EDITING
+ EDITING,
+ EDITING_WITH_POPUP
};
TextInput( LogicalModelPtr logicalModel,
mSecondaryCursorPosition( 0u ),
mDecoratorUpdated( false ),
mCursorBlinkEnabled( true ),
- mGrabHandleEnabled( false ),
- mGrabHandlePopupEnabled( false ),
+ mGrabHandleEnabled( true ),
+ mGrabHandlePopupEnabled( true ),
mSelectionEnabled( false ),
mHorizontalScrollingEnabled( true ),
mVerticalScrollingEnabled( false ),
GetClosestCursorPosition( mPrimaryCursorPosition, xPosition, yPosition, height );
mDecorator->SetPosition( PRIMARY_CURSOR, xPosition, yPosition, height );
- mDecorator->HidePopup();
+ //mDecorator->HidePopup();
+ ChangeState ( EDITING );
mDecoratorUpdated = true;
}
else if ( mGrabHandlePopupEnabled &&
GRAB_HANDLE_RELEASED == state )
{
- mDecorator->ShowPopup();
+ //mDecorator->ShowPopup();
+ ChangeState ( EDITING_WITH_POPUP );
+ mDecoratorUpdated = true;
}
}
mDecorator->StopCursorBlink();
mDecorator->SetGrabHandleActive( false );
mDecorator->SetSelectionActive( false );
- mDecorator->HidePopup();
+ mDecorator->SetPopupActive( false );
mDecoratorUpdated = true;
}
else if ( SELECTING == mState )
{
mDecorator->SetGrabHandleActive( true );
}
+ if( mGrabHandlePopupEnabled )
+ {
+ mDecorator->SetPopupActive( false );
+ }
+ mDecorator->SetSelectionActive( false );
+ mDecoratorUpdated = true;
+ }
+ else if( EDITING_WITH_POPUP == mState )
+ {
+ mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
+ if( mCursorBlinkEnabled )
+ {
+ mDecorator->StartCursorBlink();
+ }
+ if( mGrabHandleEnabled )
+ {
+ mDecorator->SetGrabHandleActive( true );
+ }
+ if( mGrabHandlePopupEnabled )
+ {
+ mDecorator->SetPopupActive( true );
+ }
mDecorator->SetSelectionActive( false );
mDecoratorUpdated = true;
}
totalHeight += lines[lineIndex].lineSize.height;
if( y < totalHeight )
{
- break;
+ return lineIndex;
}
}
- return lineIndex;
+ return lineIndex-1;
}
void GetClosestCursorPosition( CharacterIndex& logical, float& visualX, float& visualY, float& height )
float visualX( 0.0f );
float visualY( 0.0f );
- LineIndex lineIndex( 0u );
+ float height( 0.0f );
const Vector<LineRun>& lineRuns = mVisualModel->mLines;
if( cursorGlyph > 0 )
visualX += mVisualModel->mGlyphs[ cursorGlyph ].width;
// Find the line height
- for( GlyphIndex lastGlyph = 0; lineIndex < lineRuns.Count(); ++lineIndex )
+ GlyphIndex lastGlyph( 0 );
+ for( LineIndex lineIndex = 0u; lineIndex < lineRuns.Count(); ++lineIndex )
{
lastGlyph = (lineRuns[lineIndex].glyphIndex + lineRuns[lineIndex].numberOfGlyphs);
if( cursorGlyph < lastGlyph )
{
+ height = lineRuns[lineIndex].lineSize.height;
break;
}
}
}
- mDecorator->SetPosition( PRIMARY_CURSOR, visualX, visualY, lineRuns[lineIndex].lineSize.height );
+ mDecorator->SetPosition( PRIMARY_CURSOR, visualX, visualY, height );
mDecoratorUpdated = true;
}
mImpl->mModifyEvents.push_back( event );
}
+ mImpl->mTextInput->ChangeState( TextInput::EDITING ); // todo Confirm this is the best place to change the state of
+
RequestRelayout();
}