Merge "fix wrong behaviour of SelectNone()" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / text-controls / text-field-devel.h
index 377b606..10d79e8 100644 (file)
@@ -247,6 +247,26 @@ using AnchorClickedSignalType = Signal<void(TextField, const char*, uint32_t)>;
 DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextField textField);
 
 /**
+ * @brief cursor position changed signal type.
+ *
+ * @note Signal
+ *  - uint32_t    : old position.
+ */
+using CursorPositionChangedSignalType = Signal<void(TextField, uint32_t)>;
+
+/**
+ * @brief This signal is emitted when the cursor position has been changed.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ *   void YourCallbackName(TextField textField, uint32_t oldPosition);
+ * @endcode
+ * @param[in] textField The instance of TextField.
+ * @return The signal to connect to.
+ */
+DALI_TOOLKIT_API CursorPositionChangedSignalType& CursorPositionChangedSignal(TextField textField);
+
+/**
  * @brief Input filtered signal type.
  */
 using InputFilteredSignalType = Signal<void(TextField, Toolkit::InputFilter::Property::Type)>;
@@ -278,6 +298,44 @@ using InputFilteredSignalType = Signal<void(TextField, Toolkit::InputFilter::Pro
 DALI_TOOLKIT_API InputFilteredSignalType& InputFilteredSignal(TextField textField);
 
 /**
+ * @brief selection changed signal type.
+ *
+ * @note Signal
+ *  - uint32_t  : selection start before the change.
+ *  - uint32_t  : selection end before the change.
+ */
+using SelectionChangedSignalType = Signal<void(TextField, uint32_t, uint32_t)>;
+
+/**
+ * @brief This signal is emitted when the selection has been changed.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ *   void YourCallbackName( TextField textField, uint32_t oldStart, uint32_t oldEnd);
+ * @endcode
+ * @param[in] textField The instance of TextField.
+ * @return The signal to connect to
+ */
+DALI_TOOLKIT_API SelectionChangedSignalType& SelectionChangedSignal(TextField textField);
+
+/**
+ * @brief selection cleared signal type.
+ */
+using SelectionClearedSignalType = Signal<void(TextField)>;
+
+/**
+ * @brief This signal is emitted when the selection has been cleared.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ *   void YourCallbackName( TextField textField);
+ * @endcode
+ * @param[in] textField The instance of TextField.
+ * @return The signal to connect to
+ */
+DALI_TOOLKIT_API SelectionClearedSignalType& SelectionClearedSignal(TextField textField);
+
+/**
  * @brief Select the whole text of TextField.
  *
  * @param[in] textField The instance of TextField.
@@ -291,6 +349,44 @@ DALI_TOOLKIT_API void SelectWholeText(TextField textField);
  */
 DALI_TOOLKIT_API void SelectNone(TextField textField);
 
+/**
+ * @brief Select the text from start index to end index of TextField.
+ * @note
+ * The selection index is based on the cursor index.
+ *
+ * text   H e l l o
+ * index 0 1 2 3 4 5
+ * if textField.SelectText(1, 4); is executed, "ell" is selected.
+ *
+ * @param[in] textField The instance of TextField.
+ * @param[in] start The start index of the text to select. (The starting point of start index is 0.)
+ * @param[in] end The end index of the text to select. (If end index > text's length, the end index is set to the length of the text.)
+ */
+DALI_TOOLKIT_API void SelectText(TextField textField, const uint32_t start, const uint32_t end);
+
+/**
+ * @brief Copy and return the selected text of TextField.
+ *
+ * @param[in] textField The instance of TextField.
+ * @return The copied text.
+ */
+DALI_TOOLKIT_API std::string CopyText(TextField textField);
+
+/**
+ * @brief Cut and return the selected text of TextField.
+ *
+ * @param[in] textField The instance of TextField.
+ * @return The cut text.
+ */
+DALI_TOOLKIT_API std::string CutText(TextField textField);
+
+/**
+ * @brief Paste the most recent clipboard text item into the TextField.
+ *
+ * @param[in] textField The instance of TextField.
+ */
+DALI_TOOLKIT_API void PasteText(TextField textField);
+
 } // namespace DevelTextField
 
 } // namespace Toolkit