Refactored text field/editor property getters/setters
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-editor-impl.h
index 6947faa..8c5d7be 100644 (file)
@@ -93,11 +93,26 @@ public:
   DevelTextEditor::AnchorClickedSignalType& AnchorClickedSignal();
 
   /**
+   * @copydoc Dali::Toollkit::TextEditor::CursorPositionChangedSignal()
+   */
+  DevelTextEditor::CursorPositionChangedSignalType& CursorPositionChangedSignal();
+
+  /**
    * @copydoc Dali::Toollkit::TextEditor::InputFilteredSignal()
    */
   DevelTextEditor::InputFilteredSignalType& InputFilteredSignal();
 
   /**
+   * @copydoc Dali::Toollkit::TextEditor::SelectionChangedSignal()
+   */
+  DevelTextEditor::SelectionChangedSignalType& SelectionChangedSignal();
+
+  /**
+   * @copydoc Dali::Toollkit::TextEditor::SelectionClearedSignal()
+   */
+  DevelTextEditor::SelectionClearedSignalType& SelectionClearedSignal();
+
+  /**
    * Connects a callback function with the object's signals.
    * @param[in] object The object providing the signal.
    * @param[in] tracker Used to disconnect the signal.
@@ -216,9 +231,9 @@ private: // From Control
   void TextDeleted(unsigned int position, unsigned int length, const std::string& content) override;
 
   /**
-   * @copydoc Text::EditableControlInterface::CursorMoved()
+   * @copydoc Text::EditableControlInterface::CursorPositionChanged()
    */
-  void CursorMoved(unsigned int position) override;
+  void CursorPositionChanged(unsigned int oldPosition, unsigned int newPosition) override;
 
   /**
    * @copydoc Text::EditableControlInterface::TextChanged()
@@ -236,6 +251,11 @@ private: // From Control
   void InputStyleChanged(Text::InputStyle::Mask inputStyleMask) override;
 
   /**
+   * @copydoc Text::SelectableControlInterface::SelectionChanged()
+   */
+  void SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd) override;
+
+  /**
    * @copydoc Text::EditableControlInterface::AddDecoration()
    */
   void AddDecoration(Actor& actor, bool needsClipping) override;
@@ -273,6 +293,11 @@ public:
   void SelectNone() override;
 
   /**
+   * @copydoc Text::SelectableControlInterface::SelectText()
+   */
+  void SelectText(const uint32_t start, const uint32_t end) override;
+
+  /**
    * @copydoc Dali::Toolkit::DevelTextEditor::ScrollBy()
    */
   void ScrollBy(Vector2 Scroll);
@@ -306,6 +331,21 @@ public:
    */
   void SetEditable(bool editable) override;
 
+  /**
+   * @copydoc Text::EditableControlInterface::CopyText()
+   */
+  string CopyText() override;
+
+  /**
+   * @copydoc Text::EditableControlInterface::CutText()
+   */
+  string CutText() override;
+
+  /**
+   * @copydoc Text::EditableControlInterface::PasteText()
+   */
+  void PasteText() override;
+
   // From AnchorControlInterface
 
   /**
@@ -363,11 +403,26 @@ private: // Implementation
   void OnIdleSignal();
 
   /**
+   * @brief Emits CursorPositionChanged signal.
+   */
+  void EmitCursorPositionChangedSignal();
+
+  /**
    * @brief Emits TextChanged signal.
    */
   void EmitTextChangedSignal();
 
   /**
+   * @brief Emits SelectionChanged signal.
+   */
+  void EmitSelectionChangedSignal();
+
+  /**
+   * @brief Emits SelectionCleared signal.
+   */
+  void EmitSelectionClearedSignal();
+
+  /**
    * @brief set RenderActor's position with new scrollPosition
    *
    * Apply updated scroll position or start scroll animation if VerticalScrollAnimation is enabled
@@ -382,6 +437,13 @@ private: // Implementation
   void OnScrollIndicatorAnimationFinished(Animation& animation);
 
   /**
+  * @brief Callback function for when the layout is changed.
+  * @param[in] actor The actor whose layoutDirection is changed.
+  * @param[in] type  The layoutDirection.
+  */
+  void OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type);
+
+  /**
    * Construct a new TextEditor.
    */
   TextEditor();
@@ -413,12 +475,15 @@ private: // Implementation
 
 private: // Data
   // Signals
-  Toolkit::TextEditor::TextChangedSignalType           mTextChangedSignal;
-  Toolkit::TextEditor::InputStyleChangedSignalType     mInputStyleChangedSignal;
-  Toolkit::TextEditor::ScrollStateChangedSignalType    mScrollStateChangedSignal;
-  Toolkit::DevelTextEditor::MaxLengthReachedSignalType mMaxLengthReachedSignal;
-  Toolkit::DevelTextEditor::AnchorClickedSignalType    mAnchorClickedSignal;
-  Toolkit::DevelTextEditor::InputFilteredSignalType    mInputFilteredSignal;
+  Toolkit::TextEditor::TextChangedSignalType                mTextChangedSignal;
+  Toolkit::TextEditor::InputStyleChangedSignalType          mInputStyleChangedSignal;
+  Toolkit::TextEditor::ScrollStateChangedSignalType         mScrollStateChangedSignal;
+  Toolkit::DevelTextEditor::MaxLengthReachedSignalType      mMaxLengthReachedSignal;
+  Toolkit::DevelTextEditor::AnchorClickedSignalType         mAnchorClickedSignal;
+  Toolkit::DevelTextEditor::InputFilteredSignalType         mInputFilteredSignal;
+  Toolkit::DevelTextEditor::CursorPositionChangedSignalType mCursorPositionChangedSignal;
+  Toolkit::DevelTextEditor::SelectionChangedSignalType      mSelectionChangedSignal;
+  Toolkit::DevelTextEditor::SelectionClearedSignalType      mSelectionClearedSignal;
 
   InputMethodContext            mInputMethodContext;
   Text::ControllerPtr           mController;
@@ -445,7 +510,19 @@ private: // Data
   bool  mScrollAnimationEnabled : 1;
   bool  mScrollBarEnabled : 1;
   bool  mScrollStarted : 1;
-  bool  mTextChanged : 1; ///< If true, emits TextChangedSignal in next OnRelayout().
+  bool  mTextChanged : 1;           ///< If true, emits TextChangedSignal in next OnRelayout().
+  bool  mCursorPositionChanged : 1; ///< If true, emits CursorPositionChangedSignal at the end of OnRelayout().
+  bool  mSelectionChanged : 1;      ///< If true, emits SelectionChangedSignal at the end of OnRelayout().
+  bool  mSelectionCleared : 1;      ///< If true, emits SelectionClearedSignal at the end of OnRelayout().
+
+  //args for cursor PositionChanged event
+  unsigned int mOldPosition;
+
+  //args for selection changed event
+  uint32_t mOldSelectionStart;
+  uint32_t mOldSelectionEnd;
+
+  struct PropertyHandler;
 
   /**
    * @brief This structure is to connect TextEditor with Accessible functions.