Multiple text background color support for left-to-right text only in TextField
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index 34601f5..064d644 100755 (executable)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/clipboard.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/public-api/rendering/shader.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/input-style.h>
@@ -39,6 +40,10 @@ namespace Toolkit
 namespace Text
 {
 
+const float DEFAULT_TEXTFIT_MIN = 10.f;
+const float DEFAULT_TEXTFIT_MAX = 100.f;
+const float DEFAULT_TEXTFIT_STEP = 1.f;
+
 //Forward declarations
 struct CursorInfo;
 struct FontDefaults;
@@ -163,6 +168,7 @@ struct EventData
   bool mIsPlaceholderElideEnabled       : 1;   ///< True if the placeholder text's elide is enabled.
   bool mPlaceholderEllipsisFlag         : 1;   ///< True if the text controller sets the placeholder ellipsis.
   bool mShiftSelectionFlag              : 1;   ///< True if the text selection using Shift key is enabled.
+  bool mUpdateAlignment                 : 1;   ///< True if the whole text needs to be full aligned..
 };
 
 struct ModifyEvent
@@ -182,6 +188,7 @@ struct FontDefaults
   FontDefaults()
   : mFontDescription(),
     mDefaultPointSize( 0.f ),
+    mFitPointSize( 0.f ),
     mFontId( 0u ),
     familyDefined( false ),
     weightDefined( false ),
@@ -207,6 +214,7 @@ struct FontDefaults
 
   TextAbstraction::FontDescription mFontDescription;  ///< The default font's description.
   float                            mDefaultPointSize; ///< The default font's point size.
+  float                            mFitPointSize; ///< The fit font's point size.
   FontId                           mFontId;           ///< The font's id of the default font.
   bool familyDefined:1; ///< Whether the default font's family name is defined.
   bool weightDefined:1; ///< Whether the default font's weight is defined.
@@ -329,7 +337,12 @@ struct Controller::Impl
     mShadowSetByString( false ),
     mOutlineSetByString( false ),
     mFontStyleSetByString( false ),
-    mShouldClearFocusOnEscape( true )
+    mShouldClearFocusOnEscape( true ),
+    mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ),
+    mTextFitMinSize( DEFAULT_TEXTFIT_MIN ),
+    mTextFitMaxSize( DEFAULT_TEXTFIT_MAX ),
+    mTextFitStepSize( DEFAULT_TEXTFIT_STEP ),
+    mTextFitEnabled( false )
   {
     mModel = Model::New();
 
@@ -712,6 +725,13 @@ struct Controller::Impl
    */
   void ScrollTextToMatchCursor( const CursorInfo& cursorInfo );
 
+  /**
+   * @brief Create an actor that renders the text background color
+   *
+   * @return the created actor or an empty handle if no background color needs to be rendered.
+   */
+  Actor CreateBackgroundActor();
+
 public:
 
   /**
@@ -752,6 +772,7 @@ public:
   OperationsMask mOperationsPending;       ///< Operations pending to be done to layout the text.
   Length mMaximumNumberOfCharacters;       ///< Maximum number of characters that can be inserted.
   HiddenText* mHiddenInput;                ///< Avoid allocating this when the user does not specify hidden input mode.
+  Vector2 mTextFitContentSize;             ///< Size of Text fit content
 
   bool mRecalculateNaturalSize:1;          ///< Whether the natural size needs to be recalculated.
   bool mMarkupProcessorEnabled:1;          ///< Whether the mark-up procesor is enabled.
@@ -765,6 +786,14 @@ public:
   bool mOutlineSetByString:1;              ///< Set when outline is set by string (legacy) instead of map
   bool mFontStyleSetByString:1;            ///< Set when font style is set by string (legacy) instead of map
   bool mShouldClearFocusOnEscape:1;        ///< Whether text control should clear key input focus
+  LayoutDirection::Type mLayoutDirection;  ///< Current system language direction
+
+  Shader mShaderBackground;                ///< The shader for text background.
+
+  float mTextFitMinSize;                   ///< Minimum Font Size for text fit. Default 10
+  float mTextFitMaxSize;                   ///< Maximum Font Size for text fit. Default 100
+  float mTextFitStepSize;                  ///< Step Size for font intervalse. Default 1
+  bool  mTextFitEnabled : 1;               ///< Whether the text's fit is enabled.
 };
 
 } // namespace Text