Merge "Fix the texture bleeding with wrapping in atlas" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
index d035397..7b1e2ba 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_TEXT_CONTROLLER_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public:
     SHAPE_TEXT         = 0x0040,
     GET_GLYPH_METRICS  = 0x0080,
     LAYOUT             = 0x0100,
-    UPDATE_ACTUAL_SIZE = 0x0200,
+    UPDATE_LAYOUT_SIZE = 0x0200,
     REORDER            = 0x0400,
     ALIGN              = 0x0800,
     COLOR              = 0x1000,
@@ -108,6 +108,13 @@ public:
     DONT_UPDATE_INPUT_STYLE
   };
 
+  enum UpdateTextType
+  {
+    NONE_UPDATED      = 0x0,
+    MODEL_UPDATED     = 0x1,
+    DECORATOR_UPDATED = 0x2
+  };
+
   /**
    * @brief Create a new instance of a Controller.
    *
@@ -174,6 +181,55 @@ public:
   CharacterDirection GetAutoScrollDirection() const;
 
   /**
+   * @brief Get the alignment offset of the first line of text.
+   *
+   * @return The alignment offset.
+   */
+  float GetAutoScrollLineAlignment() const;
+
+  /**
+   * @brief Enables the horizontal scrolling.
+   *
+   * @param[in] enable Whether to enable the horizontal scrolling.
+   */
+  void SetHorizontalScrollEnabled( bool enable );
+
+  /**
+   * @brief Retrieves whether the horizontal scrolling is enabled.
+   *
+   * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
+   */
+  bool IsHorizontalScrollEnabled() const;
+
+  /**
+   * @brief Enables the vertical scrolling.
+   *
+   * @param[in] enable Whether to enable the vertical scrolling.
+   */
+  void SetVerticalScrollEnabled( bool enable );
+
+  /**
+   * @brief Retrieves whether the verticall scrolling is enabled.
+   *
+   * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
+   */
+  bool IsVerticalScrollEnabled() const;
+
+  /**
+   * @brief Enables the smooth handle panning.
+   *
+   * @param[in] enable Whether to enable the smooth handle panning.
+   */
+  void SetSmoothHandlePanEnabled( bool enable );
+
+  /**
+   * @brief Retrieves whether the smooth handle panning is enabled.
+   *
+   * @return @e true if the smooth handle panning is enabled.
+   */
+  bool IsSmoothHandlePanEnabled() const;
+
+  /**
    * @brief Replaces any text previously set.
    *
    * @note This will be converted into UTF-32 when stored in the text model.
@@ -184,7 +240,7 @@ public:
   /**
    * @brief Retrieve any text previously set.
    *
-   * @return A string of UTF-8 characters.
+   * @param[out] text A string of UTF-8 characters.
    */
   void GetText( std::string& text ) const;
 
@@ -205,13 +261,6 @@ public:
                    UpdateInputStyleType type  );
 
   /**
-   * @brief Retrieve the current cursor position.
-   *
-   * @return The cursor position.
-   */
-  unsigned int GetLogicalCursorPosition() const;
-
-  /**
    * @brief Replaces any placeholder text previously set.
    *
    * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
@@ -256,22 +305,6 @@ public:
   const std::string& GetDefaultFontFamily() const;
 
   /**
-   * @brief Sets the font's style string.
-   *
-   * @note The style set may be changed by the underlying font system. The string is stored to be recovered.
-   *
-   * @param[in] style The font's style string.
-   */
-  void SetDefaultFontStyle( const std::string& style );
-
-  /**
-   * @brief Retrieves the font's style.
-   *
-   * @return The font's style.
-   */
-  const std::string& GetDefaultFontStyle() const;
-
-  /**
    * @brief Sets the default font weight.
    *
    * @param[in] weight The font weight.
@@ -279,6 +312,11 @@ public:
   void SetDefaultFontWeight( FontWeight weight );
 
   /**
+   * @brief Whether the font's weight has been defined.
+   */
+  bool IsDefaultFontWeightDefined() const;
+
+  /**
    * @brief Retrieves the default font weight.
    *
    * @return The default font weight.
@@ -293,6 +331,11 @@ public:
   void SetDefaultFontWidth( FontWidth width );
 
   /**
+   * @brief Whether the font's width has been defined.
+   */
+  bool IsDefaultFontWidthDefined() const;
+
+  /**
    * @brief Retrieves the default font width.
    *
    * @return The default font width.
@@ -307,6 +350,11 @@ public:
   void SetDefaultFontSlant( FontSlant slant );
 
   /**
+   * @brief Whether the font's slant has been defined.
+   */
+  bool IsDefaultFontSlantDefined() const;
+
+  /**
    * @brief Retrieves the default font slant.
    *
    * @return The default font slant.
@@ -538,20 +586,6 @@ public:
   const std::string& GetInputFontFamily() const;
 
   /**
-   * @brief Sets the input text's font style.
-   *
-   * @param[in] fontStyle The input text's font style.
-   */
-  void SetInputFontStyle( const std::string& fontStyle );
-
-  /**
-   * @brief Retrieves the input text's font style.
-   *
-   * @return The input text's font style.
-   */
-  const std::string& GetInputFontStyle() const;
-
-  /**
    * @brief Sets the input font's weight.
    *
    * @param[in] weight The input font's weight.
@@ -559,6 +593,11 @@ public:
   void SetInputFontWeight( FontWeight weight );
 
   /**
+   * @return Whether the font's weight has been defined.
+   */
+  bool IsInputFontWeightDefined() const;
+
+  /**
    * @brief Retrieves the input font's weight.
    *
    * @return The input font's weight.
@@ -573,6 +612,11 @@ public:
   void SetInputFontWidth( FontWidth width );
 
   /**
+   * @return Whether the font's width has been defined.
+   */
+  bool IsInputFontWidthDefined() const;
+
+  /**
    * @brief Retrieves the input font's width.
    *
    * @return The input font's width.
@@ -587,6 +631,11 @@ public:
   void SetInputFontSlant( FontSlant slant );
 
   /**
+   * @return Whether the font's slant has been defined.
+   */
+  bool IsInputFontSlantDefined() const;
+
+  /**
    * @brief Retrieves the input font's slant.
    *
    * @return The input font's slant.
@@ -708,13 +757,6 @@ public:
   const Vector2& GetScrollPosition() const;
 
   /**
-   * @brief Query the alignment offset.
-   *
-   * @return The alignmnet offset.
-   */
-  const Vector2& GetAlignmentOffset() const;
-
-  /**
    * @copydoc Control::GetNaturalSize()
    */
   Vector3 GetNaturalSize();
@@ -729,9 +771,10 @@ public:
    *
    * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
    * @param[in] size A the size of a bounding box to layout text within.
-   * @return True if the text model or decorations were updated.
+   *
+   * @return Whether the text model or decorations were updated.
    */
-  bool Relayout( const Size& size );
+  UpdateTextType Relayout( const Size& size );
 
   /**
    * @brief Process queued events which modify the model.
@@ -816,11 +859,11 @@ public:
   LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
 
   /**
-   * @brief Calulates the alignment of the whole text inside the bounding box.
+   * @brief Calulates the vertical offset to align the text inside the bounding box.
    *
    * @param[in] size The size of the bounding box.
    */
-  void CalculateTextAlignment( const Size& size );
+  void CalculateVerticalOffset( const Size& size );
 
   /**
    * @brief Return the layout engine.
@@ -963,11 +1006,6 @@ private:
   bool BackspaceKeyEvent();
 
   /**
-   * @brief Helper to notify IMF manager with surrounding text & cursor changes.
-   */
-  void NotifyImfManager();
-
-  /**
    * @brief Helper to clear font-specific data.
    */
   void ShowPlaceholderText();