TextSelectionToolbar and Style Properties added
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index 7848541..1a797b3 100644 (file)
@@ -19,8 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/text-abstraction/font-client.h>
-#include <dali/public-api/adaptor-framework/imf-manager.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/devel-api/adaptor-framework/imf-manager.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
@@ -42,8 +42,6 @@ struct Event
   // Used to queue input events until DoRelayout()
   enum Type
   {
-    KEYBOARD_FOCUS_GAIN_EVENT,
-    KEYBOARD_FOCUS_LOST_EVENT,
     CURSOR_KEY_EVENT,
     TAP_EVENT,
     PAN_EVENT,
@@ -102,7 +100,9 @@ struct EventData
     INACTIVE,
     SELECTING,
     EDITING,
-    EDITING_WITH_POPUP
+    EDITING_WITH_POPUP,
+    GRAB_HANDLE_PANNING,
+    SELECTION_HANDLE_PANNING
   };
 
   EventData( DecoratorPtr decorator );
@@ -148,6 +148,7 @@ struct EventData
   bool mUpdateLeftSelectionPosition        : 1;   ///< True if the visual position of the left selection handle must be recalculated.
   bool mUpdateRightSelectionPosition       : 1;   ///< True if the visual position of the right selection handle must be recalculated.
   bool mScrollAfterUpdateCursorPosition    : 1;   ///< Whether to scroll after the cursor position is updated.
+  bool mScrollAfterDelete                  : 1;   ///< Whether to scroll after delete characters.
 };
 
 struct ModifyEvent
@@ -233,6 +234,12 @@ struct Controller::Impl
    */
   void QueueModifyEvent( ModifyEvent::Type type )
   {
+    if( ModifyEvent::TEXT_REPLACED == type)
+    {
+      // Cancel previously queued inserts etc.
+      mModifyEvents.clear();
+    }
+
     ModifyEvent event;
     event.type = type;
     mModifyEvents.push_back( event );
@@ -276,7 +283,17 @@ struct Controller::Impl
     }
   }
 
-  void PreEditReset()
+  void ClearPreEditFlag()
+  {
+    if( mEventData )
+    {
+      mEventData->mPreEditFlag = false;
+      mEventData->mPreEditStartPosition = 0;
+      mEventData->mPreEditLength = 0;
+    }
+  }
+
+  void ResetImfManager()
   {
     // Reset incase we are in a pre-edit state.
     ImfManager imfManager = ImfManager::Get();
@@ -284,6 +301,8 @@ struct Controller::Impl
     {
       imfManager.Reset(); // Will trigger a commit message
     }
+
+    ClearPreEditFlag();
   }
 
   void UpdateModel( OperationsMask operationsRequired );
@@ -296,8 +315,6 @@ struct Controller::Impl
    */
   void GetDefaultFonts( Dali::Vector<FontRun>& fonts, Length numberOfCharacters );
 
-  void OnKeyboardFocus( bool hasFocus );
-
   void OnCursorKeyEvent( const Event& event );
 
   void OnTapEvent( const Event& event );
@@ -380,10 +397,17 @@ struct Controller::Impl
   /**
    * @brief Scrolls the text to make the cursor visible.
    *
-   * This method is called after inserting, deleting or moving the cursor with the keypad.
+   * This method is called after inserting text or moving the cursor with the keypad.
    */
   void ScrollToMakeCursorVisible();
 
+  /**
+   * @brief Scrolls the text to make the cursor visible.
+   *
+   * This method is called after deleting text.
+   */
+  void ScrollTextToMatchCursor();
+
   ControlInterface& mControlInterface;     ///< Reference to the text controller.
   LogicalModelPtr mLogicalModel;           ///< Pointer to the logical model.
   VisualModelPtr  mVisualModel;            ///< Pointer to the visual model.