1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
5 * Copyright (c) 2023 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 Retrieves number of characters previously set.
759 * @return A length of string of UTF-32 characters.
761 Length GetNumberOfCharacters() const;
764 * @brief Set the @p spannedText
765 * the spanned text contains content (text) and format (spans with ranges)
766 * the text is copied into text-controller and the spans are applied on ranges
768 * @param[in] spannedText the text with spans.
770 void SetSpannedText(const Text::Spanned& spannedText);
773 * @brief Replaces any placeholder text previously set.
775 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
776 * @param[in] text A string of UTF-8 characters.
778 void SetPlaceholderText(PlaceholderType type, const std::string& text);
781 * @brief Retrieve any placeholder text previously set.
783 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
784 * @param[out] A string of UTF-8 characters.
786 void GetPlaceholderText(PlaceholderType type, std::string& text) const;
789 * @ brief Update the text after a font change
790 * @param[in] newDefaultFont The new font to change to
792 void UpdateAfterFontChange(const std::string& newDefaultFont);
795 * @brief The method acquires currently selected text
796 * @param selectedText variable to place selected text in
798 void RetrieveSelection(std::string& selectedText) const;
801 * @brief The method sets selection in given range
802 * @param start index of first character
803 * @param end index of first character after selection
805 void SetSelection(int start, int end);
808 * @brief This method retrieve indexes of current selection
810 * @return a pair, where first element is left index of selection and second is the right one
812 std::pair<int, int> GetSelectionIndexes() const;
815 * Place string in system clipboard
816 * @param source std::string
818 void CopyStringToClipboard(const std::string& source);
821 * Place currently selected text in system clipboard
822 * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
824 void SendSelectionToClipboard(bool deleteAfterSending);
826 public: // Default style & Input style
828 * @brief Set the default font family.
830 * @param[in] defaultFontFamily The default font family.
832 void SetDefaultFontFamily(const std::string& defaultFontFamily);
835 * @brief Retrieve the default font family.
837 * @return The default font family.
839 std::string GetDefaultFontFamily() const;
842 * @brief Sets the placeholder text font family.
843 * @param[in] placeholderTextFontFamily The placeholder text font family.
845 void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
848 * @brief Retrieves the placeholder text font family.
850 * @return The placeholder text font family
852 std::string GetPlaceholderFontFamily() const;
855 * @brief Sets the default font weight.
857 * @param[in] weight The font weight.
859 void SetDefaultFontWeight(FontWeight weight);
862 * @brief Whether the font's weight has been defined.
864 bool IsDefaultFontWeightDefined() const;
867 * @brief Retrieves the default font weight.
869 * @return The default font weight.
871 FontWeight GetDefaultFontWeight() const;
874 * @brief Sets the placeholder text font weight.
876 * @param[in] weight The font weight
878 void SetPlaceholderTextFontWeight(FontWeight weight);
881 * @brief Whether the font's weight has been defined.
883 * @return True if the placeholder text font weight is defined
885 bool IsPlaceholderTextFontWeightDefined() const;
888 * @brief Retrieves the placeholder text font weight.
890 * @return The placeholder text font weight
892 FontWeight GetPlaceholderTextFontWeight() const;
895 * @brief Sets the default font width.
897 * @param[in] width The font width.
899 void SetDefaultFontWidth(FontWidth width);
902 * @brief Whether the font's width has been defined.
904 bool IsDefaultFontWidthDefined() const;
907 * @brief Retrieves the default font width.
909 * @return The default font width.
911 FontWidth GetDefaultFontWidth() const;
914 * @brief Sets the placeholder text font width.
916 * @param[in] width The font width
918 void SetPlaceholderTextFontWidth(FontWidth width);
921 * @brief Whether the font's width has been defined.
923 * @return True if the placeholder text font width is defined
925 bool IsPlaceholderTextFontWidthDefined() const;
928 * @brief Retrieves the placeholder text font width.
930 * @return The placeholder text font width
932 FontWidth GetPlaceholderTextFontWidth() const;
935 * @brief Sets the default font slant.
937 * @param[in] slant The font slant.
939 void SetDefaultFontSlant(FontSlant slant);
942 * @brief Whether the font's slant has been defined.
944 bool IsDefaultFontSlantDefined() const;
947 * @brief Retrieves the default font slant.
949 * @return The default font slant.
951 FontSlant GetDefaultFontSlant() const;
954 * @brief Sets the placeholder text font slant.
956 * @param[in] slant The font slant
958 void SetPlaceholderTextFontSlant(FontSlant slant);
961 * @brief Whether the font's slant has been defined.
963 * @return True if the placeholder text font slant is defined
965 bool IsPlaceholderTextFontSlantDefined() const;
968 * @brief Retrieves the placeholder text font slant.
970 * @return The placeholder text font slant
972 FontSlant GetPlaceholderTextFontSlant() const;
975 * @brief Set the default font size.
977 * @param[in] fontSize The default font size
978 * @param[in] type The font size type is point size or pixel size
980 void SetDefaultFontSize(float fontSize, FontSizeType type);
983 * @brief Retrieve the default point size.
985 * @param[in] type The font size type
986 * @return The default point size.
988 float GetDefaultFontSize(FontSizeType type) const;
991 * @brief Set the font size scale.
993 * @param[in] scale The font size scale
995 void SetFontSizeScale(float scale);
998 * @brief Get the font size scale.
1000 * @return The font size scale.
1002 float GetFontSizeScale() const;
1005 * @brief Set the font size scale enabled flag.
1007 * @param[in] enabled whether to enable the font size scale.
1009 void SetFontSizeScaleEnabled(bool enabled);
1012 * @brief Returns whether the font size scale is enabled or not.
1014 * @return @e true if the font size scale is enabled, otherwise returns @e false.
1016 bool IsFontSizeScaleEnabled() const;
1019 * @brief Sets the Placeholder text font size.
1020 * @param[in] fontSize The placeholder text font size
1021 * @param[in] type The font size type is point size or pixel size
1023 void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
1026 * @brief Retrieves the Placeholder text font size.
1027 * @param[in] type The font size type
1028 * @return The placeholder font size
1030 float GetPlaceholderTextFontSize(FontSizeType type) const;
1033 * @brief Sets the text's default color.
1035 * @param color The default color.
1037 void SetDefaultColor(const Vector4& color);
1040 * @brief Retrieves the text's default color.
1042 * @return The default color.
1044 const Vector4& GetDefaultColor() const;
1047 * @brief Sets the user interaction enabled.
1049 * @param enabled whether to enable the user interaction.
1051 void SetUserInteractionEnabled(bool enabled);
1054 * @brief Whether the user interaction is enabled.
1056 * @return true if the user interaction is enabled, false otherwise.
1058 bool IsUserInteractionEnabled() const;
1061 * @brief Set the text color
1063 * @param textColor The text color
1065 void SetPlaceholderTextColor(const Vector4& textColor);
1068 * @brief Retrieve the text color
1070 * @return The text color
1072 const Vector4& GetPlaceholderTextColor() const;
1075 * @brief Set the shadow offset.
1077 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
1079 void SetShadowOffset(const Vector2& shadowOffset);
1082 * @brief Retrieve the shadow offset.
1084 * @return The shadow offset.
1086 const Vector2& GetShadowOffset() const;
1089 * @brief Set the shadow color.
1091 * @param[in] shadowColor The shadow color.
1093 void SetShadowColor(const Vector4& shadowColor);
1096 * @brief Retrieve the shadow color.
1098 * @return The shadow color.
1100 const Vector4& GetShadowColor() const;
1103 * @brief Set the shadow blur radius.
1105 * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
1107 void SetShadowBlurRadius(const float& shadowBlurRadius);
1110 * @brief Retrieve the shadow blur radius.
1112 * @return The shadow blur radius.
1114 const float& GetShadowBlurRadius() const;
1117 * @brief Set the underline color.
1119 * @param[in] color color of underline.
1121 void SetUnderlineColor(const Vector4& color);
1124 * @brief Retrieve the underline color.
1126 * @return The underline color.
1128 const Vector4& GetUnderlineColor() const;
1131 * @brief Set the underline enabled flag.
1133 * @param[in] enabled The underline enabled flag.
1135 void SetUnderlineEnabled(bool enabled);
1138 * @brief Returns whether the text is underlined or not.
1140 * @return The underline state.
1142 bool IsUnderlineEnabled() const;
1145 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
1147 * @param[in] height The height in pixels of the underline
1149 void SetUnderlineHeight(float height);
1152 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
1154 * @return The height of the underline, or 0 if height is not overrided.
1156 float GetUnderlineHeight() const;
1159 * @brief Sets the underline type.
1160 * @param[in] type The underline type.
1162 void SetUnderlineType(Text::Underline::Type type);
1165 * @brief Retrieve underline type.
1166 * @return The underline type.
1168 Text::Underline::Type GetUnderlineType() const;
1171 * @brief Set the width of the dashes of the dashed underline.
1173 * @param[in] width The width in pixels of the dashes of the dashed underline.
1175 void SetDashedUnderlineWidth(float width);
1178 * @brief Retrieves the width of the dashes of the dashed underline.
1180 * @return The width of the dashes of the dashed underline.
1182 float GetDashedUnderlineWidth() const;
1185 * @brief Set the gap between the dashes of the dashed underline.
1187 * @param[in] gap The gap between the dashes of the dashed underline.
1189 void SetDashedUnderlineGap(float gap);
1192 * @brief Retrieves the gap between the dashes of the dashed underline.
1194 * @return The The gap between the dashes of the dashed underline.
1196 float GetDashedUnderlineGap() const;
1199 * @brief Set the outline color.
1201 * @param[in] color color of outline.
1203 void SetOutlineColor(const Vector4& color);
1206 * @brief Retrieve the outline color.
1208 * @return The outline color.
1210 const Vector4& GetOutlineColor() const;
1213 * @brief Set the outline width
1215 * @param[in] width The width in pixels of the outline, 0 indicates no outline
1217 void SetOutlineWidth(uint16_t width);
1220 * @brief Retrieves the width of an outline
1222 * @return The width of the outline.
1224 uint16_t GetOutlineWidth() const;
1227 * @brief Set the background color.
1229 * @param[in] color color of background.
1231 void SetBackgroundColor(const Vector4& color);
1234 * @brief Retrieve the background color.
1236 * @return The background color.
1238 const Vector4& GetBackgroundColor() const;
1241 * @brief Set the background enabled flag.
1243 * @param[in] enabled The background enabled flag.
1245 void SetBackgroundEnabled(bool enabled);
1248 * @brief Returns whether to enable text background or not.
1250 * @return Whether text background is enabled.
1252 bool IsBackgroundEnabled() const;
1255 * @brief Sets the emboss's properties string.
1257 * @note The string is stored to be recovered.
1259 * @param[in] embossProperties The emboss's properties string.
1261 void SetDefaultEmbossProperties(const std::string& embossProperties);
1264 * @brief Retrieves the emboss's properties string.
1266 * @return The emboss's properties string.
1268 std::string GetDefaultEmbossProperties() const;
1271 * @brief Sets the outline's properties string.
1273 * @note The string is stored to be recovered.
1275 * @param[in] outlineProperties The outline's properties string.
1277 void SetDefaultOutlineProperties(const std::string& outlineProperties);
1280 * @brief Retrieves the outline's properties string.
1282 * @return The outline's properties string.
1284 std::string GetDefaultOutlineProperties() const;
1287 * @brief Sets the default line spacing.
1289 * @param[in] lineSpacing The line spacing.
1291 * @return True if lineSpacing has been updated, false otherwise
1293 bool SetDefaultLineSpacing(float lineSpacing);
1296 * @brief Retrieves the default line spacing.
1298 * @return The line spacing.
1300 float GetDefaultLineSpacing() const;
1303 * @brief Sets the default line size.
1305 * @param[in] lineSize The line size.
1307 * @return True if lineSize has been updated, false otherwise
1309 bool SetDefaultLineSize(float lineSize);
1312 * @brief Retrieves the default line size.
1314 * @return The line size.
1316 float GetDefaultLineSize() const;
1319 * @brief Sets the relative line size to the original line size.
1321 * @param[in] relativeLineSize The relativeline size.
1323 * @return True if relativeLineSize has been updated, false otherwise
1325 bool SetRelativeLineSize(float lineSize);
1328 * @brief Retrieves the relative line size.
1330 * @return The relative line size.
1332 float GetRelativeLineSize() const;
1335 * @brief Sets the input text's color.
1337 * @param[in] color The input text's color.
1339 void SetInputColor(const Vector4& color);
1342 * @brief Retrieves the input text's color.
1344 * @return The input text's color.
1346 const Vector4& GetInputColor() const;
1349 * @brief Sets the input text's font family name.
1351 * @param[in] fontFamily The text's font family name.
1353 void SetInputFontFamily(const std::string& fontFamily);
1356 * @brief Retrieves the input text's font family name.
1358 * @return The input text's font family name.
1360 std::string GetInputFontFamily() const;
1363 * @brief Sets the input font's weight.
1365 * @param[in] weight The input font's weight.
1367 void SetInputFontWeight(FontWeight weight);
1370 * @return Whether the font's weight has been defined.
1372 bool IsInputFontWeightDefined() const;
1375 * @brief Retrieves the input font's weight.
1377 * @return The input font's weight.
1379 FontWeight GetInputFontWeight() const;
1382 * @brief Sets the input font's width.
1384 * @param[in] width The input font's width.
1386 void SetInputFontWidth(FontWidth width);
1389 * @return Whether the font's width has been defined.
1391 bool IsInputFontWidthDefined() const;
1394 * @brief Retrieves the input font's width.
1396 * @return The input font's width.
1398 FontWidth GetInputFontWidth() const;
1401 * @brief Sets the input font's slant.
1403 * @param[in] slant The input font's slant.
1405 void SetInputFontSlant(FontSlant slant);
1408 * @return Whether the font's slant has been defined.
1410 bool IsInputFontSlantDefined() const;
1413 * @brief Retrieves the input font's slant.
1415 * @return The input font's slant.
1417 FontSlant GetInputFontSlant() const;
1420 * @brief Sets the input font's point size.
1422 * @param[in] size The input font's point size.
1424 void SetInputFontPointSize(float size);
1427 * @brief Retrieves the input font's point size.
1429 * @return The input font's point size.
1431 float GetInputFontPointSize() const;
1434 * @brief Sets the input line spacing.
1436 * @param[in] lineSpacing The line spacing.
1438 void SetInputLineSpacing(float lineSpacing);
1441 * @brief Retrieves the input line spacing.
1443 * @return The line spacing.
1445 float GetInputLineSpacing() const;
1448 * @brief Sets the input shadow's properties string.
1450 * @note The string is stored to be recovered.
1452 * @param[in] shadowProperties The shadow's properties string.
1454 void SetInputShadowProperties(const std::string& shadowProperties);
1457 * @brief Retrieves the input shadow's properties string.
1459 * @return The shadow's properties string.
1461 std::string GetInputShadowProperties() const;
1464 * @brief Sets the input underline's properties string.
1466 * @note The string is stored to be recovered.
1468 * @param[in] underlineProperties The underline's properties string.
1470 void SetInputUnderlineProperties(const std::string& underlineProperties);
1473 * @brief Retrieves the input underline's properties string.
1475 * @return The underline's properties string.
1477 std::string GetInputUnderlineProperties() const;
1480 * @brief Sets the input emboss's properties string.
1482 * @note The string is stored to be recovered.
1484 * @param[in] embossProperties The emboss's properties string.
1486 void SetInputEmbossProperties(const std::string& embossProperties);
1489 * @brief Retrieves the input emboss's properties string.
1491 * @return The emboss's properties string.
1493 std::string GetInputEmbossProperties() const;
1496 * @brief Sets input the outline's properties string.
1498 * @note The string is stored to be recovered.
1500 * @param[in] outlineProperties The outline's properties string.
1502 void SetInputOutlineProperties(const std::string& outlineProperties);
1505 * @brief Retrieves the input outline's properties string.
1507 * @return The outline's properties string.
1509 std::string GetInputOutlineProperties() const;
1512 * @brief Sets the input strikethrough's properties string.
1514 * @note The string is stored to be recovered.
1516 * @param[in] strikethroughProperties The strikethrough's properties string.
1518 void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
1521 * @brief Retrieves the input strikethrough's properties string.
1523 * @return The strikethrough's properties string.
1525 std::string GetInputStrikethroughProperties() const;
1528 * @brief Set the control's interface.
1530 * @param[in] controlInterface The control's interface.
1532 void SetControlInterface(ControlInterface* controlInterface);
1535 * @brief Set the anchor control's interface.
1537 * @param[in] anchorControlInterface The control's interface.
1539 void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
1542 * @brief Sets the character spacing.
1544 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1546 * @param[in] characterSpacing The character spacing.
1548 void SetCharacterSpacing(float characterSpacing);
1551 * @brief Retrieves the character spacing.
1553 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1555 * @return The character spacing.
1557 const float GetCharacterSpacing() const;
1559 public: // Queries & retrieves.
1561 * @brief Return the layout engine.
1563 * @return A reference to the layout engine.
1565 Layout::Engine& GetLayoutEngine();
1568 * @brief Return a view of the text.
1570 * @return A reference to the view.
1575 * @copydoc Control::GetNaturalSize()
1577 Vector3 GetNaturalSize();
1580 * @copydoc Control::GetHeightForWidth()
1582 float GetHeightForWidth(float width);
1585 * @brief Calculates the point size for text for given layout()
1587 void FitPointSizeforLayout(Size layoutSize);
1590 * @brief Checks if the point size fits within the layout size.
1592 * @return Whether the point size fits within the layout size.
1594 bool CheckForTextFit(float pointSize, Size& layoutSize);
1597 * @brief Retrieves the text's number of lines for a given width.
1598 * @param[in] width The width of the text's area.
1599 * @ return The number of lines.
1601 int GetLineCount(float width);
1604 * @brief Retrieves the text's model.
1606 * @return A pointer to the text's model.
1608 const ModelInterface* GetTextModel() const;
1611 * @brief Used to get scrolled distance by user input
1613 * @return Distance from last scroll offset to new scroll offset
1615 float GetScrollAmountByUserInput();
1618 * @brief Get latest scroll amount, control size and layout size
1620 * This method is used to get information of control's scroll
1621 * @param[out] scrollPosition The current scrolled position
1622 * @param[out] controlHeight The size of a UI control
1623 * @param[out] layoutHeight The size of a bounding box to layout text within.
1625 * @return Whether the text scroll position is changed or not after last update.
1627 bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1630 * @brief Used to set the hidden input option
1632 void SetHiddenInputOption(const Property::Map& options);
1635 * @brief Used to get the hidden input option
1637 void GetHiddenInputOption(Property::Map& options);
1640 * @brief Used to set the input filter option
1642 void SetInputFilterOption(const Property::Map& options);
1645 * @brief Used to get the input filter option
1647 void GetInputFilterOption(Property::Map& options);
1650 * @brief Sets the Placeholder Properties.
1652 * @param[in] map The placeholder property map
1654 void SetPlaceholderProperty(const Property::Map& map);
1657 * @brief Retrieves the Placeholder Property map.
1659 * @param[out] map The property map
1661 void GetPlaceholderProperty(Property::Map& map);
1664 * @brief Checks text direction.
1665 * @return The text direction.
1667 Toolkit::DevelText::TextDirection::Type GetTextDirection();
1670 * @brief Retrieves vertical line alignment
1671 * @return The vertical line alignment
1673 Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1676 * @brief Sets vertical line alignment
1677 * @param[in] alignment The vertical line alignment for the text
1679 void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1682 * @brief Retrieves ellipsis position
1683 * @return The ellipsis position
1685 Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
1688 * @brief Sets ellipsis position
1689 * @param[in] ellipsisPosition The ellipsis position for the text
1691 void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
1694 * @brief Retrieves ignoreSpaceAfterText value from model
1695 * @return The value of ignoreSpaceAfterText
1697 bool IsIgnoreSpacesAfterText() const;
1700 * @brief Sets ignoreSpaceAfterText value to model
1701 * @param[in] ignore The value of ignoreSpacesAfterText for the text
1703 void SetIgnoreSpacesAfterText(bool ignore);
1706 * @brief Sets SetMatchLayoutDirection value to model
1707 * @param[in] match The value of matchLayoutDirection for the text
1709 void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
1712 * @brief Retrieves matchLayoutDirection value from model
1713 * @return The value of matchLayoutDirection
1715 DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
1718 * @brief Sets layoutDirection type value.
1719 * @param[in] layoutDirection The value of the layout direction type.
1721 void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1724 * @brief Gets layoutDirection type value.
1725 * @param[in] actor The actor which will get the layout direction type.
1726 * @return The value of the layout direction type.
1728 Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
1731 * @brief Get the rendered size of a specific text range.
1732 * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
1733 * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
1735 * @param[in] startIndex start index of the text requested to calculate size for.
1736 * @param[in] endIndex end index(included) of the text requested to calculate size for.
1737 * @return list of sizes of the reuested text.
1739 Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
1742 * @brief Get the top/left rendered position of a specific text range.
1743 * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
1744 * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
1746 * @param[in] startIndex start index of the text requested to get position to.
1747 * @param[in] endIndex end index(included) of the text requested to get position to.
1748 * @return list of positions of the requested text.
1750 Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
1753 * @brief Get the line bounding rectangle.
1754 * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
1756 * @param[in] lineIndex line index to which we want to calculate the geometry for.
1757 * @return bounding rectangle.
1759 Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex);
1762 * @brief Get the char bounding rectangle.
1763 * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
1765 * @param[in] charIndex character index to which we want to calculate the geometry for.
1766 * @return bounding rectangle.
1768 Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
1771 * @brief Get the character index.
1772 * If the text is not yet rendered or the text is empty, -1 is returned.
1774 * @param[in] visualX visual x position.
1775 * @param[in] visualY visual y position.
1776 * @return character index.
1778 int GetCharacterIndexAtPosition(float visualX, float visualY);
1781 * @brief Gets the bounding box of a specific text range.
1783 * @param[in] startIndex start index of the text requested to get bounding box to.
1784 * @param[in] endIndex end index(included) of the text requested to get bounding box to.
1785 * @return bounding box of the requested text.
1787 Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
1790 * @brief Sets the layout direction changed.
1792 void ChangedLayoutDirection();
1795 * @brief Retrieves if showing real text or not.
1796 * @return The value of showing real text.
1798 bool IsShowingRealText() const;
1800 public: // Relayout.
1802 * @brief Triggers a relayout which updates View (if necessary).
1804 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1805 * @param[in] size A the size of a bounding box to layout text within.
1806 * @param[in] layoutDirection The direction of the system language.
1808 * @return Whether the text model or decorations were updated.
1810 UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1813 * @brief Request a relayout using the ControlInterface.
1815 void RequestRelayout();
1817 public: // Input style change signals.
1819 * @return Whether the queue of input style changed signals is empty.
1821 bool IsInputStyleChangedSignalsQueueEmpty();
1824 * @brief Process all pending input style changed signals.
1826 * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1827 * text controls. Text controls may send signals to state the input style has changed.
1829 void ProcessInputStyleChangedSignals();
1831 public: // Text-input Event Queuing.
1833 * @brief Called by editable UI controls when keyboard focus is gained.
1835 void KeyboardFocusGainEvent();
1838 * @brief Called by editable UI controls when focus is lost.
1840 void KeyboardFocusLostEvent();
1843 * @brief Called by editable UI controls when key events are received.
1845 * @param[in] event The key event.
1846 * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1848 bool KeyEvent(const Dali::KeyEvent& event);
1851 * @brief Called by anchor when a tap gesture occurs.
1852 * @param[in] x The x position relative to the top-left of the parent control.
1853 * @param[in] y The y position relative to the top-left of the parent control.
1855 void AnchorEvent(float x, float y);
1858 * @brief Called by editable UI controls when a tap gesture occurs.
1859 * @param[in] tapCount The number of taps.
1860 * @param[in] x The x position relative to the top-left of the parent control.
1861 * @param[in] y The y position relative to the top-left of the parent control.
1863 void TapEvent(unsigned int tapCount, float x, float y);
1866 * @brief Called by editable UI controls when a pan gesture occurs.
1868 * @param[in] state The state of the gesture.
1869 * @param[in] displacement This distance panned since the last pan gesture.
1871 void PanEvent(GestureState state, const Vector2& displacement);
1874 * @brief Called by editable UI controls when a long press gesture occurs.
1876 * @param[in] state The state of the gesture.
1877 * @param[in] x The x position relative to the top-left of the parent control.
1878 * @param[in] y The y position relative to the top-left of the parent control.
1880 void LongPressEvent(GestureState state, float x, float y);
1883 * @brief Used to get the Primary cursor position.
1885 * @return Primary cursor position.
1887 CharacterIndex GetPrimaryCursorPosition() const;
1890 * @brief Used to set the Primary cursor position.
1892 * @param[in] index for the Primary cursor position.
1893 * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
1894 * @return[in] true if cursor position changed, false otherwise.
1896 bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
1899 * @brief Creates a selection event.
1901 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1903 * @param[in] x The x position relative to the top-left of the parent control.
1904 * @param[in] y The y position relative to the top-left of the parent control.
1905 * @param[in] selection type like the whole text is selected or unselected.
1907 void SelectEvent(float x, float y, SelectionType selection);
1910 * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
1912 void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
1915 * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
1917 Uint32Pair GetTextSelectionRange() const;
1920 * @copydoc Text::SelectableControlInterface::SelectWholeText()
1922 void SelectWholeText();
1925 * @copydoc Text::EditableControlInterface::CopyText()
1930 * @copydoc Text::EditableControlInterface::CutText()
1935 * @copydoc Text::EditableControlInterface::PasteText()
1940 * @copydoc Text::SelectableControlInterface::SelectNone()
1945 * @copydoc Text::SelectableControlInterface::SelectText()
1947 void SelectText(const uint32_t start, const uint32_t end);
1950 * @copydoc Text::SelectableControlInterface::GetSelectedText()
1952 string GetSelectedText() const;
1955 * @copydoc Text::EditableControlInterface::IsEditable()
1957 virtual bool IsEditable() const;
1960 * @copydoc Text::EditableControlInterface::SetEditable()
1962 virtual void SetEditable(bool editable);
1965 * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
1967 virtual void ScrollBy(Vector2 scroll);
1970 * @brief Whether the text is scrollable.
1971 * @return Returns true if the text is scrollable.
1973 bool IsScrollable(const Vector2& displacement);
1976 * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
1978 float GetHorizontalScrollPosition();
1981 * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
1983 float GetVerticalScrollPosition();
1986 * @brief Event received from input method context
1988 * @param[in] inputMethodContext The input method context.
1989 * @param[in] inputMethodContextEvent The event received.
1990 * @return A data struture indicating if update is needed, cursor position and current text.
1992 InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
1995 * @brief Event from Clipboard notifying an Item has been selected for pasting
1997 void PasteClipboardItemEvent();
2000 * @brief Return true when text control should clear key input focus when escape key is pressed.
2002 * @return Whether text control should clear key input focus or not when escape key is pressed.
2004 bool ShouldClearFocusOnEscape() const;
2007 * @brief Create an actor that renders the text background color
2009 * @return the created actor or an empty handle if no background color needs to be rendered.
2011 Actor CreateBackgroundActor();
2014 * @brief Used to reset the cursor position after setting a new text.
2016 * @param[in] cursorIndex Where to place the cursor.
2018 void ResetCursorPosition(CharacterIndex cursorIndex);
2021 * @brief The method acquires current position of cursor
2022 * @return unsigned value with cursor position
2024 CharacterIndex GetCursorPosition();
2027 * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text
2029 * @param[out] anchorActors the vector of actor (empty collection if no anchors available).
2031 void GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors);
2034 * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset
2036 * @param[in] characterOffset A position in text coords.
2038 * @return the index in anchor vector (-1 if an anchor not found)
2040 int GetAnchorIndex(size_t characterOffset);
2042 protected: // Inherit from Text::Decorator::ControllerInterface.
2044 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
2046 void GetTargetSize(Vector2& targetSize) override;
2049 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
2051 void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
2054 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
2056 void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
2058 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
2060 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
2062 void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
2064 protected: // Inherit from HiddenText.
2066 * @brief Invoked from HiddenText when showing time of the last character was expired
2068 void DisplayTimeExpired() override;
2070 private: // Private contructors & copy operator.
2072 * @brief Private constructor.
2075 : Controller(nullptr, nullptr, nullptr, nullptr)
2080 * @brief Private constructor.
2082 Controller(ControlInterface* controlInterface)
2083 : Controller(controlInterface, nullptr, nullptr, nullptr)
2088 * @brief Private constructor.
2090 Controller(ControlInterface* controlInterface,
2091 EditableControlInterface* editableControlInterface,
2092 SelectableControlInterface* selectableControlInterface,
2093 AnchorControlInterface* anchorControlInterface);
2095 Controller(const Controller& handle) = delete;
2096 Controller& operator=(const Controller& handle) = delete;
2098 protected: // Destructor.
2100 * @brief A reference counted object may only be deleted by calling Unreference().
2102 virtual ~Controller();
2105 struct Impl; ///< Made public for testing purposes
2108 struct EventHandler;
2109 struct InputFontHandler;
2110 struct InputProperties;
2111 struct PlaceholderHandler;
2114 struct SpannableHandler;
2116 std::unique_ptr<Impl> mImpl{nullptr};
2119 } // namespace Dali::Toolkit::Text
2121 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H