1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/devel-api/text/spanned.h>
23 #include <dali/devel-api/adaptor-framework/input-method-context.h>
24 #include <dali/public-api/events/gesture.h>
27 #include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
28 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
29 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
30 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
31 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
32 #include <dali-toolkit/internal/text/hidden-text.h>
33 #include <dali-toolkit/internal/text/input-filter.h>
34 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
35 #include <dali-toolkit/internal/text/text-anchor-control-interface.h>
36 #include <dali-toolkit/internal/text/text-model-interface.h>
37 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
38 #include <dali-toolkit/public-api/text/text-enumerations.h>
40 namespace Dali::Toolkit::Text
43 class ControlInterface;
44 class EditableControlInterface;
46 class RenderingController;
49 * @brief Text selection operations .
53 INTERACTIVE = 0x0000, ///< Select the word where the cursor is located.
54 ALL = 0x0001, ///< Select the whole text.
55 NONE = 0x0002, ///< Unselect the whole text.
56 RANGE = 0x0003 ///< Select the range text.
59 typedef IntrusivePtr<Controller> ControllerPtr;
62 * @brief A Text Controller is used by UI Controls which display text.
64 * It manipulates the Logical & Visual text models on behalf of the UI Controls.
65 * It provides a view of the text that can be used by rendering back-ends.
67 * For selectable/editable UI controls, the controller handles input events from the UI control
68 * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
70 * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
72 class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public HiddenText::Observer
74 public: // Enumerated types.
76 * @brief Text related operations to be done in the relayout process.
80 NO_OPERATION = 0x0000,
81 CONVERT_TO_UTF32 = 0x0001,
83 VALIDATE_FONTS = 0x0004,
84 GET_LINE_BREAKS = 0x0008,
87 GET_GLYPH_METRICS = 0x0040,
89 UPDATE_LAYOUT_SIZE = 0x0100,
93 UPDATE_DIRECTION = 0x1000,
94 ALL_OPERATIONS = 0xFFFF
98 * @brief Used to distinguish between regular key events and InputMethodContext events
107 * @brief Used to specify whether to update the input style.
109 enum UpdateInputStyleType
112 DONT_UPDATE_INPUT_STYLE
116 * @brief Used to specify what has been updated after the Relayout() method has been called.
120 NONE_UPDATED = 0x0, ///< Nothing has been updated.
121 MODEL_UPDATED = 0x1, ///< The text's model has been updated.
122 DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
126 * @brief Different placeholder-text can be shown when the control is active/inactive.
130 PLACEHOLDER_TYPE_ACTIVE,
131 PLACEHOLDER_TYPE_INACTIVE,
135 * @brief Enumeration for Font Size Type.
139 POINT_SIZE, // The size of font in points.
140 PIXEL_SIZE // The size of font in pixels.
147 NO_ACTION, ///< Does no action if there is a tap on top of an area with no text.
148 HIGHLIGHT, ///< Highlights the nearest text (at the beginning or end of the text) and shows the text's selection popup.
149 SHOW_SELECTION_POPUP ///< Shows the text's selection popup.
161 TEXT_FIT_FONT_SIZE_TYPE
165 public: // Constructor.
167 * @brief Create a new instance of a Controller.
169 * @return A pointer to a new Controller.
171 static ControllerPtr New()
173 return ControllerPtr(new Controller());
177 * @brief Create a new instance of a Controller.
179 * @param[in] controlInterface The control's interface.
181 * @return A pointer to a new Controller.
183 static ControllerPtr New(ControlInterface* controlInterface)
185 return ControllerPtr(new Controller(controlInterface));
189 * @brief Create a new instance of a Controller.
191 * @param[in] controlInterface The control's interface.
192 * @param[in] editableControlInterface The editable control's interface.
193 * @param[in] selectableControlInterface The selectable control's interface.
194 * @param[in] anchorControlInterface The anchor control's interface.
196 * @return A pointer to a new Controller.
198 static ControllerPtr New(ControlInterface* controlInterface,
199 EditableControlInterface* editableControlInterface,
200 SelectableControlInterface* selectableControlInterface,
201 AnchorControlInterface* anchorControlInterface)
203 return ControllerPtr(new Controller(controlInterface,
204 editableControlInterface,
205 selectableControlInterface,
206 anchorControlInterface));
209 public: // Configure the text controller.
211 * @brief Called to enable text input.
213 * @note Selectable or editable controls should call this once after Controller::New().
214 * @param[in] decorator Used to create cursor, selection handle decorations etc.
215 * @param[in] inputMethodContext Used to manager ime.
217 void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
220 * @brief Used to switch between bitmap & vector based glyphs
222 * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
224 void SetGlyphType(TextAbstraction::GlyphType glyphType);
227 * @brief Enables/disables the mark-up processor.
229 * By default is disabled.
231 * @param[in] enable Whether to enable the mark-up processor.
233 void SetMarkupProcessorEnabled(bool enable);
236 * @brief Retrieves whether the mark-up processor is enabled.
238 * By default is disabled.
240 * @return @e true if the mark-up processor is enabled, otherwise returns @e false.
242 bool IsMarkupProcessorEnabled() const;
245 * @brief Retrieves whether the current text contains anchors.
247 * @return @e true if the current text contains anchors. @e false.
249 bool HasAnchors() const;
252 * @brief Enables/disables the auto text scrolling
254 * By default is disabled.
256 * @param[in] enable Whether to enable the auto scrolling
258 void SetAutoScrollEnabled(bool enable);
261 * @brief Whether the auto scrolling texture exceed max texture.
263 * By default is false.
265 * @param[in] exceed Whether the auto scrolling texture exceed max texture.
267 void SetAutoScrollMaxTextureExceeded(bool exceed);
270 * @brief Retrieves whether auto text scrolling is enabled.
272 * By default is disabled.
274 * @return @e true if auto scrolling is enabled, otherwise returns @e false.
276 bool IsAutoScrollEnabled() const;
279 * @brief Get direction of the text from the first line of text,
280 * @return bool rtl (right to left) is true
282 CharacterDirection GetAutoScrollDirection() const;
285 * @brief Get the alignment offset of the first line of text.
287 * @return The alignment offset.
289 float GetAutoScrollLineAlignment() const;
292 * @brief Enables the horizontal scrolling.
294 * @param[in] enable Whether to enable the horizontal scrolling.
296 void SetHorizontalScrollEnabled(bool enable);
299 * @brief Retrieves whether the horizontal scrolling is enabled.
301 * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
303 bool IsHorizontalScrollEnabled() const;
306 * @brief Enables the vertical scrolling.
308 * @param[in] enable Whether to enable the vertical scrolling.
310 void SetVerticalScrollEnabled(bool enable);
313 * @brief Retrieves whether the verticall scrolling is enabled.
315 * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
317 bool IsVerticalScrollEnabled() const;
320 * @brief Enables the smooth handle panning.
322 * @param[in] enable Whether to enable the smooth handle panning.
324 void SetSmoothHandlePanEnabled(bool enable);
327 * @brief Retrieves whether the smooth handle panning is enabled.
329 * @return @e true if the smooth handle panning is enabled.
331 bool IsSmoothHandlePanEnabled() const;
334 * @brief Sets the maximum number of characters that can be inserted into the TextModel
336 * @param[in] maxCharacters maximum number of characters to be accepted
338 void SetMaximumNumberOfCharacters(Length maxCharacters);
341 * @brief Sets the maximum number of characters that can be inserted into the TextModel
343 * @param[in] maxCharacters maximum number of characters to be accepted
345 int GetMaximumNumberOfCharacters();
348 * @brief Called to enable/disable cursor blink.
350 * @note Only editable controls should calls this.
351 * @param[in] enabled Whether the cursor should blink or not.
353 void SetEnableCursorBlink(bool enable);
356 * @brief Query whether cursor blink is enabled.
358 * @return Whether the cursor should blink or not.
360 bool GetEnableCursorBlink() const;
363 * @brief Whether to enable the multi-line layout.
365 * @param[in] enable \e true enables the multi-line (by default)
367 void SetMultiLineEnabled(bool enable);
370 * @return Whether the multi-line layout is enabled.
372 bool IsMultiLineEnabled() const;
375 * @brief Sets the text's horizontal alignment.
377 * @param[in] alignment The horizontal alignment.
379 void SetHorizontalAlignment(HorizontalAlignment::Type alignment);
382 * @copydoc ModelInterface::GetHorizontalAlignment()
384 HorizontalAlignment::Type GetHorizontalAlignment() const;
387 * @brief Sets the text's vertical alignment.
389 * @param[in] alignment The vertical alignment.
391 void SetVerticalAlignment(VerticalAlignment::Type alignment);
394 * @copydoc ModelInterface::GetVerticalAlignment()
396 VerticalAlignment::Type GetVerticalAlignment() const;
399 * @brief Sets the text's wrap mode
400 * @param[in] text wrap mode The unit of wrapping
402 void SetLineWrapMode(Text::LineWrap::Mode textWarpMode);
405 * @brief Retrieve text wrap mode previously set.
406 * @return text wrap mode
408 Text::LineWrap::Mode GetLineWrapMode() const;
411 * @brief Enable or disable the text elide.
413 * @param[in] enabled Whether to enable the text elide.
415 void SetTextElideEnabled(bool enabled);
418 * @copydoc ModelInterface::IsTextElideEnabled()
420 bool IsTextElideEnabled() const;
423 * @brief Enable or disable the text fit.
425 * @param[in] enabled Whether to enable the text fit.
427 void SetTextFitEnabled(bool enabled);
430 * @brief Whether the text fit is enabled or not.
432 * @return True if the text fit is enabled
434 bool IsTextFitEnabled() const;
437 * @brief Sets minimum size valid for text fit.
439 * @param[in] minimum size value.
440 * @param[in] type The font size type is point size or pixel size
442 void SetTextFitMinSize(float pointSize, FontSizeType type);
445 * @brief Retrieves the minimum point size valid for text fit.
447 * @return The minimum point size valid for text fit
449 float GetTextFitMinSize() const;
452 * @brief Sets maximum size valid for text fit.
454 * @param[in] maximum size value.
455 * @param[in] type The font size type is point size or pixel size
457 void SetTextFitMaxSize(float pointSize, FontSizeType type);
460 * @brief Retrieves the maximum point size valid for text fit.
462 * @return The maximum point size valid for text fit
464 float GetTextFitMaxSize() const;
467 * @brief Sets step size for font increase valid for text fit.
469 * @param[in] step size value.
470 * @param[in] type The font size type is point size or pixel size
472 void SetTextFitStepSize(float step, FontSizeType type);
475 * @brief Retrieves the step point size valid for text fit.
477 * @return The step point size valid for text fit
479 float GetTextFitStepSize() const;
482 * @brief Sets content size valid for text fit.
484 * @param[in] Content size value.
486 void SetTextFitContentSize(Vector2 size);
489 * @brief Retrieves the content size valid for text fit.
491 * @return The content size valid for text fit
493 Vector2 GetTextFitContentSize() const;
496 * @brief Retrieve the fited point size.
498 * @return The fited point size.
500 float GetTextFitPointSize() const;
503 * @brief Sets whether the text fit properties have changed.
505 * @param[in] changed Whether to changed the text fit.
507 void SetTextFitChanged(bool changed);
510 * @brief Whether the text fit properties are changed or not.
512 * @return True if the text fit properties are changed
514 bool IsTextFitChanged() const;
517 * @brief Sets disabled color opacity.
519 * @param[in] opacity The color opacity value in disabled state.
521 void SetDisabledColorOpacity(float opacity);
524 * @brief Retrieves the disabled color opacity.
526 * @return The disabled color opacity value for disabled state.
528 float GetDisabledColorOpacity() const;
531 * @brief Enable or disable the placeholder text elide.
532 * @param enabled Whether to enable the placeholder text elide.
534 void SetPlaceholderTextElideEnabled(bool enabled);
537 * @brief Whether the placeholder text elide property is enabled.
538 * @return True if the placeholder text elide property is enabled, false otherwise.
540 bool IsPlaceholderTextElideEnabled() const;
543 * @brief Enable or disable the text selection.
544 * @param[in] enabled Whether to enable the text selection.
546 void SetSelectionEnabled(bool enabled);
549 * @brief Whether the text selection is enabled or not.
550 * @return True if the text selection is enabled
552 bool IsSelectionEnabled() const;
555 * @brief Enable or disable the text selection using Shift key.
556 * @param enabled Whether to enable the text selection using Shift key
558 void SetShiftSelectionEnabled(bool enabled);
561 * @brief Whether the text selection using Shift key is enabled or not.
562 * @return True if the text selection using Shift key is enabled
564 bool IsShiftSelectionEnabled() const;
567 * @brief Enable or disable the grab handles for text selection.
569 * @param[in] enabled Whether to enable the grab handles
571 void SetGrabHandleEnabled(bool enabled);
574 * @brief Returns whether the grab handles are enabled.
576 * @return True if the grab handles are enabled
578 bool IsGrabHandleEnabled() const;
581 * @brief Enable or disable the grab handles for text selection.
583 * @param[in] enabled Whether to enable the grab handles
585 void SetGrabHandlePopupEnabled(bool enabled);
588 * @brief Returns whether the grab handles are enabled.
590 * @return True if the grab handles are enabled
592 bool IsGrabHandlePopupEnabled() const;
595 * @brief Sets input type to password
597 * @note The string is displayed hidden character
599 * @param[in] passwordInput True if password input is enabled.
601 void SetInputModePassword(bool passwordInput);
604 * @brief Returns whether the input mode type is set as password.
606 * @return True if input mode type is password
608 bool IsInputModePassword();
611 * @brief Sets the action when there is a double tap event on top of a text area with no text.
613 * @param[in] action The action to do.
615 void SetNoTextDoubleTapAction(NoTextTap::Action action);
618 * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
620 * @return The action to do.
622 NoTextTap::Action GetNoTextDoubleTapAction() const;
625 * @briefSets the action when there is a long press event on top of a text area with no text.
627 * @param[in] action The action to do.
629 void SetNoTextLongPressAction(NoTextTap::Action action);
632 * @brief Retrieves the action when there is a long press event on top of a text area with no text.
634 * @return The action to do.
636 NoTextTap::Action GetNoTextLongPressAction() const;
639 * @brief Query if Underline settings were provided by string or map
640 * @return bool true if set by string
642 bool IsUnderlineSetByString();
645 * Set method underline setting were set by
646 * @param[in] bool, true if set by string
648 void UnderlineSetByString(bool setByString);
651 * @brief Query if shadow settings were provided by string or map
652 * @return bool true if set by string
654 bool IsShadowSetByString();
657 * Set method shadow setting were set by
658 * @param[in] bool, true if set by string
660 void ShadowSetByString(bool setByString);
663 * @brief Query if outline settings were provided by string or map
664 * @return bool true if set by string
666 bool IsOutlineSetByString();
669 * Set method outline setting were set by
670 * @param[in] bool, true if set by string
672 void OutlineSetByString(bool setByString);
675 * @brief Query if font style settings were provided by string or map
676 * @return bool true if set by string
678 bool IsFontStyleSetByString();
681 * Set method font style setting were set by
682 * @param[in] bool, true if set by string
684 void FontStyleSetByString(bool setByString);
687 * @brief Query if Strikethrough settings were provided by string or map
688 * @return bool true if set by string
690 bool IsStrikethroughSetByString();
693 * Set method Strikethrough setting were set by
694 * @param[in] bool, true if set by string
696 void StrikethroughSetByString(bool setByString);
699 * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
701 * @param[in] height The height in pixels of the strikethrough
703 void SetStrikethroughHeight(float height);
706 * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
708 * @return The height of the strikethrough, or 0 if height is not overrided.
710 float GetStrikethroughHeight() const;
713 * @brief Set the strikethrough color.
715 * @param[in] color color of strikethrough.
717 void SetStrikethroughColor(const Vector4& color);
720 * @brief Retrieve the strikethrough color.
722 * @return The strikethrough color.
724 const Vector4& GetStrikethroughColor() const;
727 * @brief Set the strikethrough enabled flag.
729 * @param[in] enabled The strikethrough enabled flag.
731 void SetStrikethroughEnabled(bool enabled);
734 * @brief Returns whether the text has a strikethrough or not.
736 * @return The strikethrough state.
738 bool IsStrikethroughEnabled() const;
742 * @brief Replaces any text previously set.
744 * @note This will be converted into UTF-32 when stored in the text model.
745 * @param[in] text A string of UTF-8 characters.
747 void SetText(const std::string& text);
750 * @brief Retrieve any text previously set.
752 * @param[out] text A string of UTF-8 characters.
754 void GetText(std::string& text) const;
757 * @brief Set the @p spannedText
758 * the spanned text contains content (text) and format (spans with ranges)
759 * the text is copied into text-controller and the spans are applied on ranges
761 * @param[in] spannedText the text with spans.
763 void SetSpannedText(const Text::Spanned& spannedText);
766 * @brief Replaces any placeholder text previously set.
768 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
769 * @param[in] text A string of UTF-8 characters.
771 void SetPlaceholderText(PlaceholderType type, const std::string& text);
774 * @brief Retrieve any placeholder text previously set.
776 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
777 * @param[out] A string of UTF-8 characters.
779 void GetPlaceholderText(PlaceholderType type, std::string& text) const;
782 * @ brief Update the text after a font change
783 * @param[in] newDefaultFont The new font to change to
785 void UpdateAfterFontChange(const std::string& newDefaultFont);
788 * @brief The method acquires currently selected text
789 * @param selectedText variable to place selected text in
791 void RetrieveSelection(std::string& selectedText) const;
794 * @brief The method sets selection in given range
795 * @param start index of first character
796 * @param end index of first character after selection
798 void SetSelection(int start, int end);
801 * @brief This method retrieve indexes of current selection
803 * @return a pair, where first element is left index of selection and second is the right one
805 std::pair<int, int> GetSelectionIndexes() const;
808 * Place string in system clipboard
809 * @param source std::string
811 void CopyStringToClipboard(const std::string& source);
814 * Place currently selected text in system clipboard
815 * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
817 void SendSelectionToClipboard(bool deleteAfterSending);
819 public: // Default style & Input style
821 * @brief Set the default font family.
823 * @param[in] defaultFontFamily The default font family.
825 void SetDefaultFontFamily(const std::string& defaultFontFamily);
828 * @brief Retrieve the default font family.
830 * @return The default font family.
832 const std::string& GetDefaultFontFamily() const;
835 * @brief Sets the placeholder text font family.
836 * @param[in] placeholderTextFontFamily The placeholder text font family.
838 void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
841 * @brief Retrieves the placeholder text font family.
843 * @return The placeholder text font family
845 const std::string& GetPlaceholderFontFamily() const;
848 * @brief Sets the default font weight.
850 * @param[in] weight The font weight.
852 void SetDefaultFontWeight(FontWeight weight);
855 * @brief Whether the font's weight has been defined.
857 bool IsDefaultFontWeightDefined() const;
860 * @brief Retrieves the default font weight.
862 * @return The default font weight.
864 FontWeight GetDefaultFontWeight() const;
867 * @brief Sets the placeholder text font weight.
869 * @param[in] weight The font weight
871 void SetPlaceholderTextFontWeight(FontWeight weight);
874 * @brief Whether the font's weight has been defined.
876 * @return True if the placeholder text font weight is defined
878 bool IsPlaceholderTextFontWeightDefined() const;
881 * @brief Retrieves the placeholder text font weight.
883 * @return The placeholder text font weight
885 FontWeight GetPlaceholderTextFontWeight() const;
888 * @brief Sets the default font width.
890 * @param[in] width The font width.
892 void SetDefaultFontWidth(FontWidth width);
895 * @brief Whether the font's width has been defined.
897 bool IsDefaultFontWidthDefined() const;
900 * @brief Retrieves the default font width.
902 * @return The default font width.
904 FontWidth GetDefaultFontWidth() const;
907 * @brief Sets the placeholder text font width.
909 * @param[in] width The font width
911 void SetPlaceholderTextFontWidth(FontWidth width);
914 * @brief Whether the font's width has been defined.
916 * @return True if the placeholder text font width is defined
918 bool IsPlaceholderTextFontWidthDefined() const;
921 * @brief Retrieves the placeholder text font width.
923 * @return The placeholder text font width
925 FontWidth GetPlaceholderTextFontWidth() const;
928 * @brief Sets the default font slant.
930 * @param[in] slant The font slant.
932 void SetDefaultFontSlant(FontSlant slant);
935 * @brief Whether the font's slant has been defined.
937 bool IsDefaultFontSlantDefined() const;
940 * @brief Retrieves the default font slant.
942 * @return The default font slant.
944 FontSlant GetDefaultFontSlant() const;
947 * @brief Sets the placeholder text font slant.
949 * @param[in] slant The font slant
951 void SetPlaceholderTextFontSlant(FontSlant slant);
954 * @brief Whether the font's slant has been defined.
956 * @return True if the placeholder text font slant is defined
958 bool IsPlaceholderTextFontSlantDefined() const;
961 * @brief Retrieves the placeholder text font slant.
963 * @return The placeholder text font slant
965 FontSlant GetPlaceholderTextFontSlant() const;
968 * @brief Set the default font size.
970 * @param[in] fontSize The default font size
971 * @param[in] type The font size type is point size or pixel size
973 void SetDefaultFontSize(float fontSize, FontSizeType type);
976 * @brief Retrieve the default point size.
978 * @param[in] type The font size type
979 * @return The default point size.
981 float GetDefaultFontSize(FontSizeType type) const;
984 * @brief Set the font size scale.
986 * @param[in] scale The font size scale
988 void SetFontSizeScale(float scale);
991 * @brief Get the font size scale.
993 * @return The font size scale.
995 float GetFontSizeScale() const;
998 * @brief Set the font size scale enabled flag.
1000 * @param[in] enabled whether to enable the font size scale.
1002 void SetFontSizeScaleEnabled(bool enabled);
1005 * @brief Returns whether the font size scale is enabled or not.
1007 * @return @e true if the font size scale is enabled, otherwise returns @e false.
1009 bool IsFontSizeScaleEnabled() const;
1012 * @brief Sets the Placeholder text font size.
1013 * @param[in] fontSize The placeholder text font size
1014 * @param[in] type The font size type is point size or pixel size
1016 void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
1019 * @brief Retrieves the Placeholder text font size.
1020 * @param[in] type The font size type
1021 * @return The placeholder font size
1023 float GetPlaceholderTextFontSize(FontSizeType type) const;
1026 * @brief Sets the text's default color.
1028 * @param color The default color.
1030 void SetDefaultColor(const Vector4& color);
1033 * @brief Retrieves the text's default color.
1035 * @return The default color.
1037 const Vector4& GetDefaultColor() const;
1040 * @brief Sets the user interaction enabled.
1042 * @param enabled whether to enable the user interaction.
1044 void SetUserInteractionEnabled(bool enabled);
1047 * @brief Whether the user interaction is enabled.
1049 * @return true if the user interaction is enabled, false otherwise.
1051 bool IsUserInteractionEnabled() const;
1054 * @brief Set the text color
1056 * @param textColor The text color
1058 void SetPlaceholderTextColor(const Vector4& textColor);
1061 * @brief Retrieve the text color
1063 * @return The text color
1065 const Vector4& GetPlaceholderTextColor() const;
1068 * @brief Set the shadow offset.
1070 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
1072 void SetShadowOffset(const Vector2& shadowOffset);
1075 * @brief Retrieve the shadow offset.
1077 * @return The shadow offset.
1079 const Vector2& GetShadowOffset() const;
1082 * @brief Set the shadow color.
1084 * @param[in] shadowColor The shadow color.
1086 void SetShadowColor(const Vector4& shadowColor);
1089 * @brief Retrieve the shadow color.
1091 * @return The shadow color.
1093 const Vector4& GetShadowColor() const;
1096 * @brief Set the shadow blur radius.
1098 * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
1100 void SetShadowBlurRadius(const float& shadowBlurRadius);
1103 * @brief Retrieve the shadow blur radius.
1105 * @return The shadow blur radius.
1107 const float& GetShadowBlurRadius() const;
1110 * @brief Set the underline color.
1112 * @param[in] color color of underline.
1114 void SetUnderlineColor(const Vector4& color);
1117 * @brief Retrieve the underline color.
1119 * @return The underline color.
1121 const Vector4& GetUnderlineColor() const;
1124 * @brief Set the underline enabled flag.
1126 * @param[in] enabled The underline enabled flag.
1128 void SetUnderlineEnabled(bool enabled);
1131 * @brief Returns whether the text is underlined or not.
1133 * @return The underline state.
1135 bool IsUnderlineEnabled() const;
1138 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
1140 * @param[in] height The height in pixels of the underline
1142 void SetUnderlineHeight(float height);
1145 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
1147 * @return The height of the underline, or 0 if height is not overrided.
1149 float GetUnderlineHeight() const;
1152 * @brief Sets the underline type.
1153 * @param[in] type The underline type.
1155 void SetUnderlineType(Text::Underline::Type type);
1158 * @brief Retrieve underline type.
1159 * @return The underline type.
1161 Text::Underline::Type GetUnderlineType() const;
1164 * @brief Set the width of the dashes of the dashed underline.
1166 * @param[in] width The width in pixels of the dashes of the dashed underline.
1168 void SetDashedUnderlineWidth(float width);
1171 * @brief Retrieves the width of the dashes of the dashed underline.
1173 * @return The width of the dashes of the dashed underline.
1175 float GetDashedUnderlineWidth() const;
1178 * @brief Set the gap between the dashes of the dashed underline.
1180 * @param[in] gap The gap between the dashes of the dashed underline.
1182 void SetDashedUnderlineGap(float gap);
1185 * @brief Retrieves the gap between the dashes of the dashed underline.
1187 * @return The The gap between the dashes of the dashed underline.
1189 float GetDashedUnderlineGap() const;
1192 * @brief Set the outline color.
1194 * @param[in] color color of outline.
1196 void SetOutlineColor(const Vector4& color);
1199 * @brief Retrieve the outline color.
1201 * @return The outline color.
1203 const Vector4& GetOutlineColor() const;
1206 * @brief Set the outline width
1208 * @param[in] width The width in pixels of the outline, 0 indicates no outline
1210 void SetOutlineWidth(uint16_t width);
1213 * @brief Retrieves the width of an outline
1215 * @return The width of the outline.
1217 uint16_t GetOutlineWidth() const;
1220 * @brief Set the background color.
1222 * @param[in] color color of background.
1224 void SetBackgroundColor(const Vector4& color);
1227 * @brief Retrieve the background color.
1229 * @return The background color.
1231 const Vector4& GetBackgroundColor() const;
1234 * @brief Set the background enabled flag.
1236 * @param[in] enabled The background enabled flag.
1238 void SetBackgroundEnabled(bool enabled);
1241 * @brief Returns whether to enable text background or not.
1243 * @return Whether text background is enabled.
1245 bool IsBackgroundEnabled() const;
1248 * @brief Sets the emboss's properties string.
1250 * @note The string is stored to be recovered.
1252 * @param[in] embossProperties The emboss's properties string.
1254 void SetDefaultEmbossProperties(const std::string& embossProperties);
1257 * @brief Retrieves the emboss's properties string.
1259 * @return The emboss's properties string.
1261 const std::string& GetDefaultEmbossProperties() const;
1264 * @brief Sets the outline's properties string.
1266 * @note The string is stored to be recovered.
1268 * @param[in] outlineProperties The outline's properties string.
1270 void SetDefaultOutlineProperties(const std::string& outlineProperties);
1273 * @brief Retrieves the outline's properties string.
1275 * @return The outline's properties string.
1277 const std::string& GetDefaultOutlineProperties() const;
1280 * @brief Sets the default line spacing.
1282 * @param[in] lineSpacing The line spacing.
1284 * @return True if lineSpacing has been updated, false otherwise
1286 bool SetDefaultLineSpacing(float lineSpacing);
1289 * @brief Retrieves the default line spacing.
1291 * @return The line spacing.
1293 float GetDefaultLineSpacing() const;
1296 * @brief Sets the default line size.
1298 * @param[in] lineSize The line size.
1300 * @return True if lineSize has been updated, false otherwise
1302 bool SetDefaultLineSize(float lineSize);
1305 * @brief Retrieves the default line size.
1307 * @return The line size.
1309 float GetDefaultLineSize() const;
1312 * @brief Sets the relative line size to the original line size.
1314 * @param[in] relativeLineSize The relativeline size.
1316 * @return True if relativeLineSize has been updated, false otherwise
1318 bool SetRelativeLineSize(float lineSize);
1321 * @brief Retrieves the relative line size.
1323 * @return The relative line size.
1325 float GetRelativeLineSize() const;
1328 * @brief Sets the input text's color.
1330 * @param[in] color The input text's color.
1332 void SetInputColor(const Vector4& color);
1335 * @brief Retrieves the input text's color.
1337 * @return The input text's color.
1339 const Vector4& GetInputColor() const;
1342 * @brief Sets the input text's font family name.
1344 * @param[in] fontFamily The text's font family name.
1346 void SetInputFontFamily(const std::string& fontFamily);
1349 * @brief Retrieves the input text's font family name.
1351 * @return The input text's font family name.
1353 const std::string& GetInputFontFamily() const;
1356 * @brief Sets the input font's weight.
1358 * @param[in] weight The input font's weight.
1360 void SetInputFontWeight(FontWeight weight);
1363 * @return Whether the font's weight has been defined.
1365 bool IsInputFontWeightDefined() const;
1368 * @brief Retrieves the input font's weight.
1370 * @return The input font's weight.
1372 FontWeight GetInputFontWeight() const;
1375 * @brief Sets the input font's width.
1377 * @param[in] width The input font's width.
1379 void SetInputFontWidth(FontWidth width);
1382 * @return Whether the font's width has been defined.
1384 bool IsInputFontWidthDefined() const;
1387 * @brief Retrieves the input font's width.
1389 * @return The input font's width.
1391 FontWidth GetInputFontWidth() const;
1394 * @brief Sets the input font's slant.
1396 * @param[in] slant The input font's slant.
1398 void SetInputFontSlant(FontSlant slant);
1401 * @return Whether the font's slant has been defined.
1403 bool IsInputFontSlantDefined() const;
1406 * @brief Retrieves the input font's slant.
1408 * @return The input font's slant.
1410 FontSlant GetInputFontSlant() const;
1413 * @brief Sets the input font's point size.
1415 * @param[in] size The input font's point size.
1417 void SetInputFontPointSize(float size);
1420 * @brief Retrieves the input font's point size.
1422 * @return The input font's point size.
1424 float GetInputFontPointSize() const;
1427 * @brief Sets the input line spacing.
1429 * @param[in] lineSpacing The line spacing.
1431 void SetInputLineSpacing(float lineSpacing);
1434 * @brief Retrieves the input line spacing.
1436 * @return The line spacing.
1438 float GetInputLineSpacing() const;
1441 * @brief Sets the input shadow's properties string.
1443 * @note The string is stored to be recovered.
1445 * @param[in] shadowProperties The shadow's properties string.
1447 void SetInputShadowProperties(const std::string& shadowProperties);
1450 * @brief Retrieves the input shadow's properties string.
1452 * @return The shadow's properties string.
1454 const std::string& GetInputShadowProperties() const;
1457 * @brief Sets the input underline's properties string.
1459 * @note The string is stored to be recovered.
1461 * @param[in] underlineProperties The underline's properties string.
1463 void SetInputUnderlineProperties(const std::string& underlineProperties);
1466 * @brief Retrieves the input underline's properties string.
1468 * @return The underline's properties string.
1470 const std::string& GetInputUnderlineProperties() const;
1473 * @brief Sets the input emboss's properties string.
1475 * @note The string is stored to be recovered.
1477 * @param[in] embossProperties The emboss's properties string.
1479 void SetInputEmbossProperties(const std::string& embossProperties);
1482 * @brief Retrieves the input emboss's properties string.
1484 * @return The emboss's properties string.
1486 const std::string& GetInputEmbossProperties() const;
1489 * @brief Sets input the outline's properties string.
1491 * @note The string is stored to be recovered.
1493 * @param[in] outlineProperties The outline's properties string.
1495 void SetInputOutlineProperties(const std::string& outlineProperties);
1498 * @brief Retrieves the input outline's properties string.
1500 * @return The outline's properties string.
1502 const std::string& GetInputOutlineProperties() const;
1505 * @brief Sets the input strikethrough's properties string.
1507 * @note The string is stored to be recovered.
1509 * @param[in] strikethroughProperties The strikethrough's properties string.
1511 void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
1514 * @brief Retrieves the input strikethrough's properties string.
1516 * @return The strikethrough's properties string.
1518 const std::string& GetInputStrikethroughProperties() const;
1521 * @brief Set the control's interface.
1523 * @param[in] controlInterface The control's interface.
1525 void SetControlInterface(ControlInterface* controlInterface);
1528 * @brief Set the anchor control's interface.
1530 * @param[in] anchorControlInterface The control's interface.
1532 void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
1535 * @brief Sets the character spacing.
1537 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1539 * @param[in] characterSpacing The character spacing.
1541 void SetCharacterSpacing(float characterSpacing);
1544 * @brief Retrieves the character spacing.
1546 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1548 * @return The character spacing.
1550 const float GetCharacterSpacing() const;
1552 public: // Queries & retrieves.
1554 * @brief Return the layout engine.
1556 * @return A reference to the layout engine.
1558 Layout::Engine& GetLayoutEngine();
1561 * @brief Return a view of the text.
1563 * @return A reference to the view.
1568 * @copydoc Control::GetNaturalSize()
1570 Vector3 GetNaturalSize();
1573 * @copydoc Control::GetHeightForWidth()
1575 float GetHeightForWidth(float width);
1578 * @brief Calculates the point size for text for given layout()
1580 void FitPointSizeforLayout(Size layoutSize);
1583 * @brief Checks if the point size fits within the layout size.
1585 * @return Whether the point size fits within the layout size.
1587 bool CheckForTextFit(float pointSize, Size& layoutSize);
1590 * @brief Retrieves the text's number of lines for a given width.
1591 * @param[in] width The width of the text's area.
1592 * @ return The number of lines.
1594 int GetLineCount(float width);
1597 * @brief Retrieves the text's model.
1599 * @return A pointer to the text's model.
1601 const ModelInterface* const GetTextModel() const;
1604 * @brief Used to get scrolled distance by user input
1606 * @return Distance from last scroll offset to new scroll offset
1608 float GetScrollAmountByUserInput();
1611 * @brief Get latest scroll amount, control size and layout size
1613 * This method is used to get information of control's scroll
1614 * @param[out] scrollPosition The current scrolled position
1615 * @param[out] controlHeight The size of a UI control
1616 * @param[out] layoutHeight The size of a bounding box to layout text within.
1618 * @return Whether the text scroll position is changed or not after last update.
1620 bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1623 * @brief Used to set the hidden input option
1625 void SetHiddenInputOption(const Property::Map& options);
1628 * @brief Used to get the hidden input option
1630 void GetHiddenInputOption(Property::Map& options);
1633 * @brief Used to set the input filter option
1635 void SetInputFilterOption(const Property::Map& options);
1638 * @brief Used to get the input filter option
1640 void GetInputFilterOption(Property::Map& options);
1643 * @brief Sets the Placeholder Properties.
1645 * @param[in] map The placeholder property map
1647 void SetPlaceholderProperty(const Property::Map& map);
1650 * @brief Retrieves the Placeholder Property map.
1652 * @param[out] map The property map
1654 void GetPlaceholderProperty(Property::Map& map);
1657 * @brief Checks text direction.
1658 * @return The text direction.
1660 Toolkit::DevelText::TextDirection::Type GetTextDirection();
1663 * @brief Retrieves vertical line alignment
1664 * @return The vertical line alignment
1666 Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1669 * @brief Sets vertical line alignment
1670 * @param[in] alignment The vertical line alignment for the text
1672 void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1675 * @brief Retrieves ellipsis position
1676 * @return The ellipsis position
1678 Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
1681 * @brief Sets ellipsis position
1682 * @param[in] ellipsisPosition The ellipsis position for the text
1684 void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
1687 * @brief Retrieves ignoreSpaceAfterText value from model
1688 * @return The value of ignoreSpaceAfterText
1690 bool IsIgnoreSpacesAfterText() const;
1693 * @brief Sets ignoreSpaceAfterText value to model
1694 * @param[in] ignore The value of ignoreSpacesAfterText for the text
1696 void SetIgnoreSpacesAfterText(bool ignore);
1699 * @brief Sets SetMatchLayoutDirection value to model
1700 * @param[in] match The value of matchLayoutDirection for the text
1702 void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
1705 * @brief Retrieves matchLayoutDirection value from model
1706 * @return The value of matchLayoutDirection
1708 DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
1711 * @brief Sets layoutDirection type value.
1712 * @param[in] layoutDirection The value of the layout direction type.
1714 void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1717 * @brief Gets layoutDirection type value.
1718 * @param[in] actor The actor which will get the layout direction type.
1719 * @return The value of the layout direction type.
1721 Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
1724 * @brief Get the rendered size of a specific text range.
1725 * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
1726 * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
1728 * @param[in] startIndex start index of the text requested to calculate size for.
1729 * @param[in] endIndex end index(included) of the text requested to calculate size for.
1730 * @return list of sizes of the reuested text.
1732 Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
1735 * @brief Get the top/left rendered position of a specific text range.
1736 * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
1737 * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
1739 * @param[in] startIndex start index of the text requested to get position to.
1740 * @param[in] endIndex end index(included) of the text requested to get position to.
1741 * @return list of positions of the requested text.
1743 Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
1746 * @brief Get the line bounding rectangle.
1747 * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
1749 * @param[in] lineIndex line index to which we want to calculate the geometry for.
1750 * @return bounding rectangle.
1752 Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex);
1755 * @brief Get the char bounding rectangle.
1756 * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
1758 * @param[in] charIndex character index to which we want to calculate the geometry for.
1759 * @return bounding rectangle.
1761 Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
1764 * @brief Get the character index.
1765 * If the text is not yet rendered or the text is empty, -1 is returned.
1767 * @param[in] visualX visual x position.
1768 * @param[in] visualY visual y position.
1769 * @return character index.
1771 int GetCharacterIndexAtPosition(float visualX, float visualY);
1774 * @brief Gets the bounding box of a specific text range.
1776 * @param[in] startIndex start index of the text requested to get bounding box to.
1777 * @param[in] endIndex end index(included) of the text requested to get bounding box to.
1778 * @return bounding box of the requested text.
1780 Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
1783 * @brief Sets the layout direction changed.
1785 void ChangedLayoutDirection();
1788 * @brief Retrieves if showing real text or not.
1789 * @return The value of showing real text.
1791 bool IsShowingRealText() const;
1793 public: // Relayout.
1795 * @brief Triggers a relayout which updates View (if necessary).
1797 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1798 * @param[in] size A the size of a bounding box to layout text within.
1799 * @param[in] layoutDirection The direction of the system language.
1801 * @return Whether the text model or decorations were updated.
1803 UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1806 * @brief Request a relayout using the ControlInterface.
1808 void RequestRelayout();
1810 public: // Input style change signals.
1812 * @return Whether the queue of input style changed signals is empty.
1814 bool IsInputStyleChangedSignalsQueueEmpty();
1817 * @brief Process all pending input style changed signals.
1819 * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1820 * text controls. Text controls may send signals to state the input style has changed.
1822 void ProcessInputStyleChangedSignals();
1824 public: // Text-input Event Queuing.
1826 * @brief Called by editable UI controls when keyboard focus is gained.
1828 void KeyboardFocusGainEvent();
1831 * @brief Called by editable UI controls when focus is lost.
1833 void KeyboardFocusLostEvent();
1836 * @brief Called by editable UI controls when key events are received.
1838 * @param[in] event The key event.
1839 * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1841 bool KeyEvent(const Dali::KeyEvent& event);
1844 * @brief Called by anchor when a tap gesture occurs.
1845 * @param[in] x The x position relative to the top-left of the parent control.
1846 * @param[in] y The y position relative to the top-left of the parent control.
1848 void AnchorEvent(float x, float y);
1851 * @brief Called by editable UI controls when a tap gesture occurs.
1852 * @param[in] tapCount The number of taps.
1853 * @param[in] x The x position relative to the top-left of the parent control.
1854 * @param[in] y The y position relative to the top-left of the parent control.
1856 void TapEvent(unsigned int tapCount, float x, float y);
1859 * @brief Called by editable UI controls when a pan gesture occurs.
1861 * @param[in] state The state of the gesture.
1862 * @param[in] displacement This distance panned since the last pan gesture.
1864 void PanEvent(GestureState state, const Vector2& displacement);
1867 * @brief Called by editable UI controls when a long press gesture occurs.
1869 * @param[in] state The state of the gesture.
1870 * @param[in] x The x position relative to the top-left of the parent control.
1871 * @param[in] y The y position relative to the top-left of the parent control.
1873 void LongPressEvent(GestureState state, float x, float y);
1876 * @brief Used to get the Primary cursor position.
1878 * @return Primary cursor position.
1880 CharacterIndex GetPrimaryCursorPosition() const;
1883 * @brief Used to set the Primary cursor position.
1885 * @param[in] index for the Primary cursor position.
1886 * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
1887 * @return[in] true if cursor position changed, false otherwise.
1889 bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
1892 * @brief Creates a selection event.
1894 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1896 * @param[in] x The x position relative to the top-left of the parent control.
1897 * @param[in] y The y position relative to the top-left of the parent control.
1898 * @param[in] selection type like the whole text is selected or unselected.
1900 void SelectEvent(float x, float y, SelectionType selection);
1903 * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
1905 void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
1908 * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
1910 Uint32Pair GetTextSelectionRange() const;
1913 * @copydoc Text::SelectableControlInterface::SelectWholeText()
1915 void SelectWholeText();
1918 * @copydoc Text::EditableControlInterface::CopyText()
1923 * @copydoc Text::EditableControlInterface::CutText()
1928 * @copydoc Text::EditableControlInterface::PasteText()
1933 * @copydoc Text::SelectableControlInterface::SelectNone()
1938 * @copydoc Text::SelectableControlInterface::SelectText()
1940 void SelectText(const uint32_t start, const uint32_t end);
1943 * @copydoc Text::SelectableControlInterface::GetSelectedText()
1945 string GetSelectedText() const;
1948 * @copydoc Text::EditableControlInterface::IsEditable()
1950 virtual bool IsEditable() const;
1953 * @copydoc Text::EditableControlInterface::SetEditable()
1955 virtual void SetEditable(bool editable);
1958 * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
1960 virtual void ScrollBy(Vector2 scroll);
1963 * @brief Whether the text is scrollable.
1964 * @return Returns true if the text is scrollable.
1966 bool IsScrollable(const Vector2& displacement);
1969 * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
1971 float GetHorizontalScrollPosition();
1974 * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
1976 float GetVerticalScrollPosition();
1979 * @brief Event received from input method context
1981 * @param[in] inputMethodContext The input method context.
1982 * @param[in] inputMethodContextEvent The event received.
1983 * @return A data struture indicating if update is needed, cursor position and current text.
1985 InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
1988 * @brief Event from Clipboard notifying an Item has been selected for pasting
1990 void PasteClipboardItemEvent();
1993 * @brief Return true when text control should clear key input focus when escape key is pressed.
1995 * @return Whether text control should clear key input focus or not when escape key is pressed.
1997 bool ShouldClearFocusOnEscape() const;
2000 * @brief Create an actor that renders the text background color
2002 * @return the created actor or an empty handle if no background color needs to be rendered.
2004 Actor CreateBackgroundActor();
2007 * @brief Used to reset the cursor position after setting a new text.
2009 * @param[in] cursorIndex Where to place the cursor.
2011 void ResetCursorPosition(CharacterIndex cursorIndex);
2014 * @brief The method acquires current position of cursor
2015 * @return unsigned value with cursor position
2017 CharacterIndex GetCursorPosition();
2020 * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text
2022 * @param[out] anchorActors the vector of actor (empty collection if no anchors available).
2024 void GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors);
2027 * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset
2029 * @param[in] characterOffset A position in text coords.
2031 * @return the index in anchor vector (-1 if an anchor not found)
2033 int GetAnchorIndex(size_t characterOffset);
2035 protected: // Inherit from Text::Decorator::ControllerInterface.
2037 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
2039 void GetTargetSize(Vector2& targetSize) override;
2042 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
2044 void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
2047 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
2049 void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
2051 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
2053 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
2055 void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
2057 protected: // Inherit from HiddenText.
2059 * @brief Invoked from HiddenText when showing time of the last character was expired
2061 void DisplayTimeExpired() override;
2063 private: // Private contructors & copy operator.
2065 * @brief Private constructor.
2068 : Controller(nullptr, nullptr, nullptr, nullptr)
2073 * @brief Private constructor.
2075 Controller(ControlInterface* controlInterface)
2076 : Controller(controlInterface, nullptr, nullptr, nullptr)
2081 * @brief Private constructor.
2083 Controller(ControlInterface* controlInterface,
2084 EditableControlInterface* editableControlInterface,
2085 SelectableControlInterface* selectableControlInterface,
2086 AnchorControlInterface* anchorControlInterface);
2088 Controller(const Controller& handle) = delete;
2089 Controller& operator=(const Controller& handle) = delete;
2091 protected: // Destructor.
2093 * @brief A reference counted object may only be deleted by calling Unreference().
2095 virtual ~Controller();
2098 struct Impl; ///< Made public for testing purposes
2101 struct EventHandler;
2102 struct InputFontHandler;
2103 struct InputProperties;
2104 struct PlaceholderHandler;
2107 struct SpannableHandler;
2112 } // namespace Dali::Toolkit::Text
2114 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H