Merge "Implement scroll bar in the TextEditor" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
index ce5c51a..9612b1a 100644 (file)
@@ -26,7 +26,7 @@
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
-#include <dali-toolkit/internal/text/text-scroller-interface.h>
+#include <dali-toolkit/internal/text/text-model-interface.h>
 
 namespace Dali
 {
@@ -41,7 +41,7 @@ class Controller;
 class ControlInterface;
 class EditableControlInterface;
 class View;
-struct ScrollerData;
+class RenderingController;
 
 typedef IntrusivePtr<Controller> ControllerPtr;
 
@@ -56,7 +56,7 @@ typedef IntrusivePtr<Controller> ControllerPtr;
  *
  * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
  */
-class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public Text::ScrollerInterface
+class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface
 {
 public: // Enumerated types.
 
@@ -149,13 +149,6 @@ public: // Constructor.
   static ControllerPtr New( ControlInterface* controlInterface,
                             EditableControlInterface* editableControlInterface );
 
-  /**
-   * @brief Sets the text-control interface.
-   *
-   * @param[in] controlInterface The text-control interface.
-   */
-  void SetTextControlInterface( ControlInterface* controlInterface );
-
 public: // Configure the text controller.
 
   /**
@@ -210,53 +203,17 @@ public: // Configure the text controller.
   bool IsAutoScrollEnabled() const;
 
   /**
-   * @brief Sets the speed the text should automatically scroll at.
-   *
-   * @param[in] scrollSpeed The speed of scrolling in pixels per second.
-   */
-  void SetAutoscrollSpeed( int scrollSpeed );
-
-  /**
-   * @brief Retrieves the auto scroll speed.
-   *
-   * @return The auto scroll speed in pixels per second.
-   */
-  int GetAutoScrollSpeed() const;
-
-  /**
-   * @brief Sets the number of loops the text should scroll.
-   *
-   * @param[in] loopCount The number of loops.
-   */
-  void SetAutoScrollLoopCount( int loopCount );
-
-  /**
-   * @brief Retrieves the number of loops the text should scroll.
-   *
-   * @return The numebr of loops.
-   */
-  int GetAutoScrollLoopCount() const;
-
-  /**
-   * @brief Sets the gap before text wraps around when scrolling.
-   *
-   * @param[in] wrapGap The gap in pixels.
+   * @brief Get direction of the text from the first line of text,
+   * @return bool rtl (right to left) is true
    */
-  void SetAutoScrollWrapGap( float wrapGap );
+  CharacterDirection GetAutoScrollDirection() const;
 
   /**
-   * @brief Retrieves the gap before text wraps around when scrolling.
+   * @brief Get the alignment offset of the first line of text.
    *
-   * @return The gap in pixels.
+   * @return The alignment offset.
    */
-  float GetAutoScrollWrapGap() const;
-
-  /**
-   * @brief Retrieves the text's autoscroll data.
-   *
-   * @return The text's autoscroll data.
-   */
-  const ScrollerData* const GetAutoScrollData();
+  float GetAutoScrollLineAlignment() const;
 
   /**
    * @brief Enables the horizontal scrolling.
@@ -342,24 +299,56 @@ public: // Configure the text controller.
   bool IsMultiLineEnabled() const;
 
   /**
-   * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
+   * @brief Sets the text's horizontal alignment.
+   *
+   * @param[in] alignment The horizontal alignment.
+   */
+  void SetHorizontalAlignment( Layout::HorizontalAlignment alignment );
+
+  /**
+   * @copydoc ModelInterface::GetHorizontalAlignment()
+   */
+  Layout::HorizontalAlignment GetHorizontalAlignment() const;
+
+  /**
+   * @brief Sets the text's vertical alignment.
+   *
+   * @param[in] alignment The vertical alignment.
+   */
+  void SetVerticalAlignment( Layout::VerticalAlignment alignment );
+
+  /**
+   * @copydoc ModelInterface::GetVerticalAlignment()
    */
-  void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
+  Layout::VerticalAlignment GetVerticalAlignment() const;
 
   /**
-   * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
+   * @brief Enable or disable the text elide.
+   *
+   * @param[in] enabled Whether to enable the text elide.
    */
-  LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
+  void SetTextElideEnabled( bool enabled );
 
   /**
-   * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
+   * @copydoc ModelInterface::IsTextElideEnabled()
    */
-  void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
+  bool IsTextElideEnabled() const;
 
   /**
-   * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
+   * @brief Sets input type to password
+   *
+   * @note The string is displayed continuous "*"
+   *
+   * @param[in] passwordInput True if password input is enabled.
+   */
+  void SetInputModePassword( bool passwordInput );
+
+  /**
+   * @brief Returns whether the input mode type is set as password.
+   *
+   * @return True if input mode type is password
    */
-  LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
+  bool IsInputModePassword();
 
 public: // Update.
 
@@ -488,18 +477,18 @@ public: // Default style & Input style
   float GetDefaultPointSize() const;
 
   /**
-   * @brief Set the text color
+   * @brief Sets the text's default color.
    *
-   * @param textColor The text color
+   * @param color The default color.
    */
-  void SetTextColor( const Vector4& textColor );
+  void SetDefaultColor( const Vector4& color );
 
   /**
-   * @brief Retrieve the text color
+   * @brief Retrieves the text's default color.
    *
-   * @return The text color
+   * @return The default color.
    */
-  const Vector4& GetTextColor() const;
+  const Vector4& GetDefaultColor() const;
 
   /**
    * @brief Set the text color
@@ -815,7 +804,7 @@ public: // Queries & retrieves.
    *
    * @return A reference to the layout engine.
    */
-  LayoutEngine& GetLayoutEngine();
+  Layout::Engine& GetLayoutEngine();
 
   /**
    * @brief Return a view of the text.
@@ -825,13 +814,6 @@ public: // Queries & retrieves.
   View& GetView();
 
   /**
-   * @brief Query the current scroll position; the UI control is responsible for moving actors to this position.
-   *
-   * @return The scroll position.
-   */
-  const Vector2& GetScrollPosition() const;
-
-  /**
    * @copydoc Control::GetNaturalSize()
    */
   Vector3 GetNaturalSize();
@@ -841,6 +823,32 @@ public: // Queries & retrieves.
    */
   float GetHeightForWidth( float width );
 
+  /**
+   * @brief Retrieves the text's model.
+   *
+   * @return A pointer to the text's model.
+   */
+  const ModelInterface* const GetTextModel() const;
+
+  /**
+   * @brief Used to get scrolled distance by user input
+   *
+   * @return Distance from last scroll offset to new scroll offset
+   */
+  float GetScrollAmountByUserInput();
+
+  /**
+   * @brief Get latest scroll amount, control size and layout size
+   *
+   * This method is used to get information of control's scroll
+   * @param[out] scrollPosition The current scrolled position
+   * @param[out] controlHeight The size of a UI control
+   * @param[out] layoutHeight The size of a bounding box to layout text within.
+   *
+   * @return Whether the text scroll position is changed or not after last update.
+   */
+  bool GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight );
+
 public: // Relayout.
 
   /**
@@ -956,13 +964,6 @@ protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
    */
   virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
 
-private: // Inherit from TextScroller
-
-  /**
-   * @copydoc Text::ScrollerInterface::ScrollingFinished()
-   */
-  virtual void ScrollingFinished();
-
 private: // Update.
 
   /**