Dali-Text: Keyboard Shortcuts
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 8f4de65..0a8fe4b
@@ -221,6 +221,11 @@ bool Controller::Impl::ProcessInputEvents()
           OnSelectAllEvent();
           break;
         }
+        case Event::SELECT_NONE:
+        {
+          OnSelectNoneEvent();
+          break;
+        }
       }
     }
   }
@@ -1596,17 +1601,16 @@ void Controller::Impl::OnPanEvent( const Event& event )
     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;
@@ -1630,8 +1634,8 @@ void Controller::Impl::OnPanEvent( const Event& event )
       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 );
@@ -2015,6 +2019,27 @@ void Controller::Impl::OnSelectAllEvent()
   }
 }
 
+void Controller::Impl::OnSelectNoneEvent()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "OnSelectNoneEvent mEventData->mSelectionEnabled%s \n", mEventData->mSelectionEnabled?"true":"false");
+
+  if( NULL == mEventData )
+  {
+    // Nothing to do if there is no text.
+    return;
+  }
+
+  if( mEventData->mSelectionEnabled && mEventData->mState == EventData::SELECTING)
+  {
+    mEventData->mPrimaryCursorPosition = 0u;
+    mEventData->mLeftSelectionPosition = mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
+    ChangeState( EventData::INACTIVE );
+    mEventData->mUpdateCursorPosition = true;
+    mEventData->mUpdateInputStyle = true;
+    mEventData->mScrollAfterUpdatePosition = true;
+  }
+}
+
 void Controller::Impl::RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval )
 {
   if( mEventData->mLeftSelectionPosition == mEventData->mRightSelectionPosition )
@@ -3359,7 +3384,7 @@ Actor Controller::Impl::CreateBackgroundActor()
       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();
@@ -3376,11 +3401,11 @@ Actor Controller::Impl::CreateBackgroundActor()
       renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT );
 
       actor = Actor::New();
-      actor.SetName( "TextBackgroundColorActor" );
-      actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
-      actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-      actor.SetSize( textSize );
-      actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+      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.SetProperty( Actor::Property::SIZE, textSize );
+      actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
       actor.AddRenderer( renderer );
     }
   }