Separate handling of events which modify the Model
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
index ee77ca3..82672e6 100644 (file)
@@ -77,11 +77,9 @@ private:
     GET_GLYPH_METRICS  = 0x0080,
     LAYOUT             = 0x0100,
     UPDATE_ACTUAL_SIZE = 0x0200,
-    UPDATE_POSITIONS   = 0x0400,
-    UPDATE_LINES       = 0x0800,
-    REORDER            = 0x1000,
-    ALIGNMENT          = 0x2000,
-    RENDER             = 0x4000,
+    REORDER            = 0x0400,
+    ALIGNMENT          = 0x0800,
+    RENDER             = 0x1000,
     ALL_OPERATIONS     = 0xFFFF
   };
 
@@ -198,6 +196,16 @@ public:
   bool GetEnableCursorBlink() const;
 
   /**
+   * @copydoc Control::GetNaturalSize()
+   */
+  Vector3 GetNaturalSize();
+
+  /**
+   * @copydoc Control::GetHeightForWidth()
+   */
+  float GetHeightForWidth( float width );
+
+  /**
    * @brief Triggers a relayout which updates View (if necessary).
    *
    * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
@@ -207,11 +215,35 @@ public:
   bool Relayout( const Vector2& size );
 
   /**
-   * @brief Update the model with new text.
+   * @brief Process queued events which modify the model.
+   */
+  void ProcessModifyEvents();
+
+  /**
+   * @brief Used to process an event queued from SetText()
    *
-   * @param[in] operations The layout operations which need to be done.
+   * @param[in] newText The new text to store in the logical model.
+   */
+  void ReplaceTextEvent( const std::string& newText );
+
+  /**
+   * @brief Used to process an event queued from key events etc.
+   *
+   * @param[in] text The text to insert into the logical model.
    */
-  void ReplaceText( OperationsMask operations );
+  void InsertTextEvent( const std::string& text );
+
+  /**
+   * @brief Used to process an event queued from backspace key etc.
+   */
+  void DeleteTextEvent();
+
+  /**
+   * @brief Update the model following text replace/insert etc.
+   *
+   * @param[in] operationsRequired The layout operations which need to be done.
+   */
+  void UpdateModel( OperationsMask operationsRequired );
 
   /**
    * @brief Lays-out the text.
@@ -227,16 +259,6 @@ public:
                    Size& layoutSize );
 
   /**
-   * @copydoc Control::GetNaturalSize()
-   */
-  Vector3 GetNaturalSize();
-
-  /**
-   * @copydoc Control::GetHeightForWidth()
-   */
-  float GetHeightForWidth( float width );
-
-  /**
    * @brief Return the layout engine.
    *
    * @return A reference to the layout engine.
@@ -250,6 +272,8 @@ public:
    */
   View& GetView();
 
+  // Text-input Event Queuing
+
   /**
    * @brief Caller by editable UI controls when keyboard focus is gained.
    */