X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.h;h=e523dd24068004a51879f70dbbf28301b41bcc95;hb=b7108fc5f28fd650a1ea08a8692c822a63baf5bd;hp=b02bb6817369c21661ce325bf6f9ec28e12dad45;hpb=6bc33c55ece7fc30d8229f35e6e9f8b807a9a437;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h old mode 100755 new mode 100644 index b02bb68..069db55 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_CONTROLLER_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -19,33 +19,42 @@ */ // EXTERNAL INCLUDES -#include +#include #include // INTERNAL INCLUDES +#include +#include #include +#include #include -#include -#include #include +#include +#include +#include #include +#include +#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Text +namespace Dali::Toolkit::Text { - class Controller; class ControlInterface; class EditableControlInterface; class View; class RenderingController; +/** + * @brief Text selection operations . + */ +enum SelectionType +{ + INTERACTIVE = 0x0000, ///< Select the word where the cursor is located. + ALL = 0x0001, ///< Select the whole text. + NONE = 0x0002, ///< Unselect the whole text. + RANGE = 0x0003 ///< Select the range text. +}; + typedef IntrusivePtr ControllerPtr; /** @@ -62,7 +71,6 @@ typedef IntrusivePtr ControllerPtr; class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public HiddenText::Observer { public: // Enumerated types. - /** * @brief Text related operations to be done in the relayout process. */ @@ -73,21 +81,20 @@ public: // Enumerated types. GET_SCRIPTS = 0x0002, VALIDATE_FONTS = 0x0004, GET_LINE_BREAKS = 0x0008, - GET_WORD_BREAKS = 0x0010, - BIDI_INFO = 0x0020, - SHAPE_TEXT = 0x0040, - GET_GLYPH_METRICS = 0x0080, - LAYOUT = 0x0100, - UPDATE_LAYOUT_SIZE = 0x0200, - REORDER = 0x0400, - ALIGN = 0x0800, - COLOR = 0x1000, - UPDATE_DIRECTION = 0x2000, + BIDI_INFO = 0x0010, + SHAPE_TEXT = 0x0020, + GET_GLYPH_METRICS = 0x0040, + LAYOUT = 0x0080, + UPDATE_LAYOUT_SIZE = 0x0100, + REORDER = 0x0200, + ALIGN = 0x0400, + COLOR = 0x0800, + UPDATE_DIRECTION = 0x1000, ALL_OPERATIONS = 0xFFFF }; /** - * @brief Used to distinguish between regular key events and IMF events + * @brief Used to distinguish between regular key events and InputMethodContext events */ enum InsertType { @@ -128,8 +135,8 @@ public: // Enumerated types. */ enum FontSizeType { - POINT_SIZE, // The size of font in points. - PIXEL_SIZE // The size of font in pixels. + POINT_SIZE, // The size of font in points. + PIXEL_SIZE // The size of font in pixels. }; struct NoTextTap @@ -142,14 +149,28 @@ public: // Enumerated types. }; }; -public: // Constructor. + struct TextFitInfo + { + enum Property + { + TEXT_FIT_ENABLE, + TEXT_FIT_MIN_SIZE, + TEXT_FIT_MAX_SIZE, + TEXT_FIT_STEP_SIZE, + TEXT_FIT_FONT_SIZE_TYPE + }; + }; +public: // Constructor. /** * @brief Create a new instance of a Controller. * * @return A pointer to a new Controller. */ - static ControllerPtr New(); + static ControllerPtr New() + { + return ControllerPtr(new Controller()); + } /** * @brief Create a new instance of a Controller. @@ -158,35 +179,48 @@ public: // Constructor. * * @return A pointer to a new Controller. */ - static ControllerPtr New( ControlInterface* controlInterface ); + static ControllerPtr New(ControlInterface* controlInterface) + { + return ControllerPtr(new Controller(controlInterface)); + } /** * @brief Create a new instance of a Controller. * * @param[in] controlInterface The control's interface. * @param[in] editableControlInterface The editable control's interface. + * @param[in] selectableControlInterface The selectable control's interface. + * @param[in] anchorControlInterface The anchor control's interface. * * @return A pointer to a new Controller. */ - static ControllerPtr New( ControlInterface* controlInterface, - EditableControlInterface* editableControlInterface ); + static ControllerPtr New(ControlInterface* controlInterface, + EditableControlInterface* editableControlInterface, + SelectableControlInterface* selectableControlInterface, + AnchorControlInterface* anchorControlInterface) + { + return ControllerPtr(new Controller(controlInterface, + editableControlInterface, + selectableControlInterface, + anchorControlInterface)); + } public: // Configure the text controller. - /** * @brief Called to enable text input. * * @note Selectable or editable controls should call this once after Controller::New(). * @param[in] decorator Used to create cursor, selection handle decorations etc. + * @param[in] inputMethodContext Used to manager ime. */ - void EnableTextInput( DecoratorPtr decorator ); + void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext); /** * @brief Used to switch between bitmap & vector based glyphs * * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different. */ - void SetGlyphType( TextAbstraction::GlyphType glyphType ); + void SetGlyphType(TextAbstraction::GlyphType glyphType); /** * @brief Enables/disables the mark-up processor. @@ -195,7 +229,7 @@ public: // Configure the text controller. * * @param[in] enable Whether to enable the mark-up processor. */ - void SetMarkupProcessorEnabled( bool enable ); + void SetMarkupProcessorEnabled(bool enable); /** * @brief Retrieves whether the mark-up processor is enabled. @@ -207,13 +241,20 @@ public: // Configure the text controller. bool IsMarkupProcessorEnabled() const; /** + * @brief Retrieves whether the current text contains anchors. + * + * @return @e true if the current text contains anchors. @e false. + */ + bool HasAnchors() const; + + /** * @brief Enables/disables the auto text scrolling * * By default is disabled. * * @param[in] enable Whether to enable the auto scrolling */ - void SetAutoScrollEnabled( bool enable ); + void SetAutoScrollEnabled(bool enable); /** * @brief Retrieves whether auto text scrolling is enabled. @@ -242,7 +283,7 @@ public: // Configure the text controller. * * @param[in] enable Whether to enable the horizontal scrolling. */ - void SetHorizontalScrollEnabled( bool enable ); + void SetHorizontalScrollEnabled(bool enable); /** * @brief Retrieves whether the horizontal scrolling is enabled. @@ -256,7 +297,7 @@ public: // Configure the text controller. * * @param[in] enable Whether to enable the vertical scrolling. */ - void SetVerticalScrollEnabled( bool enable ); + void SetVerticalScrollEnabled(bool enable); /** * @brief Retrieves whether the verticall scrolling is enabled. @@ -270,7 +311,7 @@ public: // Configure the text controller. * * @param[in] enable Whether to enable the smooth handle panning. */ - void SetSmoothHandlePanEnabled( bool enable ); + void SetSmoothHandlePanEnabled(bool enable); /** * @brief Retrieves whether the smooth handle panning is enabled. @@ -284,7 +325,7 @@ public: // Configure the text controller. * * @param[in] maxCharacters maximum number of characters to be accepted */ - void SetMaximumNumberOfCharacters( Length maxCharacters ); + void SetMaximumNumberOfCharacters(Length maxCharacters); /** * @brief Sets the maximum number of characters that can be inserted into the TextModel @@ -299,7 +340,7 @@ public: // Configure the text controller. * @note Only editable controls should calls this. * @param[in] enabled Whether the cursor should blink or not. */ - void SetEnableCursorBlink( bool enable ); + void SetEnableCursorBlink(bool enable); /** * @brief Query whether cursor blink is enabled. @@ -313,7 +354,7 @@ public: // Configure the text controller. * * @param[in] enable \e true enables the multi-line (by default) */ - void SetMultiLineEnabled( bool enable ); + void SetMultiLineEnabled(bool enable); /** * @return Whether the multi-line layout is enabled. @@ -325,43 +366,43 @@ public: // Configure the text controller. * * @param[in] alignment The horizontal alignment. */ - void SetHorizontalAlignment( Layout::HorizontalAlignment alignment ); + void SetHorizontalAlignment(HorizontalAlignment::Type alignment); /** * @copydoc ModelInterface::GetHorizontalAlignment() */ - Layout::HorizontalAlignment GetHorizontalAlignment() const; + HorizontalAlignment::Type GetHorizontalAlignment() const; /** * @brief Sets the text's vertical alignment. * * @param[in] alignment The vertical alignment. */ - void SetVerticalAlignment( Layout::VerticalAlignment alignment ); + void SetVerticalAlignment(VerticalAlignment::Type alignment); /** * @copydoc ModelInterface::GetVerticalAlignment() */ - Layout::VerticalAlignment GetVerticalAlignment() const; + VerticalAlignment::Type GetVerticalAlignment() const; /** * @brief Sets the text's wrap mode * @param[in] text wrap mode The unit of wrapping */ - void SetLineWrapMode( Layout::LineWrap::Mode textWarpMode ); + void SetLineWrapMode(Text::LineWrap::Mode textWarpMode); /** * @brief Retrieve text wrap mode previously set. * @return text wrap mode */ - Layout::LineWrap::Mode GetLineWrapMode() const; + Text::LineWrap::Mode GetLineWrapMode() const; /** * @brief Enable or disable the text elide. * * @param[in] enabled Whether to enable the text elide. */ - void SetTextElideEnabled( bool enabled ); + void SetTextElideEnabled(bool enabled); /** * @copydoc ModelInterface::IsTextElideEnabled() @@ -369,10 +410,104 @@ public: // Configure the text controller. bool IsTextElideEnabled() const; /** + * @brief Enable or disable the text fit. + * + * @param[in] enabled Whether to enable the text fit. + */ + void SetTextFitEnabled(bool enabled); + + /** + * @brief Whether the text fit is enabled or not. + * + * @return True if the text fit is enabled + */ + bool IsTextFitEnabled() const; + + /** + * @brief Sets minimum size valid for text fit. + * + * @param[in] minimum size value. + * @param[in] type The font size type is point size or pixel size + */ + void SetTextFitMinSize(float pointSize, FontSizeType type); + + /** + * @brief Retrieves the minimum point size valid for text fit. + * + * @return The minimum point size valid for text fit + */ + float GetTextFitMinSize() const; + + /** + * @brief Sets maximum size valid for text fit. + * + * @param[in] maximum size value. + * @param[in] type The font size type is point size or pixel size + */ + void SetTextFitMaxSize(float pointSize, FontSizeType type); + + /** + * @brief Retrieves the maximum point size valid for text fit. + * + * @return The maximum point size valid for text fit + */ + float GetTextFitMaxSize() const; + + /** + * @brief Sets step size for font increase valid for text fit. + * + * @param[in] step size value. + * @param[in] type The font size type is point size or pixel size + */ + void SetTextFitStepSize(float step, FontSizeType type); + + /** + * @brief Retrieves the step point size valid for text fit. + * + * @return The step point size valid for text fit + */ + float GetTextFitStepSize() const; + + /** + * @brief Sets content size valid for text fit. + * + * @param[in] Content size value. + */ + void SetTextFitContentSize(Vector2 size); + + /** + * @brief Retrieves the content size valid for text fit. + * + * @return The content size valid for text fit + */ + Vector2 GetTextFitContentSize() const; + + /** + * @brief Retrieve the fited point size. + * + * @return The fited point size. + */ + float GetTextFitPointSize() const; + + /** + * @brief Sets whether the text fit properties have changed. + * + * @param[in] changed Whether to changed the text fit. + */ + void SetTextFitChanged(bool changed); + + /** + * @brief Whether the text fit properties are changed or not. + * + * @return True if the text fit properties are changed + */ + bool IsTextFitChanged() const; + + /** * @brief Enable or disable the placeholder text elide. * @param enabled Whether to enable the placeholder text elide. */ - void SetPlaceholderTextElideEnabled( bool enabled ); + void SetPlaceholderTextElideEnabled(bool enabled); /** * @brief Whether the placeholder text elide property is enabled. @@ -384,7 +519,7 @@ public: // Configure the text controller. * @brief Enable or disable the text selection. * @param[in] enabled Whether to enable the text selection. */ - void SetSelectionEnabled( bool enabled ); + void SetSelectionEnabled(bool enabled); /** * @brief Whether the text selection is enabled or not. @@ -393,13 +528,53 @@ public: // Configure the text controller. bool IsSelectionEnabled() const; /** + * @brief Enable or disable the text selection using Shift key. + * @param enabled Whether to enable the text selection using Shift key + */ + void SetShiftSelectionEnabled(bool enabled); + + /** + * @brief Whether the text selection using Shift key is enabled or not. + * @return True if the text selection using Shift key is enabled + */ + bool IsShiftSelectionEnabled() const; + + /** + * @brief Enable or disable the grab handles for text selection. + * + * @param[in] enabled Whether to enable the grab handles + */ + void SetGrabHandleEnabled(bool enabled); + + /** + * @brief Returns whether the grab handles are enabled. + * + * @return True if the grab handles are enabled + */ + bool IsGrabHandleEnabled() const; + + /** + * @brief Enable or disable the grab handles for text selection. + * + * @param[in] enabled Whether to enable the grab handles + */ + void SetGrabHandlePopupEnabled(bool enabled); + + /** + * @brief Returns whether the grab handles are enabled. + * + * @return True if the grab handles are enabled + */ + bool IsGrabHandlePopupEnabled() const; + + /** * @brief Sets input type to password * * @note The string is displayed hidden character * * @param[in] passwordInput True if password input is enabled. */ - void SetInputModePassword( bool passwordInput ); + void SetInputModePassword(bool passwordInput); /** * @brief Returns whether the input mode type is set as password. @@ -413,7 +588,7 @@ public: // Configure the text controller. * * @param[in] action The action to do. */ - void SetNoTextDoubleTapAction( NoTextTap::Action action ); + void SetNoTextDoubleTapAction(NoTextTap::Action action); /** * @brief Retrieves the action when there is a double tap event on top of a text area with no text. @@ -427,7 +602,7 @@ public: // Configure the text controller. * * @param[in] action The action to do. */ - void SetNoTextLongPressAction( NoTextTap::Action action ); + void SetNoTextLongPressAction(NoTextTap::Action action); /** * @brief Retrieves the action when there is a long press event on top of a text area with no text. @@ -446,7 +621,7 @@ public: // Configure the text controller. * Set method underline setting were set by * @param[in] bool, true if set by string */ - void UnderlineSetByString( bool setByString ); + void UnderlineSetByString(bool setByString); /** * @brief Query if shadow settings were provided by string or map @@ -458,7 +633,19 @@ public: // Configure the text controller. * Set method shadow setting were set by * @param[in] bool, true if set by string */ - void ShadowSetByString( bool setByString ); + void ShadowSetByString(bool setByString); + + /** + * @brief Query if outline settings were provided by string or map + * @return bool true if set by string + */ + bool IsOutlineSetByString(); + + /** + * Set method outline setting were set by + * @param[in] bool, true if set by string + */ + void OutlineSetByString(bool setByString); /** * @brief Query if font style settings were provided by string or map @@ -470,24 +657,77 @@ public: // Configure the text controller. * Set method font style setting were set by * @param[in] bool, true if set by string */ - void FontStyleSetByString( bool setByString ); + void FontStyleSetByString(bool setByString); -public: // Update. + /** + * @brief Query if Strikethrough settings were provided by string or map + * @return bool true if set by string + */ + bool IsStrikethroughSetByString(); + + /** + * Set method Strikethrough setting were set by + * @param[in] bool, true if set by string + */ + void StrikethroughSetByString(bool setByString); /** + * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics + * + * @param[in] height The height in pixels of the strikethrough + */ + void SetStrikethroughHeight(float height); + + /** + * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics + * + * @return The height of the strikethrough, or 0 if height is not overrided. + */ + float GetStrikethroughHeight() const; + + /** + * @brief Set the strikethrough color. + * + * @param[in] color color of strikethrough. + */ + void SetStrikethroughColor(const Vector4& color); + + /** + * @brief Retrieve the strikethrough color. + * + * @return The strikethrough color. + */ + const Vector4& GetStrikethroughColor() const; + + /** + * @brief Set the strikethrough enabled flag. + * + * @param[in] enabled The strikethrough enabled flag. + */ + void SetStrikethroughEnabled(bool enabled); + + /** + * @brief Returns whether the text has a strikethrough or not. + * + * @return The strikethrough state. + */ + bool IsStrikethroughEnabled() const; + +public: // Update. + /** * @brief Replaces any text previously set. * * @note This will be converted into UTF-32 when stored in the text model. * @param[in] text A string of UTF-8 characters. */ - void SetText( const std::string& text ); + void SetText(const std::string& text); /** * @brief Retrieve any text previously set. * * @param[out] text A string of UTF-8 characters. */ - void GetText( std::string& text ) const; + void GetText(std::string& text) const; /** * @brief Replaces any placeholder text previously set. @@ -495,7 +735,7 @@ public: // Update. * @param[in] type Different placeholder-text can be shown when the control is active/inactive. * @param[in] text A string of UTF-8 characters. */ - void SetPlaceholderText( PlaceholderType type, const std::string& text ); + void SetPlaceholderText(PlaceholderType type, const std::string& text); /** * @brief Retrieve any placeholder text previously set. @@ -503,22 +743,53 @@ public: // Update. * @param[in] type Different placeholder-text can be shown when the control is active/inactive. * @param[out] A string of UTF-8 characters. */ - void GetPlaceholderText( PlaceholderType type, std::string& text ) const; + void GetPlaceholderText(PlaceholderType type, std::string& text) const; /** * @ brief Update the text after a font change * @param[in] newDefaultFont The new font to change to */ - void UpdateAfterFontChange( const std::string& newDefaultFont ); + void UpdateAfterFontChange(const std::string& newDefaultFont); -public: // Default style & Input style + /** + * @brief The method acquires currently selected text + * @param selectedText variable to place selected text in + */ + void RetrieveSelection(std::string& selectedText) const; + + /** + * @brief The method sets selection in given range + * @param start index of first character + * @param end index of first character after selection + */ + void SetSelection(int start, int end); /** + * @brief This method retrieve indexes of current selection + * + * @return a pair, where first element is left index of selection and second is the right one + */ + std::pair GetSelectionIndexes() const; + + /** + * Place string in system clipboard + * @param source std::string + */ + void CopyStringToClipboard(const std::string& source); + + /** + * Place currently selected text in system clipboard + * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard + */ + void SendSelectionToClipboard(bool deleteAfterSending); + +public: // Default style & Input style + /** * @brief Set the default font family. * * @param[in] defaultFontFamily The default font family. */ - void SetDefaultFontFamily( const std::string& defaultFontFamily ); + void SetDefaultFontFamily(const std::string& defaultFontFamily); /** * @brief Retrieve the default font family. @@ -531,7 +802,7 @@ public: // Default style & Input style * @brief Sets the placeholder text font family. * @param[in] placeholderTextFontFamily The placeholder text font family. */ - void SetPlaceholderFontFamily( const std::string& placeholderTextFontFamily ); + void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily); /** * @brief Retrieves the placeholder text font family. @@ -545,7 +816,7 @@ public: // Default style & Input style * * @param[in] weight The font weight. */ - void SetDefaultFontWeight( FontWeight weight ); + void SetDefaultFontWeight(FontWeight weight); /** * @brief Whether the font's weight has been defined. @@ -564,7 +835,7 @@ public: // Default style & Input style * * @param[in] weight The font weight */ - void SetPlaceholderTextFontWeight( FontWeight weight ); + void SetPlaceholderTextFontWeight(FontWeight weight); /** * @brief Whether the font's weight has been defined. @@ -585,7 +856,7 @@ public: // Default style & Input style * * @param[in] width The font width. */ - void SetDefaultFontWidth( FontWidth width ); + void SetDefaultFontWidth(FontWidth width); /** * @brief Whether the font's width has been defined. @@ -604,7 +875,7 @@ public: // Default style & Input style * * @param[in] width The font width */ - void SetPlaceholderTextFontWidth( FontWidth width ); + void SetPlaceholderTextFontWidth(FontWidth width); /** * @brief Whether the font's width has been defined. @@ -625,7 +896,7 @@ public: // Default style & Input style * * @param[in] slant The font slant. */ - void SetDefaultFontSlant( FontSlant slant ); + void SetDefaultFontSlant(FontSlant slant); /** * @brief Whether the font's slant has been defined. @@ -644,7 +915,7 @@ public: // Default style & Input style * * @param[in] slant The font slant */ - void SetPlaceholderTextFontSlant( FontSlant slant ); + void SetPlaceholderTextFontSlant(FontSlant slant); /** * @brief Whether the font's slant has been defined. @@ -666,7 +937,7 @@ public: // Default style & Input style * @param[in] fontSize The default font size * @param[in] type The font size type is point size or pixel size */ - void SetDefaultFontSize( float fontSize, FontSizeType type ); + void SetDefaultFontSize(float fontSize, FontSizeType type); /** * @brief Retrieve the default point size. @@ -674,28 +945,56 @@ public: // Default style & Input style * @param[in] type The font size type * @return The default point size. */ - float GetDefaultFontSize( FontSizeType type ) const; + float GetDefaultFontSize(FontSizeType type) const; + + /** + * @brief Set the font size scale. + * + * @param[in] scale The font size scale + */ + void SetFontSizeScale(float scale); + + /** + * @brief Get the font size scale. + * + * @return The font size scale. + */ + float GetFontSizeScale() const; + + /** + * @brief Set the font size scale enabled flag. + * + * @param[in] enabled whether to enable the font size scale. + */ + void SetFontSizeScaleEnabled(bool enabled); + + /** + * @brief Returns whether the font size scale is enabled or not. + * + * @return @e true if the font size scale is enabled, otherwise returns @e false. + */ + bool IsFontSizeScaleEnabled() const; /** * @brief Sets the Placeholder text font size. * @param[in] fontSize The placeholder text font size * @param[in] type The font size type is point size or pixel size */ - void SetPlaceholderTextFontSize( float fontSize, FontSizeType type ); + void SetPlaceholderTextFontSize(float fontSize, FontSizeType type); /** * @brief Retrieves the Placeholder text font size. * @param[in] type The font size type * @return The placeholder font size */ - float GetPlaceholderTextFontSize( FontSizeType type ) const; + float GetPlaceholderTextFontSize(FontSizeType type) const; /** * @brief Sets the text's default color. * * @param color The default color. */ - void SetDefaultColor( const Vector4& color ); + void SetDefaultColor(const Vector4& color); /** * @brief Retrieves the text's default color. @@ -709,7 +1008,7 @@ public: // Default style & Input style * * @param textColor The text color */ - void SetPlaceholderTextColor( const Vector4& textColor ); + void SetPlaceholderTextColor(const Vector4& textColor); /** * @brief Retrieve the text color @@ -723,7 +1022,7 @@ public: // Default style & Input style * * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow. */ - void SetShadowOffset( const Vector2& shadowOffset ); + void SetShadowOffset(const Vector2& shadowOffset); /** * @brief Retrieve the shadow offset. @@ -737,7 +1036,7 @@ public: // Default style & Input style * * @param[in] shadowColor The shadow color. */ - void SetShadowColor( const Vector4& shadowColor ); + void SetShadowColor(const Vector4& shadowColor); /** * @brief Retrieve the shadow color. @@ -747,11 +1046,25 @@ public: // Default style & Input style const Vector4& GetShadowColor() const; /** + * @brief Set the shadow blur radius. + * + * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur. + */ + void SetShadowBlurRadius(const float& shadowBlurRadius); + + /** + * @brief Retrieve the shadow blur radius. + * + * @return The shadow blur radius. + */ + const float& GetShadowBlurRadius() const; + + /** * @brief Set the underline color. * * @param[in] color color of underline. */ - void SetUnderlineColor( const Vector4& color ); + void SetUnderlineColor(const Vector4& color); /** * @brief Retrieve the underline color. @@ -765,7 +1078,7 @@ public: // Default style & Input style * * @param[in] enabled The underline enabled flag. */ - void SetUnderlineEnabled( bool enabled ); + void SetUnderlineEnabled(bool enabled); /** * @brief Returns whether the text is underlined or not. @@ -779,7 +1092,7 @@ public: // Default style & Input style * * @param[in] height The height in pixels of the underline */ - void SetUnderlineHeight( float height ); + void SetUnderlineHeight(float height); /** * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics @@ -789,11 +1102,51 @@ public: // Default style & Input style float GetUnderlineHeight() const; /** + * @brief Sets the underline type. + * @param[in] type The underline type. + */ + void SetUnderlineType(Text::Underline::Type type); + + /** + * @brief Retrieve underline type. + * @return The underline type. + */ + Text::Underline::Type GetUnderlineType() const; + + /** + * @brief Set the width of the dashes of the dashed underline. + * + * @param[in] width The width in pixels of the dashes of the dashed underline. + */ + void SetDashedUnderlineWidth(float width); + + /** + * @brief Retrieves the width of the dashes of the dashed underline. + * + * @return The width of the dashes of the dashed underline. + */ + float GetDashedUnderlineWidth() const; + + /** + * @brief Set the gap between the dashes of the dashed underline. + * + * @param[in] gap The gap between the dashes of the dashed underline. + */ + void SetDashedUnderlineGap(float gap); + + /** + * @brief Retrieves the gap between the dashes of the dashed underline. + * + * @return The The gap between the dashes of the dashed underline. + */ + float GetDashedUnderlineGap() const; + + /** * @brief Set the outline color. * * @param[in] color color of outline. */ - void SetOutlineColor( const Vector4& color ); + void SetOutlineColor(const Vector4& color); /** * @brief Retrieve the outline color. @@ -807,14 +1160,42 @@ public: // Default style & Input style * * @param[in] width The width in pixels of the outline, 0 indicates no outline */ - void SetOutlineWidth( float width ); + void SetOutlineWidth(uint16_t width); /** * @brief Retrieves the width of an outline * * @return The width of the outline. */ - float GetOutlineWidth() const; + uint16_t GetOutlineWidth() const; + + /** + * @brief Set the background color. + * + * @param[in] color color of background. + */ + void SetBackgroundColor(const Vector4& color); + + /** + * @brief Retrieve the background color. + * + * @return The background color. + */ + const Vector4& GetBackgroundColor() const; + + /** + * @brief Set the background enabled flag. + * + * @param[in] enabled The background enabled flag. + */ + void SetBackgroundEnabled(bool enabled); + + /** + * @brief Returns whether to enable text background or not. + * + * @return Whether text background is enabled. + */ + bool IsBackgroundEnabled() const; /** * @brief Sets the emboss's properties string. @@ -823,7 +1204,7 @@ public: // Default style & Input style * * @param[in] embossProperties The emboss's properties string. */ - void SetDefaultEmbossProperties( const std::string& embossProperties ); + void SetDefaultEmbossProperties(const std::string& embossProperties); /** * @brief Retrieves the emboss's properties string. @@ -839,7 +1220,7 @@ public: // Default style & Input style * * @param[in] outlineProperties The outline's properties string. */ - void SetDefaultOutlineProperties( const std::string& outlineProperties ); + void SetDefaultOutlineProperties(const std::string& outlineProperties); /** * @brief Retrieves the outline's properties string. @@ -852,8 +1233,10 @@ public: // Default style & Input style * @brief Sets the default line spacing. * * @param[in] lineSpacing The line spacing. + * + * @return True if lineSpacing has been updated, false otherwise */ - void SetDefaultLineSpacing( float lineSpacing ); + bool SetDefaultLineSpacing(float lineSpacing); /** * @brief Retrieves the default line spacing. @@ -863,11 +1246,27 @@ public: // Default style & Input style float GetDefaultLineSpacing() const; /** + * @brief Sets the default line size. + * + * @param[in] lineSize The line size. + * + * @return True if lineSize has been updated, false otherwise + */ + bool SetDefaultLineSize(float lineSize); + + /** + * @brief Retrieves the default line size. + * + * @return The line size. + */ + float GetDefaultLineSize() const; + + /** * @brief Sets the input text's color. * * @param[in] color The input text's color. */ - void SetInputColor( const Vector4& color ); + void SetInputColor(const Vector4& color); /** * @brief Retrieves the input text's color. @@ -881,7 +1280,7 @@ public: // Default style & Input style * * @param[in] fontFamily The text's font family name. */ - void SetInputFontFamily( const std::string& fontFamily ); + void SetInputFontFamily(const std::string& fontFamily); /** * @brief Retrieves the input text's font family name. @@ -895,7 +1294,7 @@ public: // Default style & Input style * * @param[in] weight The input font's weight. */ - void SetInputFontWeight( FontWeight weight ); + void SetInputFontWeight(FontWeight weight); /** * @return Whether the font's weight has been defined. @@ -914,7 +1313,7 @@ public: // Default style & Input style * * @param[in] width The input font's width. */ - void SetInputFontWidth( FontWidth width ); + void SetInputFontWidth(FontWidth width); /** * @return Whether the font's width has been defined. @@ -933,7 +1332,7 @@ public: // Default style & Input style * * @param[in] slant The input font's slant. */ - void SetInputFontSlant( FontSlant slant ); + void SetInputFontSlant(FontSlant slant); /** * @return Whether the font's slant has been defined. @@ -952,7 +1351,7 @@ public: // Default style & Input style * * @param[in] size The input font's point size. */ - void SetInputFontPointSize( float size ); + void SetInputFontPointSize(float size); /** * @brief Retrieves the input font's point size. @@ -966,7 +1365,7 @@ public: // Default style & Input style * * @param[in] lineSpacing The line spacing. */ - void SetInputLineSpacing( float lineSpacing ); + void SetInputLineSpacing(float lineSpacing); /** * @brief Retrieves the input line spacing. @@ -982,7 +1381,7 @@ public: // Default style & Input style * * @param[in] shadowProperties The shadow's properties string. */ - void SetInputShadowProperties( const std::string& shadowProperties ); + void SetInputShadowProperties(const std::string& shadowProperties); /** * @brief Retrieves the input shadow's properties string. @@ -998,7 +1397,7 @@ public: // Default style & Input style * * @param[in] underlineProperties The underline's properties string. */ - void SetInputUnderlineProperties( const std::string& underlineProperties ); + void SetInputUnderlineProperties(const std::string& underlineProperties); /** * @brief Retrieves the input underline's properties string. @@ -1014,7 +1413,7 @@ public: // Default style & Input style * * @param[in] embossProperties The emboss's properties string. */ - void SetInputEmbossProperties( const std::string& embossProperties ); + void SetInputEmbossProperties(const std::string& embossProperties); /** * @brief Retrieves the input emboss's properties string. @@ -1030,7 +1429,7 @@ public: // Default style & Input style * * @param[in] outlineProperties The outline's properties string. */ - void SetInputOutlineProperties( const std::string& outlineProperties ); + void SetInputOutlineProperties(const std::string& outlineProperties); /** * @brief Retrieves the input outline's properties string. @@ -1040,14 +1439,36 @@ public: // Default style & Input style const std::string& GetInputOutlineProperties() const; /** + * @brief Sets the input strikethrough's properties string. + * + * @note The string is stored to be recovered. + * + * @param[in] strikethroughProperties The strikethrough's properties string. + */ + void SetInputStrikethroughProperties(const std::string& strikethroughProperties); + + /** + * @brief Retrieves the input strikethrough's properties string. + * + * @return The strikethrough's properties string. + */ + const std::string& GetInputStrikethroughProperties() const; + + /** * @brief Set the control's interface. * * @param[in] controlInterface The control's interface. */ - void SetControlInterface( ControlInterface* controlInterface ); + void SetControlInterface(ControlInterface* controlInterface); -public: // Queries & retrieves. + /** + * @brief Set the anchor control's interface. + * + * @param[in] anchorControlInterface The control's interface. + */ + void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface); +public: // Queries & retrieves. /** * @brief Return the layout engine. * @@ -1070,14 +1491,26 @@ public: // Queries & retrieves. /** * @copydoc Control::GetHeightForWidth() */ - float GetHeightForWidth( float width ); + float GetHeightForWidth(float width); + + /** + * @brief Calculates the point size for text for given layout() + */ + void FitPointSizeforLayout(Size layoutSize); + + /** + * @brief Checks if the point size fits within the layout size. + * + * @return Whether the point size fits within the layout size. + */ + bool CheckForTextFit(float pointSize, Size& layoutSize); /** * @brief Retrieves the text's number of lines for a given width. * @param[in] width The width of the text's area. * @ return The number of lines. */ - int GetLineCount( float width ); + int GetLineCount(float width); /** * @brief Retrieves the text's model. @@ -1103,43 +1536,153 @@ public: // Queries & retrieves. * * @return Whether the text scroll position is changed or not after last update. */ - bool GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight ); + bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight); /** * @brief Used to set the hidden input option */ - void SetHiddenInputOption( const Property::Map& options ); + void SetHiddenInputOption(const Property::Map& options); /** * @brief Used to get the hidden input option */ - void GetHiddenInputOption( Property::Map& options ); + void GetHiddenInputOption(Property::Map& options); + + /** + * @brief Used to set the input filter option + */ + void SetInputFilterOption(const Property::Map& options); + + /** + * @brief Used to get the input filter option + */ + void GetInputFilterOption(Property::Map& options); /** * @brief Sets the Placeholder Properties. * * @param[in] map The placeholder property map */ - void SetPlaceholderProperty( const Property::Map& map ); + void SetPlaceholderProperty(const Property::Map& map); /** * @brief Retrieves the Placeholder Property map. * * @param[out] map The property map */ - void GetPlaceholderProperty( Property::Map& map ); + void GetPlaceholderProperty(Property::Map& map); -public: // Relayout. + /** + * @brief Checks text direction. + * @return The text direction. + */ + Toolkit::DevelText::TextDirection::Type GetTextDirection(); + + /** + * @brief Retrieves vertical line alignment + * @return The vertical line alignment + */ + Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const; + + /** + * @brief Sets vertical line alignment + * @param[in] alignment The vertical line alignment for the text + */ + void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment); + + /** + * @brief Retrieves ellipsis position + * @return The ellipsis position + */ + Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const; + + /** + * @brief Sets ellipsis position + * @param[in] ellipsisPosition The ellipsis position for the text + */ + void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition); + + /** + * @brief Retrieves ignoreSpaceAfterText value from model + * @return The value of ignoreSpaceAfterText + */ + bool IsIgnoreSpacesAfterText() const; + + /** + * @brief Sets ignoreSpaceAfterText value to model + * @param[in] ignore The value of ignoreSpacesAfterText for the text + */ + void SetIgnoreSpacesAfterText(bool ignore); + + /** + * @brief Sets SetMatchLayoutDirection value to model + * @param[in] match The value of matchLayoutDirection for the text + */ + void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type); + + /** + * @brief Retrieves matchLayoutDirection value from model + * @return The value of matchLayoutDirection + */ + DevelText::MatchLayoutDirection GetMatchLayoutDirection() const; + + /** + * @brief Sets layoutDirection type value. + * @param[in] layoutDirection The value of the layout direction type. + */ + void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection); + + /** + * @brief Gets layoutDirection type value. + * @param[in] actor The actor which will get the layout direction type. + * @return The value of the layout direction type. + */ + Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const; /** + * @brief Get the rendered size of a specific text range. + * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line. + * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction. + * + * @param[in] startIndex start index of the text requested to calculate size for. + * @param[in] endIndex end index(included) of the text requested to calculate size for. + * @return list of sizes of the reuested text. + */ + Vector GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex); + + /** + * @brief Get the top/left rendered position of a specific text range. + * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line. + * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction. + * + * @param[in] startIndex start index of the text requested to get position to. + * @param[in] endIndex end index(included) of the text requested to get position to. + * @return list of positions of the requested text. + */ + Vector GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex); + + /** + * @brief Sets the layout direction changed. + */ + void ChangedLayoutDirection(); + + /** + * @brief Retrieves if showing real text or not. + * @return The value of showing real text. + */ + bool IsShowingRealText() const; + +public: // Relayout. + /** * @brief Triggers a relayout which updates View (if necessary). * * @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. + * @param[in] layoutDirection The direction of the system language. * * @return Whether the text model or decorations were updated. */ - UpdateTextType Relayout( const Size& size ); + UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT); /** * @brief Request a relayout using the ControlInterface. @@ -1147,7 +1690,6 @@ public: // Relayout. void RequestRelayout(); public: // Input style change signals. - /** * @return Whether the queue of input style changed signals is empty. */ @@ -1162,7 +1704,6 @@ public: // Input style change signals. void ProcessInputStyleChangedSignals(); public: // Text-input Event Queuing. - /** * @brief Called by editable UI controls when keyboard focus is gained. */ @@ -1177,9 +1718,16 @@ public: // Text-input Event Queuing. * @brief Called by editable UI controls when key events are received. * * @param[in] event The key event. - * @param[in] type Used to distinguish between regular key events and IMF events. + * @param[in] type Used to distinguish between regular key events and InputMethodContext events. + */ + bool KeyEvent(const Dali::KeyEvent& event); + + /** + * @brief Called by anchor when a tap gesture occurs. + * @param[in] x The x position relative to the top-left of the parent control. + * @param[in] y The y position relative to the top-left of the parent control. */ - bool KeyEvent( const Dali::KeyEvent& event ); + void AnchorEvent(float x, float y); /** * @brief Called by editable UI controls when a tap gesture occurs. @@ -1187,7 +1735,7 @@ public: // Text-input Event Queuing. * @param[in] x The x position relative to the top-left of the parent control. * @param[in] y The y position relative to the top-left of the parent control. */ - void TapEvent( unsigned int tapCount, float x, float y ); + void TapEvent(unsigned int tapCount, float x, float y); /** * @brief Called by editable UI controls when a pan gesture occurs. @@ -1195,7 +1743,7 @@ public: // Text-input Event Queuing. * @param[in] state The state of the gesture. * @param[in] displacement This distance panned since the last pan gesture. */ - void PanEvent( Gesture::State state, const Vector2& displacement ); + void PanEvent(GestureState state, const Vector2& displacement); /** * @brief Called by editable UI controls when a long press gesture occurs. @@ -1204,235 +1752,238 @@ public: // Text-input Event Queuing. * @param[in] x The x position relative to the top-left of the parent control. * @param[in] y The y position relative to the top-left of the parent control. */ - void LongPressEvent( Gesture::State state, float x, float y ); + void LongPressEvent(GestureState state, float x, float y); /** - * @brief Event received from IMF manager + * @brief Used to get the Primary cursor position. * - * @param[in] imfManager The IMF manager. - * @param[in] imfEvent The event received. - * @return A data struture indicating if update is needed, cursor position and current text. + * @return Primary cursor position. */ - ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent ); + CharacterIndex GetPrimaryCursorPosition() const; /** - * @brief Event from Clipboard notifying an Item has been selected for pasting + * @brief Used to set the Primary cursor position. + * + * @param[in] index for the Primary cursor position. + * @param[in] focused true if UI control has gained focus to receive key event, false otherwise. + * @return[in] true if cursor position changed, false otherwise. */ - void PasteClipboardItemEvent(); + bool SetPrimaryCursorPosition(CharacterIndex index, bool focused); /** - * @brief Return true when text control should clear key input focus when escape key is pressed. + * @brief Creates a selection event. * - * @return Whether text control should clear key input focus or not when escape key is pressed. + * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed. + * + * @param[in] x The x position relative to the top-left of the parent control. + * @param[in] y The y position relative to the top-left of the parent control. + * @param[in] selection type like the whole text is selected or unselected. */ - bool ShouldClearFocusOnEscape() const; - -protected: // Inherit from Text::Decorator::ControllerInterface. + void SelectEvent(float x, float y, SelectionType selection); /** - * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize() + * @copydoc Text::SelectableControlInterface::SetTextSelectionRange() */ - virtual void GetTargetSize( Vector2& targetSize ); + void SetTextSelectionRange(const uint32_t* start, const uint32_t* end); /** - * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration() + * @copydoc Text::SelectableControlInterface::GetTextSelectionRange() */ - virtual void AddDecoration( Actor& actor, bool needsClipping ); + Uint32Pair GetTextSelectionRange() const; /** - * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent() + * @copydoc Text::SelectableControlInterface::SelectWholeText() */ - virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y ); + void SelectWholeText(); -protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface. + /** + * @copydoc Text::EditableControlInterface::CopyText() + */ + string CopyText(); /** - * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched() + * @copydoc Text::EditableControlInterface::CutText() */ - virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button ); + string CutText(); -protected: // Inherit from HiddenText. + /** + * @copydoc Text::EditableControlInterface::PasteText() + */ + void PasteText(); /** - * @brief Invoked from HiddenText when showing time of the last character was expired + * @copydoc Text::SelectableControlInterface::SelectNone() */ - virtual void DisplayTimeExpired(); + void SelectNone(); -private: // Update. + /** + * @copydoc Text::SelectableControlInterface::SelectText() + */ + void SelectText(const uint32_t start, const uint32_t end); /** - * @brief Called by editable UI controls when key events are received. - * - * @param[in] text The text to insert. - * @param[in] type Used to distinguish between regular key events and IMF events. + * @copydoc Text::SelectableControlInterface::GetSelectedText() */ - void InsertText( const std::string& text, InsertType type ); + string GetSelectedText() const; /** - * @brief Paste given string into Text model - * @param[in] stringToPaste this string will be inserted into the text model + * @copydoc Text::EditableControlInterface::IsEditable() */ - void PasteText( const std::string& stringToPaste ); + virtual bool IsEditable() const; /** - * @brief Remove a given number of characters - * - * When predictve text is used the pre-edit text is removed and inserted again with the new characters. - * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input - * style when pre-edit text is removed. - * - * @param[in] cursorOffset Start position from the current cursor position to start deleting characters. - * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset. - * @param[in] type Whether to update the input style. - * @return True if the remove was successful. + * @copydoc Text::EditableControlInterface::SetEditable() */ - bool RemoveText( int cursorOffset, - int numberOfCharacters, - UpdateInputStyleType type ); + virtual void SetEditable(bool editable); /** - * @brief Checks if text is selected and if so removes it. - * @return true if text was removed + * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy() */ - bool RemoveSelectedText(); + virtual void ScrollBy(Vector2 scroll); -private: // Relayout. + /** + * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition() + */ + float GetHorizontalScrollPosition(); /** - * @brief Lays-out the text. - * - * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method. - * - * @param[in] size A the size of a bounding box to layout text within. - * @param[in] operations The layout operations which need to be done. - * @param[out] layoutSize The size of the laid-out text. + * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition() */ - bool DoRelayout( const Size& size, - OperationsMask operations, - Size& layoutSize ); + float GetVerticalScrollPosition(); /** - * @brief Calulates the vertical offset to align the text inside the bounding box. + * @brief Event received from input method context * - * @param[in] size The size of the bounding box. + * @param[in] inputMethodContext The input method context. + * @param[in] inputMethodContextEvent The event received. + * @return A data struture indicating if update is needed, cursor position and current text. */ - void CalculateVerticalOffset( const Size& size ); - -private: // Events. + InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent); /** - * @brief Process queued events which modify the model. + * @brief Event from Clipboard notifying an Item has been selected for pasting */ - void ProcessModifyEvents(); + void PasteClipboardItemEvent(); /** - * @brief Used to process an event queued from SetText() + * @brief Return true when text control should clear key input focus when escape key is pressed. + * + * @return Whether text control should clear key input focus or not when escape key is pressed. */ - void TextReplacedEvent(); + bool ShouldClearFocusOnEscape() const; /** - * @brief Used to process an event queued from key events etc. + * @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. */ - void TextInsertedEvent(); + Actor CreateBackgroundActor(); /** - * @brief Used to process an event queued from backspace key etc. + * @brief Used to reset the cursor position after setting a new text. + * + * @param[in] cursorIndex Where to place the cursor. */ - void TextDeletedEvent(); + void ResetCursorPosition(CharacterIndex cursorIndex); /** - * @brief Creates a selection event. - * - * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed. - * - * @param[in] x The x position relative to the top-left of the parent control. - * @param[in] y The y position relative to the top-left of the parent control. - * @param[in] selectAll Whether the whole text is selected. + * @brief The method acquires current position of cursor + * @return unsigned value with cursor position */ - void SelectEvent( float x, float y, bool selectAll ); + CharacterIndex GetCursorPosition(); /** - * @brief Helper to KeyEvent() to handle the backspace case. + * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text * - * @return True if a character was deleted. + * @param[out] anchorActors the vector of actor (empty collection if no anchors available). */ - bool BackspaceKeyEvent(); - -private: // Helpers. + void GetAnchorActors(std::vector& anchorActors); /** - * @brief Used to remove the text included the placeholder text. + * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset + * + * @param[in] characterOffset A position in text coords. + * + * @return the index in anchor vector (-1 if an anchor not found) */ - void ResetText(); + int GetAnchorIndex(size_t characterOffset); +protected: // Inherit from Text::Decorator::ControllerInterface. /** - * @brief Helper to show the place holder text.. + * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize() */ - void ShowPlaceholderText(); + void GetTargetSize(Vector2& targetSize) override; /** - * @brief Helper to clear font-specific data (only). + * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration() */ - void ClearFontData(); + void AddDecoration(Actor& actor, bool needsClipping) override; /** - * @brief Helper to clear text's style data. + * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent() */ - void ClearStyleData(); + void DecorationEvent(HandleType handle, HandleState state, float x, float y) override; +protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface. /** - * @brief Used to reset the cursor position after setting a new text. - * - * @param[in] cursorIndex Where to place the cursor. + * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched() */ - void ResetCursorPosition( CharacterIndex cursorIndex ); + void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override; +protected: // Inherit from HiddenText. /** - * @brief Used to reset the scroll position after setting a new text. + * @brief Invoked from HiddenText when showing time of the last character was expired */ - void ResetScrollPosition(); + void DisplayTimeExpired() override; private: // Private contructors & copy operator. - /** * @brief Private constructor. */ - Controller(); + Controller() + : Controller(nullptr, nullptr, nullptr, nullptr) + { + } /** * @brief Private constructor. */ - Controller( ControlInterface* controlInterface ); + Controller(ControlInterface* controlInterface) + : Controller(controlInterface, nullptr, nullptr, nullptr) + { + } /** * @brief Private constructor. */ - Controller( ControlInterface* controlInterface, - EditableControlInterface* editableControlInterface ); - - // Undefined - Controller( const Controller& handle ); + Controller(ControlInterface* controlInterface, + EditableControlInterface* editableControlInterface, + SelectableControlInterface* selectableControlInterface, + AnchorControlInterface* anchorControlInterface); - // Undefined - Controller& operator=( const Controller& handle ); + Controller(const Controller& handle) = delete; + Controller& operator=(const Controller& handle) = delete; protected: // Destructor. - /** * @brief A reference counted object may only be deleted by calling Unreference(). */ virtual ~Controller(); +public: + struct Impl; ///< Made public for testing purposes + private: + struct EventHandler; + struct InputFontHandler; + struct InputProperties; + struct PlaceholderHandler; + struct Relayouter; + struct TextUpdater; - struct Impl; Impl* mImpl; }; -} // namespace Text - -} // namespace Toolkit - -} // namespace Dali +} // namespace Dali::Toolkit::Text #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H