TextModel - Layout a given range of characters inside a text.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-engine.h
index 0c17d68..e672c53 100644 (file)
 
 // INTERNAL INCLUDE
 #include <dali-toolkit/internal/text/line-run.h>
+#include <dali-toolkit/internal/text/metrics.h>
 
 namespace Dali
 {
 
-struct Vector2;
-
 namespace Toolkit
 {
 
@@ -76,6 +75,13 @@ public:
   ~LayoutEngine();
 
   /**
+   * @brief Provide the wrapper around FontClient used to get metrics
+   *
+   * @param[in] metrics Used to get metrics
+   */
+  void SetMetrics( MetricsPtr& metrics );
+
+  /**
    * @brief Choose the required layout.
    *
    * @param[in] layout The required layout.
@@ -87,7 +93,19 @@ public:
    *
    * @return The required layout.
    */
-  unsigned int GetLayout() const;
+  Layout GetLayout() const;
+
+  /**
+   * @brief Enable or disable the text ellipsis.
+   *
+   * @param[in] enabled Whether to enable the text ellipsis.
+   */
+  void SetTextEllipsisEnabled( bool enabled );
+
+  /**
+   * @return Whether the text ellipsis is enabled.
+   */
+  bool GetTextEllipsisEnabled() const;
 
   /**
    * @brief Choose the required text horizontal alignment.
@@ -118,19 +136,33 @@ public:
   VerticalAlignment GetVerticalAlignment() const;
 
   /**
+   * @brief Sets the width of the cursor.
+   *
+   * @param[in] width The width of the cursor in pixels.
+   */
+  void SetCursorWidth( int width );
+
+  /**
+   * @brief Retrieves the width of the cursor.
+   *
+   * @return The width of the cursor in pixels.
+   */
+  int GetCursorWidth() const;
+
+  /**
    * @brief Store the visual position of glyphs in the VisualModel.
    *
    * @param[in] layoutParameters The parameters needed to layout the text.
    * @param[out] glyphPositions The positions of all the glyphs.
    * @param[out] lines The laid-out lines.
-   * @param[out] actualSize The size of the text after it has been laid-out.
+   * @param[out] layoutSize The size of the text after it has been laid-out.
    *
    * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
    */
   bool LayoutText( const LayoutParameters& layoutParameters,
                    Vector<Vector2>& glyphPositions,
                    Vector<LineRun>& lines,
-                   Size& actualSize );
+                   Size& layoutSize );
 
   /**
    * @brief Re-lays out those lines with right to left characters.
@@ -138,23 +170,27 @@ public:
    * It doesn't change the phisical position of the glyphs in the model but sets their new position.
    *
    * @param[in] layoutParameters The parameters needed to layout the text.
+   * @param[in] startIndex Character index of the line from where the lines are reordered.
+   * @param[in] numberOfCharacters The number of characters.
    * @param[in,out] glyphPositions The positions of all the glyphs.
    */
   void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
+                                 CharacterIndex startIndex,
+                                 Length numberOfCharacters,
                                  Vector<Vector2>& glyphPositions );
 
   /**
    * @brief Aligns the laid out lines.
    *
-   * @param[in] layoutParameters The parameters needed to layout the text.
-   * @param[in] layoutSize The size of the laid out the text.
-   * @param[in] lines The laid-out lines.
-   * @param[in,out] glyphPositions The positions of all the glyphs.
+   * @param[in] size The size of the container where the text is laid-out.
+   * @param[in] startIndex Character index of the line from where the lines are aligned.
+   * @param[in] numberOfCharacters The number of characters.
+   * @param[in,out] lines The laid-out lines.
    */
-  void Align( const LayoutParameters& layoutParameters,
-              const Size& layoutSize,
-              const Vector<LineRun>& lines,
-              Vector<Vector2>& glyphPositions );
+  void Align( const Size& size,
+              CharacterIndex startIndex,
+              Length numberOfCharacters,
+              Vector<LineRun>& lines );
 
 private: