From: Agnelo Vaz Date: Mon, 22 Sep 2014 17:01:44 +0000 (+0100) Subject: (TextInput) Don't show grab handle when edit modes starts until actually needed X-Git-Tag: accepted/tizen/common/20140925.172059~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=5123f931b66ad8269c6c8e0823ec7d74697b0f1a (TextInput) Don't show grab handle when edit modes starts until actually needed Change-Id: I9e2a4bd8a9ea0768c03ea1a725294fb6e96d01fe Signed-off-by: Agnelo Vaz --- diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index d7eed95..21d9840 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -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 ); - - // 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(); } } @@ -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); @@ -3861,7 +3844,7 @@ void TextInput::ShowPopupCutCopyPaste() ShowPopup(); } -void TextInput::SetUpPopupSelection( bool treatWhiteSpaceAsAnyOtherCharacter ) +void TextInput::SetUpPopupSelection( bool showCutButton ) { 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::ButtonsCut, treatWhiteSpaceAsAnyOtherCharacter ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, showCutButton ); } // if clipboard has valid contents then offer paste option if( mClipboard && mClipboard.NumberOfItems() ) diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.h b/base/dali-toolkit/internal/controls/text-input/text-input-impl.h index 556daca..c9e3b18 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.h +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.h @@ -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. - * @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.