(TextInput) Don't show grab handle when edit modes starts until actually needed 63/27963/1
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Mon, 22 Sep 2014 17:01:44 +0000 (18:01 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 23 Sep 2014 14:00:26 +0000 (15:00 +0100)
Change-Id: I9e2a4bd8a9ea0768c03ea1a725294fb6e96d01fe
Signed-off-by: Agnelo Vaz <agnelo.vaz@samsung.com>
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.h

index d7eed95..21d9840 100644 (file)
@@ -1463,26 +1463,6 @@ void TextInput::OnTextTap(Dali::Actor actor, Dali::TapGesture tap)
     {
       // Set the initial cursor position in the tap point.
       ReturnClosestIndex(tap.localPoint, mCursorPosition );
     {
       // Set the initial cursor position in the tap point.
       ReturnClosestIndex(tap.localPoint, mCursorPosition );
-
-      // Create the grab handle.
-      // TODO Make this a re-usable function.
-      if ( IsGrabHandleEnabled() )
-      {
-        const Vector3 cursorPosition = GetActualPositionFromCharacterPosition(mCursorPosition);
-
-        CreateGrabHandle();
-
-        mActualGrabHandlePosition.x = cursorPosition.x; // Set grab handle to be at the cursor position
-        mActualGrabHandlePosition.y = cursorPosition.y; // Set grab handle to be at the cursor position
-        mGrabHandle.SetPosition( mActualGrabHandlePosition + UI_OFFSET );
-        ShowGrabHandleAndSetVisibility( mIsGrabHandleInScrollArea );
-
-      }
-
-      // Edit mode started after grab handle created to ensure the signal InputStarted is sent last.
-      // This is used to ensure if selecting text hides the grab handle then this code is run after grab handle is created,
-      // otherwise the Grab handle will be shown when selecting.
-
       StartEditMode();
     }
   }
       StartEditMode();
     }
   }
@@ -1536,6 +1516,9 @@ void TextInput::OnTextTap(Dali::Actor actor, Dali::TapGesture tap)
     }
   }
 
     }
   }
 
+  // Edit mode started after grab handle created to ensure the signal InputStarted is sent last.
+  // This is used to ensure if selecting text hides the grab handle then this code is run after grab handle is created,
+  // otherwise the Grab handle will be shown when selecting.
   if ( createGrabHandle && IsGrabHandleEnabled() )
   {
     const Vector3 cursorPosition = GetActualPositionFromCharacterPosition(mCursorPosition);
   if ( createGrabHandle && IsGrabHandleEnabled() )
   {
     const Vector3 cursorPosition = GetActualPositionFromCharacterPosition(mCursorPosition);
@@ -3861,7 +3844,7 @@ void TextInput::ShowPopupCutCopyPaste()
   ShowPopup();
 }
 
   ShowPopup();
 }
 
-void TextInput::SetUpPopupSelection( bool treatWhiteSpaceAsAnyOtherCharacter )
+void TextInput::SetUpPopupSelection( bool showCutButton )
 {
   ClearPopup();
   mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed
 {
   ClearPopup();
   mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed
@@ -3870,7 +3853,7 @@ void TextInput::SetUpPopupSelection( bool treatWhiteSpaceAsAnyOtherCharacter )
   {
     mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true );
     mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelect, true );
   {
     mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true );
     mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelect, true );
-    mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, treatWhiteSpaceAsAnyOtherCharacter );
+    mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, showCutButton );
   }
   // if clipboard has valid contents then offer paste option
   if( mClipboard && mClipboard.NumberOfItems() )
   }
   // if clipboard has valid contents then offer paste option
   if( mClipboard && mClipboard.NumberOfItems() )
index 556daca..c9e3b18 100644 (file)
@@ -1084,10 +1084,10 @@ public:  // Public to allow internal testing.
 
   /**
    * Setup the selection popup and clipboard if relevant so the correct options are shown when ShowPopup is called.
 
   /**
    * Setup the selection popup and clipboard if relevant so the correct options are shown when ShowPopup is called.
-   * @param[in] treatWhiteSpaceAsAnyOtherCharacter If whitespace should not be selected in the same manner as other characters set
-   *  this to false. default is true.
+   * @param[in] showCutButton Flag to show or hide cut button, in some cases like whitespace we do not want to cut just select.
+   * default is true.
    */
    */
-  void SetUpPopupSelection( bool treatWhiteSpaceAsAnyOtherCharacter = true );
+  void SetUpPopupSelection( bool showCutButton = true );
 
   /**
    * Return the logical index containing the character position closest to the source.
 
   /**
    * Return the logical index containing the character position closest to the source.