TextInput - Fixes the selection box for right to left text.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-input / text-input-impl.h
index 8bc5a2a..9cd2dba 100644 (file)
@@ -26,7 +26,6 @@
 #include <dali-toolkit/internal/controls/text-input/text-input-popup-impl.h>
 
 #include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/adaptor-framework/common/imf-manager.h>
 #include <dali/public-api/geometry/mesh.h>
 
 namespace Dali
@@ -703,6 +702,22 @@ private:
    bool OnKeyUpEvent(const KeyEvent& event);
 
    /**
+    * Chooses from all handle position and alternative handle positions where to set the position of the two selection handles.
+    *
+    * @param[in] cursorPositionOne The initial position of the first selection handle.
+    * @param[in] cursorPositionTwo The initial position of the second selection handle.
+    * @param[in] altPositionValidOne Whether there is an alternative position for the first selection handle.
+    * @param[in] altPositionValidTwo Whether there is an alternative position for the second selection handle.
+    * @param[in] altPositionOne The alternative position of the first selection handle.
+    * @param[in] altPositionTwo The alternative position of the second selection handle.
+    */
+   void ChooseRtlSelectionHandlePosition( const Vector3& cursorPositionOne,
+                                          const Vector3& cursorPositionTwo,
+                                          bool altPositionValidOne,
+                                          bool altPositionValidTwo,
+                                          const Vector3& altPositionOne,
+                                          const Vector3& altPositionTwo );
+   /**
     * Callback called when the text-view is scrolled.
     *
     * Updates the selection and grab handles, and the highlighted text.
@@ -881,9 +896,8 @@ public:  // Public to allow internal testing.
 
   /**
    * Draw a cursor / caret at position where new text should appear
-   * @param[in] nthChar the position along the text string in which new text should appear.
    */
-  void DrawCursor(const std::size_t nthChar = 0);
+  void DrawCursor();
 
   /**
    * Sets cursor visibility
@@ -1018,15 +1032,6 @@ public:  // Public to allow internal testing.
   void SetSelectionHandlePosition(SelectionHandleId handleId);
 
   /**
-   * Gets the visual position of a logical position.
-   * @note This is preferred over directly accessing the Map, as it resolves visual
-   * positions outside of the character map range.
-   * @param[in] logicalPosition The logical position
-   * @return Visual position is returned.
-   */
-  std::size_t GetVisualPosition(std::size_t logicalPosition) const;
-
-  /**
    * Gets a table of the visual text positions which has a flag
    * for each Character. The flag is either true (character selected)
    * or false (character deselected)
@@ -1044,6 +1049,11 @@ public:  // Public to allow internal testing.
   HighlightInfo CalculateHighlightInfo();
 
   /**
+   * This method was added to fix a PLM. it creates one quad per character so the mesh can show different selection boxes when a mix of right to left and left to right text is selected.
+   */
+  HighlightInfo CalculateHighlightInfoRtl();
+
+  /**
    * Calculates new Mesh data so highlight moves with selection handles.
    */
   void UpdateHighlight();
@@ -1085,8 +1095,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] 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();
+  void SetUpPopupSelection( bool showCutButton = true );
 
   /**
    * Return the logical index containing the character position closest to the source.
@@ -1153,6 +1165,15 @@ public:  // Public to allow internal testing.
   std::size_t GetRowStartFromCharacterPosition(std::size_t logicalPosition) const;
 
   /**
+   * Retrieves the first character of a group of characters with the same direction.
+   *
+   * @param[in] logicalPosition Index to a character.
+   *
+   * @return Index to the character.
+   */
+  std::size_t GetFirstCharacterWithSameDirection( std::size_t logicalPosition ) const;
+
+  /**
    * Retrieve the dimensions of this row of text that the character resides on.
    * @param[in] characterPosition the position in the 'string' of characters.
    * @return The size of the rectangle representing this row
@@ -1219,8 +1240,9 @@ public:  // Public to allow internal testing.
 
   /**
    * Hide highlight shown between selection handles.
+   * @param[in] hidePopup flag to hide the popup too, default is to hide popup.
    */
-  void RemoveHighlight();
+  void RemoveHighlight( bool hidePopup = true );
 
   /**
    * Highlights text that has been selected
@@ -1345,6 +1367,12 @@ public:  // Public to allow internal testing.
    */
   const Vector4& GetOffsetFromText() const;
 
+  /**
+   * Show the Placeholder text with an already created StyleTextArray
+   * @param[in] stylePlaceHolderText Required placeholder text to be used
+   */
+  void ShowPlaceholderText( const MarkupProcessor::StyledTextArray& stylePlaceHolderText );
+
   // Properties
 
   /**