Text - Move cursor's position related code to a different file.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index 2f14702..c996a1f 100644 (file)
@@ -39,6 +39,9 @@ namespace Toolkit
 namespace Text
 {
 
+//Forward declarations
+struct CursorInfo;
+
 struct Event
 {
   // Used to queue input events until DoRelayout()
@@ -76,30 +79,6 @@ struct Event
   Param p3;
 };
 
-struct CursorInfo
-{
-  CursorInfo()
-  : primaryPosition(),
-    secondaryPosition(),
-    lineOffset( 0.f ),
-    lineHeight( 0.f ),
-    primaryCursorHeight( 0.f ),
-    secondaryCursorHeight( 0.f ),
-    isSecondaryCursor( false )
-  {}
-
-  ~CursorInfo()
-  {}
-
-  Vector2 primaryPosition;       ///< The primary cursor's position.
-  Vector2 secondaryPosition;     ///< The secondary cursor's position.
-  float   lineOffset;            ///< The vertical offset where the line containing the cursor starts.
-  float   lineHeight;            ///< The height of the line where the cursor is placed.
-  float   primaryCursorHeight;   ///< The primary cursor's height.
-  float   secondaryCursorHeight; ///< The secondary cursor's height.
-  bool    isSecondaryCursor;     ///< Whether the secondary cursor is valid.
-};
-
 struct EventData
 {
   enum State
@@ -300,7 +279,10 @@ struct Controller::Impl
     mOperationsPending( NO_OPERATION ),
     mMaximumNumberOfCharacters( 50u ),
     mRecalculateNaturalSize( true ),
-    mMarkupProcessorEnabled( false )
+    mMarkupProcessorEnabled( false ),
+    mClipboardHideEnabled( true ),
+    mAutoScrollEnabled( false ),
+    mAutoScrollDirectionRTL( false )
   {
     mLogicalModel = LogicalModel::New();
     mVisualModel  = VisualModel::New();
@@ -478,7 +460,7 @@ struct Controller::Impl
   void ClearModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
 
   /**
-   * @brief Updates the logical and visual models.
+   * @brief Updates the logical and visual models. Updates the style runs in the visual model when the text's styles changes.
    *
    * When text or style changes the model is set with some operations pending.
    * When i.e. the text's size or a relayout is required this method is called
@@ -486,17 +468,10 @@ struct Controller::Impl
    * matched with the operations pending to perform the minimum number of operations.
    *
    * @param[in] operationsRequired The operations required.
-   */
-  void UpdateModel( OperationsMask operationsRequired );
-
-  /**
-   * @brief Updates the style runs in the visual model when the text's styles changes.
-   *
-   * @param[in] operationsRequired The operations required.
    *
    * @return @e true if the model has been modified.
    */
-  bool UpdateModelStyle( OperationsMask operationsRequired );
+  bool UpdateModel( OperationsMask operationsRequired );
 
   /**
    * @brief Retreieves the default style.
@@ -530,6 +505,8 @@ struct Controller::Impl
 
   void HideClipboard();
 
+  void SetClipboardHideEnable(bool enable);
+
   bool CopyStringToClipboard( std::string& source );
 
   void SendSelectionToClipboard( bool deleteAfterSending );
@@ -542,20 +519,6 @@ struct Controller::Impl
   void SetPopupButtons();
 
   void ChangeState( EventData::State newState );
-  LineIndex GetClosestLine( float y ) const;
-
-  void FindSelectionIndices( float visualX, float visualY, CharacterIndex& startIndex, CharacterIndex& endIndex );
-
-  /**
-   * @brief Retrieves the cursor's logical position for a given touch point x,y
-   *
-   * @param[in] visualX The touch point x.
-   * @param[in] visualY The touch point y.
-   *
-   * @return The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
-   */
-  CharacterIndex GetClosestCursorIndex( float visualX,
-                                        float visualY );
 
   /**
    * @brief Calculates the cursor's position for a given character index in the logical order.
@@ -635,6 +598,14 @@ struct Controller::Impl
    */
   void ScrollTextToMatchCursor( const CursorInfo& cursorInfo );
 
+private:
+  // Declared private and left undefined to avoid copies.
+  Impl( const Impl& );
+  // Declared private and left undefined to avoid copies.
+  Impl& operator=( const Impl& );
+
+public:
+
   ControlInterface& mControlInterface;     ///< Reference to the text controller.
   LogicalModelPtr mLogicalModel;           ///< Pointer to the logical model.
   VisualModelPtr  mVisualModel;            ///< Pointer to the visual model.
@@ -654,6 +625,10 @@ struct Controller::Impl
 
   bool mRecalculateNaturalSize:1;          ///< Whether the natural size needs to be recalculated.
   bool mMarkupProcessorEnabled:1;          ///< Whether the mark-up procesor is enabled.
+  bool mClipboardHideEnabled:1;            ///< Whether the ClipboardHide function work or not
+  bool mAutoScrollEnabled:1;               ///< Whether auto text scrolling is enabled.
+  CharacterDirection mAutoScrollDirectionRTL:1;  ///< Direction of auto scrolling, true if rtl
+
 };
 
 } // namespace Text