Fixed overlapping issue between cursor and placeholder text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index 65fce8e..8ada007 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/clipboard.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
-#include <iostream>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
@@ -180,6 +179,9 @@ struct FontDefaults
     mDefaultPointSize(0.0f),
     mFontId(0u)
   {
+    // Initially use the default platform font
+    TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+    fontClient.GetDefaultPlatformFontDescription( mFontDescription );
   }
 
   FontId GetFontId( TextAbstraction::FontClient& fontClient )
@@ -288,6 +290,14 @@ struct Controller::Impl
     return ( mEventData && mEventData->mIsShowingPlaceholderText );
   }
 
+  /**
+   * @brief Helper to check whether active place-holder text is available.
+   */
+  bool IsFocusedPlaceholderAvailable() const
+  {
+    return ( mEventData && !mEventData->mPlaceholderTextActive.empty() );
+  }
+
   bool IsShowingRealText() const
   {
     return ( !IsShowingPlaceholderText() &&
@@ -320,14 +330,17 @@ struct Controller::Impl
 
   void ResetImfManager()
   {
-    // Reset incase we are in a pre-edit state.
-    ImfManager imfManager = ImfManager::Get();
-    if ( imfManager )
+    if( mEventData )
     {
-      imfManager.Reset(); // Will trigger a commit message
+      // Reset incase we are in a pre-edit state.
+      ImfManager imfManager = ImfManager::Get();
+      if ( imfManager )
+      {
+        imfManager.Reset(); // Will trigger a commit message
+      }
+
+      ClearPreEditFlag();
     }
-
-    ClearPreEditFlag();
   }
 
   bool IsClipboardEmpty()