return PlaceholderHandler::GetPlaceholderTextFontSlant(*this);
}
+void Controller::SetFontSizeScale( float scale )
+{
+ mImpl->mFontSizeScale = scale;
+
+ if( mImpl->mEventData )
+ {
+ // Update the cursor position if it's in editing mode
+ if( EventData::IsEditingState( mImpl->mEventData->mState ) )
+ {
+ mImpl->mEventData->mDecoratorUpdated = true;
+ mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font size is updated.
+ }
+ }
+
+ // Clear the font-specific data
+ ClearFontData();
+
+ mImpl->RequestRelayout();
+}
+
+float Controller::GetFontSizeScale() const
+{
+ if( nullptr != mImpl->mFontDefaults )
+ {
+ return mImpl->mFontSizeScale;
+ }
+
+ return 1.f;
+}
+
void Controller::SetDefaultFontSize( float fontSize, FontSizeType type )
{
if( NULL == mImpl->mFontDefaults )
return mImpl->GetTextSelectionRange();
}
+CharacterIndex Controller::GetPrimaryCursorPosition() const
+{
+ return mImpl->GetPrimaryCursorPosition();
+}
+
+bool Controller::SetPrimaryCursorPosition( CharacterIndex index )
+{
+ if( mImpl->mEventData )
+ {
+ mImpl->mEventData->mCheckScrollAmount = true;
+ mImpl->mEventData->mIsLeftHandleSelected = true;
+ mImpl->mEventData->mIsRightHandleSelected = true;
+ mImpl->mEventData->mCheckScrollAmount = true;
+ if( mImpl->SetPrimaryCursorPosition(index) )
+ {
+ KeyboardFocusGainEvent();
+ return true;
+ }
+ }
+ return false;
+}
+
void Controller::SelectWholeText()
{
SelectEvent( 0.f, 0.f, SelectionType::ALL );
}
}
+void Controller::ScrollBy( Vector2 scroll )
+{
+ if( mImpl->mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0))
+ {
+ const Vector2& layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
+ const Vector2 currentScroll = mImpl->mModel->mScrollPosition;
+
+ scroll.x = -scroll.x;
+ scroll.y = -scroll.y;
+
+ if( fabs(scroll.x) > Math::MACHINE_EPSILON_0 )
+ {
+ mImpl->mModel->mScrollPosition.x += scroll.x;
+ mImpl->ClampHorizontalScroll( layoutSize );
+ }
+
+ if( fabs(scroll.y) > Math::MACHINE_EPSILON_0 )
+ {
+ mImpl->mModel->mScrollPosition.y += scroll.y;
+ mImpl->ClampVerticalScroll( layoutSize );
+ }
+
+ if (mImpl->mModel->mScrollPosition != currentScroll)
+ {
+ mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mModel->mScrollPosition - currentScroll );
+ mImpl->RequestRelayout();
+ }
+ }
+}
+
+float Controller::GetHorizontalScrollPosition()
+{
+ if( mImpl->mEventData )
+ {
+ //scroll values are negative internally so we convert them to positive numbers
+ return -mImpl->mModel->mScrollPosition.x;
+ }
+ return 0;
+}
+
+float Controller::GetVerticalScrollPosition()
+{
+ if( mImpl->mEventData )
+ {
+ //scroll values are negative internally so we convert them to positive numbers
+ return -mImpl->mModel->mScrollPosition.y;
+ }
+ return 0;
+}
+
void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
{
EventHandler::DecorationEvent(*this, handleType, state, x, y);
if( addFontSizeRun )
{
- fontDescriptionRun.size = static_cast<PointSize26Dot6>( mImpl->mEventData->mInputStyle.size * 64.f );
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>( mImpl->mEventData->mInputStyle.size * mImpl->mFontSizeScale * 64.f );
fontDescriptionRun.sizeDefined = true;
}
Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
Vector<Character>::Iterator last = first + numberOfCharacters;
- currentText.Erase( first, last );
-
if( NULL != mImpl->mEditableControlInterface )
{
std::string utf8;
mImpl->mEditableControlInterface->TextDeleted( cursorIndex, numberOfCharacters, utf8 );
}
+ currentText.Erase( first, last );
+
// Cursor position retreat
oldCursorIndex = cursorIndex;