Text Decorator - Set positions in Control coords.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / decorator / text-decorator.h
index 4038d3f..a5f329a 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/vector2.h>
 
 namespace Dali
 {
@@ -86,7 +87,11 @@ enum SelectionHandleState
  * @brief A Text Decorator is used to display cursors, handles, selection highlights and pop-ups.
  *
  * The decorator is responsible for clipping decorations which are positioned outside of the parent area.
- * In some cases the decorations will be moved or flipped around, to maintain visibility on-screen.
+ *
+ * The Popup decoration will be positioned either above the Grab handle or above the selection handles but if doing so
+ * would cause the Popup to exceed the Decoration Bounding Box ( see SetBoundingBox API ) the the Popup will be repositioned below the handle(s).
+ *
+ * Selection handles will be flipped around to ensure they do not exceed the Decoration Bounding Box. ( Stay visible ).
  *
  * Decorator components forward input events to a controller class through an observer interface.
  * The controller is responsible for selecting which components are active.
@@ -166,6 +171,13 @@ public:
   void Relayout( const Dali::Vector2& size );
 
   /**
+   * @brief Updates the decorator's actor positions after scrolling.
+   *
+   * @param[in] scrollOffset The scroll offset.
+   */
+  void UpdatePositions( const Vector2& scrollOffset );
+
+  /**
    * @brief Sets which of the cursors are active.
    *
    * @note Cursor will only be visible if within the parent area.
@@ -186,33 +198,21 @@ public:
    * @param[in] cursor The cursor to set.
    * @param[in] x The x position relative to the top-left of the parent control.
    * @param[in] y The y position relative to the top-left of the parent control.
-   * @param[in] height The logical height of the cursor.
+   * @param[in] cursorHeight The logical height of the cursor.
+   * @param[in] lineHeight The logical height of the line.
    */
-  void SetPosition( Cursor cursor, float x, float y, float height );
+  void SetPosition( Cursor cursor, float x, float y, float cursorHeight, float lineHeight );
 
   /**
-   * @brief Retrieves the position of a cursor.
+   * @brief Retrieves the position, height and lineHeight of a cursor.
    *
    * @param[in] cursor The cursor to get.
    * @param[out] x The x position relative to the top-left of the parent control.
    * @param[out] y The y position relative to the top-left of the parent control.
-   * @param[out] height The logical height of the cursor.
-   */
-  void GetPosition( Cursor cursor, float& x, float& y, float& height ) const;
-
-  /**
-   * @brief Sets the image for a cursor.
-   *
-   * @param[in] image The image to use.
-   */
-  void SetCursorImage( Dali::Image image );
-
-  /**
-   * @brief Retrieves the image for a cursor.
-   *
-   * @return The cursor image.
+   * @param[out] cursorHeight The logical height of the cursor.
+   * @param[out] lineHeight The logical height of the line.
    */
-  Dali::Image GetCursorImage() const;
+  void GetPosition( Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight ) const;
 
   /**
    * @brief Sets the color for a cursor.
@@ -317,9 +317,9 @@ public:
    * @param[in] handle The handle to set.
    * @param[in] x The x position relative to the top-left of the parent control.
    * @param[in] y The y position relative to the top-left of the parent control.
-   * @param[in] cursorHeight The logical cursor height at this position.
+   * @param[in] lineHeight The logical line height at this position.
    */
-  void SetPosition( SelectionHandle handle, float x, float y, float cursorHeight );
+  void SetPosition( SelectionHandle handle, float x, float y, float lineHeight );
 
   /**
    * @brief Retrieves the position of a selection handle.
@@ -349,6 +349,34 @@ public:
    */
   Dali::Image GetImage( SelectionHandle handle, SelectionHandleState state ) const;
 
+  /**
+   * @brief Adds a quad to the existing selection highlights.
+   *
+   * @param[in] x1 The top-left x position.
+   * @param[in] y1 The top-left y position.
+   * @param[in] x2 The bottom-right x position.
+   * @param[in] y3 The bottom-right y position.
+   */
+  void AddHighlight( float x1, float y1, float x2, float y2 );
+
+  /**
+   * @brief Removes all of the previously added highlights.
+   */
+  void ClearHighlights();
+
+  /**
+   * @brief Set the Selection Popup to show or hide via the active flaf
+   * @param[in] active true to show, false to hide
+   */
+  void SetPopupActive( bool active );
+
+  /**
+   * @brief Query whether the Selection Popup is active.
+   *
+   * @return True if the Selection Popup should be active.
+   */
+  bool IsPopupActive() const;
+
 protected:
 
   /**