X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.h;h=9612b1a4014779418798085adc741ff77b77fad1;hp=07e16650834c8892521382bd24d28a31704fce5a;hb=660728e83fd72194f53642fd74c09db561f88496;hpb=cbff244b295bcd2758fe93155a9b3199d85ee164 diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index 07e1665..9612b1a 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -1,5 +1,5 @@ -#ifndef __DALI_TOOLKIT_TEXT_CONTROLLER_H__ -#define __DALI_TOOLKIT_TEXT_CONTROLLER_H__ +#ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H +#define DALI_TOOLKIT_TEXT_CONTROLLER_H /* * Copyright (c) 2016 Samsung Electronics Co., Ltd. @@ -26,7 +26,7 @@ #include #include #include -#include +#include namespace Dali { @@ -38,10 +38,12 @@ namespace Text { class Controller; +class ControlInterface; +class EditableControlInterface; class View; +class RenderingController; typedef IntrusivePtr ControllerPtr; -typedef Dali::Toolkit::Text::ControlInterface ControlInterface; /** * @brief A Text Controller is used by UI Controls which display text. @@ -123,10 +125,29 @@ public: // Constructor. /** * @brief Create a new instance of a Controller. * - * @param[in] controlInterface An interface used to request a text relayout. * @return A pointer to a new Controller. */ - static ControllerPtr New( ControlInterface& controlInterface ); + static ControllerPtr New(); + + /** + * @brief Create a new instance of a Controller. + * + * @param[in] controlInterface The control's interface. + * + * @return A pointer to a new Controller. + */ + static ControllerPtr New( ControlInterface* controlInterface ); + + /** + * @brief Create a new instance of a Controller. + * + * @param[in] controlInterface The control's interface. + * @param[in] editableControlInterface The editable control's interface. + * + * @return A pointer to a new Controller. + */ + static ControllerPtr New( ControlInterface* controlInterface, + EditableControlInterface* editableControlInterface ); public: // Configure the text controller. @@ -278,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. */ - LayoutEngine::VerticalAlignment GetVerticalAlignment() const; + void SetInputModePassword( bool passwordInput ); + + /** + * @brief Returns whether the input mode type is set as password. + * + * @return True if input mode type is password + */ + bool IsInputModePassword(); public: // Update. @@ -424,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 @@ -480,22 +533,6 @@ public: // Default style & Input style const Vector4& GetShadowColor() const; /** - * @brief Sets the shadow's properties string. - * - * @note The string is stored to be recovered. - * - * @param[in] shadowProperties The shadow's properties string. - */ - void SetDefaultShadowProperties( const std::string& shadowProperties ); - - /** - * @brief Retrieves the shadow's properties string. - * - * @return The shadow's properties string. - */ - const std::string& GetDefaultShadowProperties() const; - - /** * @brief Set the underline color. * * @param[in] color color of underline. @@ -538,22 +575,6 @@ public: // Default style & Input style float GetUnderlineHeight() const; /** - * @brief Sets the underline's properties string. - * - * @note The string is stored to be recovered. - * - * @param[in] underlineProperties The underline's properties string. - */ - void SetDefaultUnderlineProperties( const std::string& underlineProperties ); - - /** - * @brief Retrieves the underline's properties string. - * - * @return The underline's properties string. - */ - const std::string& GetDefaultUnderlineProperties() const; - - /** * @brief Sets the emboss's properties string. * * @note The string is stored to be recovered. @@ -783,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. @@ -793,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(); @@ -809,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. /** @@ -821,6 +861,11 @@ public: // Relayout. */ UpdateTextType Relayout( const Size& size ); + /** + * @brief Request a relayout using the ControlInterface. + */ + void RequestRelayout(); + public: // Input style change signals. /** @@ -1058,7 +1103,18 @@ private: // Private contructors & copy operator. /** * @brief Private constructor. */ - Controller( ControlInterface& controlInterface ); + Controller(); + + /** + * @brief Private constructor. + */ + Controller( ControlInterface* controlInterface ); + + /** + * @brief Private constructor. + */ + Controller( ControlInterface* controlInterface, + EditableControlInterface* editableControlInterface ); // Undefined Controller( const Controller& handle ); @@ -1085,4 +1141,4 @@ private: } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_CONTROLLER_H__ +#endif // DALI_TOOLKIT_TEXT_CONTROLLER_H