Set TapGesture only if there is an anchor.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
index 40286ef..63a77a4 100644 (file)
@@ -28,7 +28,9 @@
 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/hidden-text.h>
+#include <dali-toolkit/internal/text/input-filter.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
+#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
 #include <dali-toolkit/public-api/text/text-enumerations.h>
@@ -184,12 +186,14 @@ public: // Constructor.
    * @param[in] controlInterface The control's interface.
    * @param[in] editableControlInterface The editable control's interface.
    * @param[in] selectableControlInterface The selectable control's interface.
+   * @param[in] anchorControlInterface The anchor control's interface.
    *
    * @return A pointer to a new Controller.
    */
   static ControllerPtr New(ControlInterface*           controlInterface,
                            EditableControlInterface*   editableControlInterface,
-                           SelectableControlInterface* selectableControlInterface);
+                           SelectableControlInterface* selectableControlInterface,
+                           AnchorControlInterface*     anchorControlInterface);
 
 public: // Configure the text controller.
   /**
@@ -227,6 +231,13 @@ public: // Configure the text controller.
   bool IsMarkupProcessorEnabled() const;
 
   /**
+   * @brief Retrieves whether the current text contains anchors.
+   *
+   * @return @e true if the current text contains anchors. @e false.
+   */
+  bool HasAnchors() const;
+
+  /**
    * @brief Enables/disables the auto text scrolling
    *
    * By default is disabled.
@@ -1295,6 +1306,13 @@ public: // Default style & Input style
    */
   void SetControlInterface(ControlInterface* controlInterface);
 
+  /**
+   * @brief Set the anchor control's interface.
+   *
+   * @param[in] anchorControlInterface The control's interface.
+   */
+  void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
+
 public: // Queries & retrieves.
   /**
    * @brief Return the layout engine.
@@ -1376,6 +1394,16 @@ public: // Queries & retrieves.
   void GetHiddenInputOption(Property::Map& options);
 
   /**
+   * @brief Used to set the input filter option
+   */
+  void SetInputFilterOption(const Property::Map& options);
+
+  /**
+   * @brief Used to get the input filter option
+   */
+  void GetInputFilterOption(Property::Map& options);
+
+  /**
    * @brief Sets the Placeholder Properties.
    *
    * @param[in] map The placeholder property map
@@ -1408,6 +1436,18 @@ public: // Queries & retrieves.
   void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
 
   /**
+   * @brief Retrieves ellipsis position
+   * @return The ellipsis position
+   */
+  Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
+
+  /**
+   * @brief Sets ellipsis position
+   * @param[in] ellipsisPosition The ellipsis position for the text
+   */
+  void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
+
+  /**
    * @brief Retrieves ignoreSpaceAfterText value from model
    * @return The value of ignoreSpaceAfterText
    */
@@ -1420,24 +1460,36 @@ public: // Queries & retrieves.
   void SetIgnoreSpacesAfterText(bool ignore);
 
   /**
-   * @brief Retrieves matchSystemLanguageDirection value from model
-   * @return The value of matchSystemLanguageDirection
+   * @brief Sets SetMatchLayoutDirection value to model
+   * @param[in] match The value of matchLayoutDirection for the text
    */
-  bool IsMatchSystemLanguageDirection() const;
+  void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
 
   /**
-   * @brief Sets matchSystemLanguageDirection value to model
-   * @param[in] match The value of matchSystemLanguageDirection for the text
+   * @brief Retrieves matchLayoutDirection value from model
+   * @return The value of matchLayoutDirection
    */
-  void SetMatchSystemLanguageDirection(bool match);
+  DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
 
   /**
-   * @brief Sets layoutDirection value
-   * @param[in] layoutDirection The value of system language direction
+   * @brief Sets layoutDirection type value.
+   * @param[in] layoutDirection The value of the layout direction type.
    */
   void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
 
   /**
+   * @brief Gets layoutDirection type value.
+   * @param[in] actor The actor which will get the layout direction type.
+   * @return The value of the layout direction type.
+   */
+  Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
+
+  /**
+   * @brief Sets the layout direction changed.
+   */
+  void ChangedLayoutDirection();
+
+  /**
    * @brief Retrieves if showing real text or not.
    * @return The value of showing real text.
    */
@@ -1494,6 +1546,13 @@ public: // Text-input Event Queuing.
   bool KeyEvent(const Dali::KeyEvent& event);
 
   /**
+   * @brief Called by anchor when a tap gesture occurs.
+   * @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.
+   */
+  void AnchorEvent(float x, float y);
+
+  /**
    * @brief Called by editable UI controls when a tap gesture occurs.
    * @param[in] tapCount The number of taps.
    * @param[in] x The x position relative to the top-left of the parent control.
@@ -1700,6 +1759,26 @@ private: // Update.
    */
   bool RemoveSelectedText();
 
+  /**
+   * @brief Update anchor position from given number of inserted characters.
+   *
+   * @param[in] numberOfCharacters The number of inserted characters.
+   * @param[in] previousCursorIndex A cursor position before event occurs.
+   */
+  void InsertTextAnchor(int            numberOfCharacters,
+                        CharacterIndex previousCursorIndex);
+
+  /**
+   * @brief Update anchor position from given number of removed characters.
+   *
+   * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
+   * @param[in] numberOfCharacters The number of removed characters.
+   * @param[in] previousCursorIndex A cursor position before event occurs.
+   */
+  void RemoveTextAnchor(int            cursorOffset,
+                        int            numberOfCharacters,
+                        CharacterIndex previousCursorIndex);
+
 private: // Relayout.
   /**
    * @brief Lays-out the text.
@@ -1792,7 +1871,8 @@ private: // Private contructors & copy operator.
    */
   Controller(ControlInterface*           controlInterface,
              EditableControlInterface*   editableControlInterface,
-             SelectableControlInterface* selectableControlInterface);
+             SelectableControlInterface* selectableControlInterface,
+             AnchorControlInterface*     anchorControlInterface);
 
   // Undefined
   Controller(const Controller& handle);