return;
}
- const int state = event.p1.mInt;
-
+ const GestureState state = static_cast<GestureState>( event.p1.mInt );
switch( state )
{
- case Gesture::Started:
+ case GestureState::STARTED:
{
// Will remove the cursor, handles or text's popup, ...
ChangeState( EventData::TEXT_PANNING );
break;
}
- case Gesture::Continuing:
+ case GestureState::CONTINUING:
{
const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
const Vector2 currentScroll = mModel->mScrollPosition;
mEventData->mDecorator->UpdatePositions( mModel->mScrollPosition - currentScroll );
break;
}
- case Gesture::Finished:
- case Gesture::Cancelled: // FALLTHROUGH
+ case GestureState::FINISHED:
+ case GestureState::CANCELLED: // FALLTHROUGH
{
// Will go back to the previous state to show the cursor, handles, the text's popup, ...
ChangeState( mEventData->mPreviousState );
}
}
+void Controller::Impl::SetTextSelectionRange(const uint32_t *pStart, const uint32_t *pEnd)
+{
+ if( nullptr == mEventData )
+ {
+ // Nothing to do if there is no text.
+ return;
+ }
+
+ if( mEventData->mSelectionEnabled && (pStart || pEnd))
+ {
+ uint32_t length = static_cast<uint32_t>(mModel->mLogicalModel->mText.Count());
+
+ if (pStart)
+ {
+ mEventData->mLeftSelectionPosition = std::min(*pStart, length);
+ }
+ if (pEnd)
+ {
+ mEventData->mRightSelectionPosition = std::min(*pEnd, length);
+ }
+
+ if (mEventData->mLeftSelectionPosition == mEventData->mRightSelectionPosition)
+ {
+ ChangeState( EventData::EDITING );
+ mEventData->mPrimaryCursorPosition = mEventData->mLeftSelectionPosition = mEventData->mRightSelectionPosition;
+ mEventData->mUpdateCursorPosition = true;
+ }
+ else
+ {
+ ChangeState( EventData::SELECTING );
+ mEventData->mUpdateHighlightBox = true;
+ }
+ }
+}
+
+Uint32Pair Controller::Impl::GetTextSelectionRange() const
+{
+ Uint32Pair range;
+
+ if( mEventData )
+ {
+ range.first = mEventData->mLeftSelectionPosition;
+ range.second = mEventData->mRightSelectionPosition;
+ }
+
+ return range;
+}
+
void Controller::Impl::RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval )
{
if( mEventData->mLeftSelectionPosition == mEventData->mRightSelectionPosition )
quadVertexFormat[ "aPosition" ] = Property::VECTOR2;
quadVertexFormat[ "aColor" ] = Property::VECTOR4;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ VertexBuffer quadVertices = VertexBuffer::New( quadVertexFormat );
quadVertices.SetData( &mesh.mVertices[ 0 ], mesh.mVertices.Size() );
Geometry quadGeometry = Geometry::New();
actor.SetProperty( Dali::Actor::Property::NAME, "TextBackgroundColorActor" );
actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetSize( textSize );
+ actor.SetProperty( Actor::Property::SIZE, textSize );
actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
actor.AddRenderer( renderer );
}