Selection Handled Scrolling - Step1
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / decorator / text-decorator.h
index e8bc5cf..e341e2b 100644 (file)
@@ -61,35 +61,31 @@ enum ActiveCursor
   ACTIVE_CURSOR_BOTH     ///< Both primary and secondary cursor are active
 };
 
-// The state information for grab handle events
-enum GrabHandleState
+// The state information for handle events.
+enum HandleState
 {
-  GRAB_HANDLE_TAPPED,
-  GRAB_HANDLE_PRESSED,
-  GRAB_HANDLE_RELEASED,
-  GRAB_HANDLE_SCROLLING,
-  GRAB_HANDLE_STOP_SCROLLING
+  HANDLE_TAPPED,
+  HANDLE_PRESSED,
+  HANDLE_RELEASED,
+  HANDLE_SCROLLING,
+  HANDLE_STOP_SCROLLING
 };
 
-// Used to set different grab handle images
-enum GrabHandleImageType
+// Used to set different handle images
+enum HandleImageType
 {
-  GRAB_HANDLE_IMAGE_PRESSED,
-  GRAB_HANDLE_IMAGE_RELEASED
+  HANDLE_IMAGE_PRESSED,
+  HANDLE_IMAGE_RELEASED,
+  HANDLE_IMAGE_TYPE_COUNT
 };
 
-// The set the selection-handle positions etc.
-enum SelectionHandle
+// Types of handles.
+enum HandleType
 {
-  PRIMARY_SELECTION_HANDLE,
-  SECONDARY_SELECTION_HANDLE,
-  SELECTION_HANDLE_COUNT
-};
-
-enum SelectionHandleState
-{
-  SELECTION_HANDLE_PRESSED,
-  SELECTION_HANDLE_RELEASED
+  GRAB_HANDLE,
+  LEFT_SELECTION_HANDLE,
+  RIGHT_SELECTION_HANDLE,
+  HANDLE_TYPE_COUNT
 };
 
 /**
@@ -124,13 +120,14 @@ public:
     virtual ~Observer() {};
 
     /**
-     * @brief An input event from the grab handle.
+     * @brief An input event from one of the handles.
      *
-     * @param[in] state The grab handle state.
+     * @param[in] handleType The handle's type.
+     * @param[in] state The handle's state.
      * @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.
      */
-    virtual void GrabHandleEvent( GrabHandleState state, float x, float y ) = 0;
+    virtual void HandleEvent( HandleType handleType, HandleState state, float x, float y ) = 0;
   };
 
   /**
@@ -287,101 +284,61 @@ public:
   float GetCursorBlinkDuration() const;
 
   /**
-   * @brief Sets whether the grab handle is active.
+   * @brief Sets whether a handle is active.
    *
-   * @note The grab handle follows the cursor position set with SetPosition(Cursor, ...)
-   * @param[in] active True if the grab handle should be active.
+   * @param[in] handleType One of the handles.
+   * @param[in] active True if the handle should be active.
    */
-  void SetGrabHandleActive( bool active );
+  void SetHandleActive( HandleType handleType,
+                        bool active );
 
   /**
-   * @brief Query whether the grab handle is active.
+   * @brief Query whether a handle is active.
    *
-   * @return True if the grab handle should be active.
+   * @param[in] handleType One of the handles.
+   *
+   * @return True if the handle is active.
    */
-  bool IsGrabHandleActive() const;
+  bool IsHandleActive( HandleType handleType ) const;
 
   /**
-   * @brief Sets the image for the grab handle.
+   * @brief Sets the image for one of the handles.
    *
-   * @param[in] type A different image can be set for the pressed/released states.
+   * @param[in] handleType One of the handles.
+   * @param[in] handleImageType A different image can be set for the pressed/released states.
    * @param[in] image The image to use.
    */
-  void SetGrabHandleImage( GrabHandleImageType type, Dali::Image image );
+  void SetHandleImage( HandleType handleType, HandleImageType handleImageType, Dali::Image image );
 
   /**
-   * @brief Retrieves the image for the grab handle.
+   * @brief Retrieves the image for one of the handles.
    *
-   * @param[in] type A different image can be set for the pressed/released states.
-   * @return The grab handle image.
-   */
-  Dali::Image GetGrabHandleImage( GrabHandleImageType type ) const;
-
-  /**
-   * @brief Sets whether the selection handles and highlight are active.
+   * @param[in] handleType One of the handles.
+   * @param[in] handleImageType A different image can be set for the pressed/released states.
    *
-   * @param[in] active True if the selection handles and highlight are active.
-   */
-  void SetSelectionActive( bool active );
-
-  /**
-   * @brief Query whether the selection handles and highlight are active.
-   *
-   * @return True if the selection handles and highlight are active.
+   * @return The grab handle image.
    */
-  bool IsSelectionActive() const;
+  Dali::Image GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const;
 
   /**
    * @brief Sets the position of a selection handle.
    *
-   * @param[in] handle The handle to set.
+   * @param[in] handleType 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] lineHeight The logical line height at this position.
    */
-  void SetPosition( SelectionHandle handle, float x, float y, float lineHeight );
+  void SetPosition( HandleType handleType, float x, float y, float lineHeight );
 
   /**
    * @brief Retrieves the position of a selection handle.
    *
-   * @param[in] handle The handle to get.
+   * @param[in] handleType The handle 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] cursorHeight The logical cursor height at this position.
-   */
-  void GetPosition( SelectionHandle handle, float& x, float& y, float& cursorHeight ) const;
-
-  /**
-   * @brief Sets the image for one of the selection handles.
-   *
-   * @param[in] state A different image can be set for the pressed/released states.
-   * @param[in] image The image to use.
-   */
-  void SetLeftSelectionImage( SelectionHandleState state, Dali::Image image );
-
-  /**
-   * @brief Retrieves the image for a selection handle.
-   *
-   * @param[in] state A different image can be set for the pressed/released states.
-   * @return The image.
-   */
-  Dali::Image GetLeftSelectionImage( SelectionHandleState state ) const;
-
-  /**
-   * @brief Sets the image for one of the selection handles.
-   *
-   * @param[in] state A different image can be set for the pressed/released states.
-   * @param[in] image The image to use.
-   */
-  void SetRightSelectionImage( SelectionHandleState state, Dali::Image image );
-
-  /**
-   * @brief Retrieves the image for a selection handle.
-   *
-   * @param[in] state A different image can be set for the pressed/released states.
-   * @return The image.
+   * @param[out] lineHeight The logical line height at this position.
    */
-  Dali::Image GetRightSelectionImage( SelectionHandleState state ) const;
+  void GetPosition( HandleType handleType, float& x, float& y, float& lineHeight ) const;
 
   /**
    * @brief Adds a quad to the existing selection highlights.