Merge "Bug fix when creating background of control using ImageActor" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.cpp
index e8df944..4e69a4e 100644 (file)
@@ -1152,6 +1152,11 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
     {
       textChanged = BackspaceKeyEvent();
     }
+    else if ( IsKey( keyEvent,  Dali::DALI_KEY_POWER ) || IsKey( keyEvent, Dali::DALI_KEY_MENU ) )
+    {
+      // Do nothing when the Power or Menu Key is pressed.
+      // It avoids call the InsertText() method and delete the selected text.
+    }
     else
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
@@ -1346,11 +1351,11 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y )
         mImpl->mEventData->mDecorator->SetPopupActive( false );
       }
 
-      mImpl->ChangeState( EventData::EDITING );
-
       // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
       if( mImpl->mEventData )
       {
+        mImpl->ChangeState( EventData::EDITING );
+
         Event event( Event::TAP_EVENT );
         event.p1.mUint = tapCount;
         event.p2.mFloat = x;
@@ -1388,6 +1393,26 @@ void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
   }
 }
 
+void Controller::LongPressEvent( Gesture::State state, float x, float y  )
+{
+  DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
+
+  if  ( mImpl->IsShowingPlaceholderText() || mImpl->mLogicalModel->mText.Count() == 0u )
+  {
+    if ( mImpl->mEventData )
+    {
+      Event event( Event::LONG_PRESS_EVENT );
+      event.p1.mInt = state;
+      mImpl->mEventData->mEventQueue.push_back( event );
+      mImpl->RequestRelayout();
+    }
+  }
+  else if( mImpl->mEventData )
+  {
+    SelectEvent( x, y, false );
+  }
+}
+
 void Controller::SelectEvent( float x, float y, bool selectAll )
 {
   if( mImpl->mEventData )