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 line size valid for text fit.
519 * @param[in] lineSize line size value
521 void SetTextFitLineSize(float lineSize);
524 * @brief Sets disabled color opacity.
526 * @param[in] opacity The color opacity value in disabled state.
528 void SetDisabledColorOpacity(float opacity);
531 * @brief Retrieves the disabled color opacity.
533 * @return The disabled color opacity value for disabled state.
535 float GetDisabledColorOpacity() const;
538 * @brief Enable or disable the placeholder text elide.
539 * @param enabled Whether to enable the placeholder text elide.
541 void SetPlaceholderTextElideEnabled(bool enabled);
544 * @brief Whether the placeholder text elide property is enabled.
545 * @return True if the placeholder text elide property is enabled, false otherwise.
547 bool IsPlaceholderTextElideEnabled() const;
550 * @brief Enable or disable the text selection.
551 * @param[in] enabled Whether to enable the text selection.
553 void SetSelectionEnabled(bool enabled);
556 * @brief Whether the text selection is enabled or not.
557 * @return True if the text selection is enabled
559 bool IsSelectionEnabled() const;
562 * @brief Enable or disable the text selection using Shift key.
563 * @param enabled Whether to enable the text selection using Shift key
565 void SetShiftSelectionEnabled(bool enabled);
568 * @brief Whether the text selection using Shift key is enabled or not.
569 * @return True if the text selection using Shift key is enabled
571 bool IsShiftSelectionEnabled() const;
574 * @brief Enable or disable the grab handles for text selection.
576 * @param[in] enabled Whether to enable the grab handles
578 void SetGrabHandleEnabled(bool enabled);
581 * @brief Returns whether the grab handles are enabled.
583 * @return True if the grab handles are enabled
585 bool IsGrabHandleEnabled() const;
588 * @brief Enable or disable the grab handles for text selection.
590 * @param[in] enabled Whether to enable the grab handles
592 void SetGrabHandlePopupEnabled(bool enabled);
595 * @brief Returns whether the grab handles are enabled.
597 * @return True if the grab handles are enabled
599 bool IsGrabHandlePopupEnabled() const;
602 * @brief Sets input type to password
604 * @note The string is displayed hidden character
606 * @param[in] passwordInput True if password input is enabled.
608 void SetInputModePassword(bool passwordInput);
611 * @brief Returns whether the input mode type is set as password.
613 * @return True if input mode type is password
615 bool IsInputModePassword();
618 * @brief Sets the action when there is a double tap event on top of a text area with no text.
620 * @param[in] action The action to do.
622 void SetNoTextDoubleTapAction(NoTextTap::Action action);
625 * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
627 * @return The action to do.
629 NoTextTap::Action GetNoTextDoubleTapAction() const;
632 * @briefSets the action when there is a long press event on top of a text area with no text.
634 * @param[in] action The action to do.
636 void SetNoTextLongPressAction(NoTextTap::Action action);
639 * @brief Retrieves the action when there is a long press event on top of a text area with no text.
641 * @return The action to do.
643 NoTextTap::Action GetNoTextLongPressAction() const;
646 * @brief Query if Underline settings were provided by string or map
647 * @return bool true if set by string
649 bool IsUnderlineSetByString();
652 * Set method underline setting were set by
653 * @param[in] bool, true if set by string
655 void UnderlineSetByString(bool setByString);
658 * @brief Query if shadow settings were provided by string or map
659 * @return bool true if set by string
661 bool IsShadowSetByString();
664 * Set method shadow setting were set by
665 * @param[in] bool, true if set by string
667 void ShadowSetByString(bool setByString);
670 * @brief Query if outline settings were provided by string or map
671 * @return bool true if set by string
673 bool IsOutlineSetByString();
676 * Set method outline setting were set by
677 * @param[in] bool, true if set by string
679 void OutlineSetByString(bool setByString);
682 * @brief Query if font style settings were provided by string or map
683 * @return bool true if set by string
685 bool IsFontStyleSetByString();
688 * Set method font style setting were set by
689 * @param[in] bool, true if set by string
691 void FontStyleSetByString(bool setByString);
694 * @brief Query if Strikethrough settings were provided by string or map
695 * @return bool true if set by string
697 bool IsStrikethroughSetByString();
700 * Set method Strikethrough setting were set by
701 * @param[in] bool, true if set by string
703 void StrikethroughSetByString(bool setByString);
706 * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
708 * @param[in] height The height in pixels of the strikethrough
710 void SetStrikethroughHeight(float height);
713 * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
715 * @return The height of the strikethrough, or 0 if height is not overrided.
717 float GetStrikethroughHeight() const;
720 * @brief Set the strikethrough color.
722 * @param[in] color color of strikethrough.
724 void SetStrikethroughColor(const Vector4& color);
727 * @brief Retrieve the strikethrough color.
729 * @return The strikethrough color.
731 const Vector4& GetStrikethroughColor() const;
734 * @brief Set the strikethrough enabled flag.
736 * @param[in] enabled The strikethrough enabled flag.
738 void SetStrikethroughEnabled(bool enabled);
741 * @brief Returns whether the text has a strikethrough or not.
743 * @return The strikethrough state.
745 bool IsStrikethroughEnabled() const;
749 * @brief Replaces any text previously set.
751 * @note This will be converted into UTF-32 when stored in the text model.
752 * @param[in] text A string of UTF-8 characters.
754 void SetText(const std::string& text);
757 * @brief Retrieve any text previously set.
759 * @param[out] text A string of UTF-8 characters.
761 void GetText(std::string& text) const;
764 * @brief Retrieves number of characters previously set.
766 * @return A length of string of UTF-32 characters.
768 Length GetNumberOfCharacters() const;
771 * @brief Set the @p spannedText
772 * the spanned text contains content (text) and format (spans with ranges)
773 * the text is copied into text-controller and the spans are applied on ranges
775 * @param[in] spannedText the text with spans.
777 void SetSpannedText(const Text::Spanned& spannedText);
780 * @brief Replaces any placeholder text previously set.
782 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
783 * @param[in] text A string of UTF-8 characters.
785 void SetPlaceholderText(PlaceholderType type, const std::string& text);
788 * @brief Retrieve any placeholder text previously set.
790 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
791 * @param[out] A string of UTF-8 characters.
793 void GetPlaceholderText(PlaceholderType type, std::string& text) const;
796 * @ brief Update the text after a font change
797 * @param[in] newDefaultFont The new font to change to
799 void UpdateAfterFontChange(const std::string& newDefaultFont);
802 * @brief The method acquires currently selected text
803 * @param selectedText variable to place selected text in
805 void RetrieveSelection(std::string& selectedText) const;
808 * @brief The method sets selection in given range
809 * @param start index of first character
810 * @param end index of first character after selection
812 void SetSelection(int start, int end);
815 * @brief This method retrieve indexes of current selection
817 * @return a pair, where first element is left index of selection and second is the right one
819 std::pair<int, int> GetSelectionIndexes() const;
822 * Place string in system clipboard
823 * @param source std::string
825 void CopyStringToClipboard(const std::string& source);
828 * Place currently selected text in system clipboard
829 * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
831 void SendSelectionToClipboard(bool deleteAfterSending);
833 public: // Default style & Input style
835 * @brief Set the default font family.
837 * @param[in] defaultFontFamily The default font family.
839 void SetDefaultFontFamily(const std::string& defaultFontFamily);
842 * @brief Retrieve the default font family.
844 * @return The default font family.
846 std::string GetDefaultFontFamily() const;
849 * @brief Sets the placeholder text font family.
850 * @param[in] placeholderTextFontFamily The placeholder text font family.
852 void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
855 * @brief Retrieves the placeholder text font family.
857 * @return The placeholder text font family
859 std::string GetPlaceholderFontFamily() const;
862 * @brief Sets the default font weight.
864 * @param[in] weight The font weight.
866 void SetDefaultFontWeight(FontWeight weight);
869 * @brief Whether the font's weight has been defined.
871 bool IsDefaultFontWeightDefined() const;
874 * @brief Retrieves the default font weight.
876 * @return The default font weight.
878 FontWeight GetDefaultFontWeight() const;
881 * @brief Sets the placeholder text font weight.
883 * @param[in] weight The font weight
885 void SetPlaceholderTextFontWeight(FontWeight weight);
888 * @brief Whether the font's weight has been defined.
890 * @return True if the placeholder text font weight is defined
892 bool IsPlaceholderTextFontWeightDefined() const;
895 * @brief Retrieves the placeholder text font weight.
897 * @return The placeholder text font weight
899 FontWeight GetPlaceholderTextFontWeight() const;
902 * @brief Sets the default font width.
904 * @param[in] width The font width.
906 void SetDefaultFontWidth(FontWidth width);
909 * @brief Whether the font's width has been defined.
911 bool IsDefaultFontWidthDefined() const;
914 * @brief Retrieves the default font width.
916 * @return The default font width.
918 FontWidth GetDefaultFontWidth() const;
921 * @brief Sets the placeholder text font width.
923 * @param[in] width The font width
925 void SetPlaceholderTextFontWidth(FontWidth width);
928 * @brief Whether the font's width has been defined.
930 * @return True if the placeholder text font width is defined
932 bool IsPlaceholderTextFontWidthDefined() const;
935 * @brief Retrieves the placeholder text font width.
937 * @return The placeholder text font width
939 FontWidth GetPlaceholderTextFontWidth() const;
942 * @brief Sets the default font slant.
944 * @param[in] slant The font slant.
946 void SetDefaultFontSlant(FontSlant slant);
949 * @brief Whether the font's slant has been defined.
951 bool IsDefaultFontSlantDefined() const;
954 * @brief Retrieves the default font slant.
956 * @return The default font slant.
958 FontSlant GetDefaultFontSlant() const;
961 * @brief Sets the placeholder text font slant.
963 * @param[in] slant The font slant
965 void SetPlaceholderTextFontSlant(FontSlant slant);
968 * @brief Whether the font's slant has been defined.
970 * @return True if the placeholder text font slant is defined
972 bool IsPlaceholderTextFontSlantDefined() const;
975 * @brief Retrieves the placeholder text font slant.
977 * @return The placeholder text font slant
979 FontSlant GetPlaceholderTextFontSlant() const;
982 * @brief Set the default font size.
984 * @param[in] fontSize The default font size
985 * @param[in] type The font size type is point size or pixel size
987 void SetDefaultFontSize(float fontSize, FontSizeType type);
990 * @brief Retrieve the default point size.
992 * @param[in] type The font size type
993 * @return The default point size.
995 float GetDefaultFontSize(FontSizeType type) const;
998 * @brief Set the font size scale.
1000 * @param[in] scale The font size scale
1002 void SetFontSizeScale(float scale);
1005 * @brief Get the font size scale.
1007 * @return The font size scale.
1009 float GetFontSizeScale() const;
1012 * @brief Set the font size scale enabled flag.
1014 * @param[in] enabled whether to enable the font size scale.
1016 void SetFontSizeScaleEnabled(bool enabled);
1019 * @brief Returns whether the font size scale is enabled or not.
1021 * @return @e true if the font size scale is enabled, otherwise returns @e false.
1023 bool IsFontSizeScaleEnabled() const;
1026 * @brief Sets the Placeholder text font size.
1027 * @param[in] fontSize The placeholder text font size
1028 * @param[in] type The font size type is point size or pixel size
1030 void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
1033 * @brief Retrieves the Placeholder text font size.
1034 * @param[in] type The font size type
1035 * @return The placeholder font size
1037 float GetPlaceholderTextFontSize(FontSizeType type) const;
1040 * @brief Sets the text's default color.
1042 * @param color The default color.
1044 void SetDefaultColor(const Vector4& color);
1047 * @brief Retrieves the text's default color.
1049 * @return The default color.
1051 const Vector4& GetDefaultColor() const;
1054 * @brief Sets the user interaction enabled.
1056 * @param enabled whether to enable the user interaction.
1058 void SetUserInteractionEnabled(bool enabled);
1061 * @brief Whether the user interaction is enabled.
1063 * @return true if the user interaction is enabled, false otherwise.
1065 bool IsUserInteractionEnabled() const;
1068 * @brief Set the text color
1070 * @param textColor The text color
1072 void SetPlaceholderTextColor(const Vector4& textColor);
1075 * @brief Retrieve the text color
1077 * @return The text color
1079 const Vector4& GetPlaceholderTextColor() const;
1082 * @brief Set the shadow offset.
1084 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
1086 void SetShadowOffset(const Vector2& shadowOffset);
1089 * @brief Retrieve the shadow offset.
1091 * @return The shadow offset.
1093 const Vector2& GetShadowOffset() const;
1096 * @brief Set the shadow color.
1098 * @param[in] shadowColor The shadow color.
1100 void SetShadowColor(const Vector4& shadowColor);
1103 * @brief Retrieve the shadow color.
1105 * @return The shadow color.
1107 const Vector4& GetShadowColor() const;
1110 * @brief Set the shadow blur radius.
1112 * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
1114 void SetShadowBlurRadius(const float& shadowBlurRadius);
1117 * @brief Retrieve the shadow blur radius.
1119 * @return The shadow blur radius.
1121 const float& GetShadowBlurRadius() const;
1124 * @brief Set the underline color.
1126 * @param[in] color color of underline.
1128 void SetUnderlineColor(const Vector4& color);
1131 * @brief Retrieve the underline color.
1133 * @return The underline color.
1135 const Vector4& GetUnderlineColor() const;
1138 * @brief Set the underline enabled flag.
1140 * @param[in] enabled The underline enabled flag.
1142 void SetUnderlineEnabled(bool enabled);
1145 * @brief Returns whether the text is underlined or not.
1147 * @return The underline state.
1149 bool IsUnderlineEnabled() const;
1152 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
1154 * @param[in] height The height in pixels of the underline
1156 void SetUnderlineHeight(float height);
1159 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
1161 * @return The height of the underline, or 0 if height is not overrided.
1163 float GetUnderlineHeight() const;
1166 * @brief Sets the underline type.
1167 * @param[in] type The underline type.
1169 void SetUnderlineType(Text::Underline::Type type);
1172 * @brief Retrieve underline type.
1173 * @return The underline type.
1175 Text::Underline::Type GetUnderlineType() const;
1178 * @brief Set the width of the dashes of the dashed underline.
1180 * @param[in] width The width in pixels of the dashes of the dashed underline.
1182 void SetDashedUnderlineWidth(float width);
1185 * @brief Retrieves the width of the dashes of the dashed underline.
1187 * @return The width of the dashes of the dashed underline.
1189 float GetDashedUnderlineWidth() const;
1192 * @brief Set the gap between the dashes of the dashed underline.
1194 * @param[in] gap The gap between the dashes of the dashed underline.
1196 void SetDashedUnderlineGap(float gap);
1199 * @brief Retrieves the gap between the dashes of the dashed underline.
1201 * @return The The gap between the dashes of the dashed underline.
1203 float GetDashedUnderlineGap() const;
1206 * @brief Set the outline color.
1208 * @param[in] color color of outline.
1210 void SetOutlineColor(const Vector4& color);
1213 * @brief Retrieve the outline color.
1215 * @return The outline color.
1217 const Vector4& GetOutlineColor() const;
1220 * @brief Set the outline width
1222 * @param[in] width The width in pixels of the outline, 0 indicates no outline
1224 void SetOutlineWidth(uint16_t width);
1227 * @brief Retrieves the width of an outline
1229 * @return The width of the outline.
1231 uint16_t GetOutlineWidth() const;
1234 * @brief Set the background color.
1236 * @param[in] color color of background.
1238 void SetBackgroundColor(const Vector4& color);
1241 * @brief Retrieve the background color.
1243 * @return The background color.
1245 const Vector4& GetBackgroundColor() const;
1248 * @brief Set the background enabled flag.
1250 * @param[in] enabled The background enabled flag.
1252 void SetBackgroundEnabled(bool enabled);
1255 * @brief Returns whether to enable text background or not.
1257 * @return Whether text background is enabled.
1259 bool IsBackgroundEnabled() const;
1262 * @brief Sets the emboss's properties string.
1264 * @note The string is stored to be recovered.
1266 * @param[in] embossProperties The emboss's properties string.
1268 void SetDefaultEmbossProperties(const std::string& embossProperties);
1271 * @brief Retrieves the emboss's properties string.
1273 * @return The emboss's properties string.
1275 std::string GetDefaultEmbossProperties() const;
1278 * @brief Sets the outline's properties string.
1280 * @note The string is stored to be recovered.
1282 * @param[in] outlineProperties The outline's properties string.
1284 void SetDefaultOutlineProperties(const std::string& outlineProperties);
1287 * @brief Retrieves the outline's properties string.
1289 * @return The outline's properties string.
1291 std::string GetDefaultOutlineProperties() const;
1294 * @brief Sets the default line spacing.
1296 * @param[in] lineSpacing The line spacing.
1298 * @return True if lineSpacing has been updated, false otherwise
1300 bool SetDefaultLineSpacing(float lineSpacing);
1303 * @brief Retrieves the default line spacing.
1305 * @return The line spacing.
1307 float GetDefaultLineSpacing() const;
1310 * @brief Sets the default line size.
1312 * @param[in] lineSize The line size.
1314 * @return True if lineSize has been updated, false otherwise
1316 bool SetDefaultLineSize(float lineSize);
1319 * @brief Retrieves the default line size.
1321 * @return The line size.
1323 float GetDefaultLineSize() const;
1326 * @brief Sets the relative line size to the original line size.
1328 * @param[in] relativeLineSize The relativeline size.
1330 * @return True if relativeLineSize has been updated, false otherwise
1332 bool SetRelativeLineSize(float lineSize);
1335 * @brief Retrieves the relative line size.
1337 * @return The relative line size.
1339 float GetRelativeLineSize() const;
1342 * @brief Sets the input text's color.
1344 * @param[in] color The input text's color.
1346 void SetInputColor(const Vector4& color);
1349 * @brief Retrieves the input text's color.
1351 * @return The input text's color.
1353 const Vector4& GetInputColor() const;
1356 * @brief Sets the input text's font family name.
1358 * @param[in] fontFamily The text's font family name.
1360 void SetInputFontFamily(const std::string& fontFamily);
1363 * @brief Retrieves the input text's font family name.
1365 * @return The input text's font family name.
1367 std::string GetInputFontFamily() const;
1370 * @brief Sets the input font's weight.
1372 * @param[in] weight The input font's weight.
1374 void SetInputFontWeight(FontWeight weight);
1377 * @return Whether the font's weight has been defined.
1379 bool IsInputFontWeightDefined() const;
1382 * @brief Retrieves the input font's weight.
1384 * @return The input font's weight.
1386 FontWeight GetInputFontWeight() const;
1389 * @brief Sets the input font's width.
1391 * @param[in] width The input font's width.
1393 void SetInputFontWidth(FontWidth width);
1396 * @return Whether the font's width has been defined.
1398 bool IsInputFontWidthDefined() const;
1401 * @brief Retrieves the input font's width.
1403 * @return The input font's width.
1405 FontWidth GetInputFontWidth() const;
1408 * @brief Sets the input font's slant.
1410 * @param[in] slant The input font's slant.
1412 void SetInputFontSlant(FontSlant slant);
1415 * @return Whether the font's slant has been defined.
1417 bool IsInputFontSlantDefined() const;
1420 * @brief Retrieves the input font's slant.
1422 * @return The input font's slant.
1424 FontSlant GetInputFontSlant() const;
1427 * @brief Sets the input font's point size.
1429 * @param[in] size The input font's point size.
1431 void SetInputFontPointSize(float size);
1434 * @brief Retrieves the input font's point size.
1436 * @return The input font's point size.
1438 float GetInputFontPointSize() const;
1441 * @brief Sets the input line spacing.
1443 * @param[in] lineSpacing The line spacing.
1445 void SetInputLineSpacing(float lineSpacing);
1448 * @brief Retrieves the input line spacing.
1450 * @return The line spacing.
1452 float GetInputLineSpacing() const;
1455 * @brief Sets the input shadow's properties string.
1457 * @note The string is stored to be recovered.
1459 * @param[in] shadowProperties The shadow's properties string.
1461 void SetInputShadowProperties(const std::string& shadowProperties);
1464 * @brief Retrieves the input shadow's properties string.
1466 * @return The shadow's properties string.
1468 std::string GetInputShadowProperties() const;
1471 * @brief Sets the input underline's properties string.
1473 * @note The string is stored to be recovered.
1475 * @param[in] underlineProperties The underline's properties string.
1477 void SetInputUnderlineProperties(const std::string& underlineProperties);
1480 * @brief Retrieves the input underline's properties string.
1482 * @return The underline's properties string.
1484 std::string GetInputUnderlineProperties() const;
1487 * @brief Sets the input emboss's properties string.
1489 * @note The string is stored to be recovered.
1491 * @param[in] embossProperties The emboss's properties string.
1493 void SetInputEmbossProperties(const std::string& embossProperties);
1496 * @brief Retrieves the input emboss's properties string.
1498 * @return The emboss's properties string.
1500 std::string GetInputEmbossProperties() const;
1503 * @brief Sets input the outline's properties string.
1505 * @note The string is stored to be recovered.
1507 * @param[in] outlineProperties The outline's properties string.
1509 void SetInputOutlineProperties(const std::string& outlineProperties);
1512 * @brief Retrieves the input outline's properties string.
1514 * @return The outline's properties string.
1516 std::string GetInputOutlineProperties() const;
1519 * @brief Sets the input strikethrough's properties string.
1521 * @note The string is stored to be recovered.
1523 * @param[in] strikethroughProperties The strikethrough's properties string.
1525 void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
1528 * @brief Retrieves the input strikethrough's properties string.
1530 * @return The strikethrough's properties string.
1532 std::string GetInputStrikethroughProperties() const;
1535 * @brief Set the control's interface.
1537 * @param[in] controlInterface The control's interface.
1539 void SetControlInterface(ControlInterface* controlInterface);
1542 * @brief Set the anchor control's interface.
1544 * @param[in] anchorControlInterface The control's interface.
1546 void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
1549 * @brief Sets the character spacing.
1551 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1553 * @param[in] characterSpacing The character spacing.
1555 void SetCharacterSpacing(float characterSpacing);
1558 * @brief Retrieves the character spacing.
1560 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1562 * @return The character spacing.
1564 const float GetCharacterSpacing() const;
1566 public: // Queries & retrieves.
1568 * @brief Return the layout engine.
1570 * @return A reference to the layout engine.
1572 Layout::Engine& GetLayoutEngine();
1575 * @brief Return a view of the text.
1577 * @return A reference to the view.
1582 * @copydoc Control::GetNaturalSize()
1584 Vector3 GetNaturalSize();
1587 * @copydoc Control::GetHeightForWidth()
1589 float GetHeightForWidth(float width);
1592 * @brief Calculates the point size for text for given layout()
1594 void FitPointSizeforLayout(Size layoutSize);
1597 * @brief Checks if the point size fits within the layout size.
1599 * @return Whether the point size fits within the layout size.
1601 bool CheckForTextFit(float pointSize, Size& layoutSize);
1604 * @brief Retrieves the text's number of lines for a given width.
1605 * @param[in] width The width of the text's area.
1606 * @ return The number of lines.
1608 int GetLineCount(float width);
1611 * @brief Retrieves the text's model.
1613 * @return A pointer to the text's model.
1615 const ModelInterface* GetTextModel() const;
1618 * @brief Used to get scrolled distance by user input
1620 * @return Distance from last scroll offset to new scroll offset
1622 float GetScrollAmountByUserInput();
1625 * @brief Get latest scroll amount, control size and layout size
1627 * This method is used to get information of control's scroll
1628 * @param[out] scrollPosition The current scrolled position
1629 * @param[out] controlHeight The size of a UI control
1630 * @param[out] layoutHeight The size of a bounding box to layout text within.
1632 * @return Whether the text scroll position is changed or not after last update.
1634 bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1637 * @brief Used to set the hidden input option
1639 void SetHiddenInputOption(const Property::Map& options);
1642 * @brief Used to get the hidden input option
1644 void GetHiddenInputOption(Property::Map& options);
1647 * @brief Used to set the input filter option
1649 void SetInputFilterOption(const Property::Map& options);
1652 * @brief Used to get the input filter option
1654 void GetInputFilterOption(Property::Map& options);
1657 * @brief Sets the Placeholder Properties.
1659 * @param[in] map The placeholder property map
1661 void SetPlaceholderProperty(const Property::Map& map);
1664 * @brief Retrieves the Placeholder Property map.
1666 * @param[out] map The property map
1668 void GetPlaceholderProperty(Property::Map& map);
1671 * @brief Checks text direction.
1672 * @return The text direction.
1674 Toolkit::DevelText::TextDirection::Type GetTextDirection();
1677 * @brief Retrieves vertical line alignment
1678 * @return The vertical line alignment
1680 Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1683 * @brief Sets vertical line alignment
1684 * @param[in] alignment The vertical line alignment for the text
1686 void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1689 * @brief Retrieves ellipsis position
1690 * @return The ellipsis position
1692 Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
1695 * @brief Sets ellipsis position
1696 * @param[in] ellipsisPosition The ellipsis position for the text
1698 void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
1701 * @brief Retrieves ignoreSpaceAfterText value from model
1702 * @return The value of ignoreSpaceAfterText
1704 bool IsIgnoreSpacesAfterText() const;
1707 * @brief Sets ignoreSpaceAfterText value to model
1708 * @param[in] ignore The value of ignoreSpacesAfterText for the text
1710 void SetIgnoreSpacesAfterText(bool ignore);
1713 * @brief Sets SetMatchLayoutDirection value to model
1714 * @param[in] match The value of matchLayoutDirection for the text
1716 void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
1719 * @brief Retrieves matchLayoutDirection value from model
1720 * @return The value of matchLayoutDirection
1722 DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
1725 * @brief Sets layoutDirection type value.
1726 * @param[in] layoutDirection The value of the layout direction type.
1728 void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1731 * @brief Gets layoutDirection type value.
1732 * @param[in] actor The actor which will get the layout direction type.
1733 * @return The value of the layout direction type.
1735 Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
1738 * @brief Get the rendered size of a specific text range.
1739 * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
1740 * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
1742 * @param[in] startIndex start index of the text requested to calculate size for.
1743 * @param[in] endIndex end index(included) of the text requested to calculate size for.
1744 * @return list of sizes of the reuested text.
1746 Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
1749 * @brief Get the top/left rendered position of a specific text range.
1750 * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
1751 * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
1753 * @param[in] startIndex start index of the text requested to get position to.
1754 * @param[in] endIndex end index(included) of the text requested to get position to.
1755 * @return list of positions of the requested text.
1757 Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
1760 * @brief Get the line bounding rectangle.
1761 * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
1763 * @param[in] lineIndex line index to which we want to calculate the geometry for.
1764 * @return bounding rectangle.
1766 Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex);
1769 * @brief Get the char bounding rectangle.
1770 * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
1772 * @param[in] charIndex character index to which we want to calculate the geometry for.
1773 * @return bounding rectangle.
1775 Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
1778 * @brief Get the character index.
1779 * If the text is not yet rendered or the text is empty, -1 is returned.
1781 * @param[in] visualX visual x position.
1782 * @param[in] visualY visual y position.
1783 * @return character index.
1785 int GetCharacterIndexAtPosition(float visualX, float visualY);
1788 * @brief Gets the bounding box of a specific text range.
1790 * @param[in] startIndex start index of the text requested to get bounding box to.
1791 * @param[in] endIndex end index(included) of the text requested to get bounding box to.
1792 * @return bounding box of the requested text.
1794 Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
1797 * @brief Sets the layout direction changed.
1799 void ChangedLayoutDirection();
1802 * @brief Retrieves if showing real text or not.
1803 * @return The value of showing real text.
1805 bool IsShowingRealText() const;
1807 public: // Relayout.
1809 * @brief Triggers a relayout which updates View (if necessary).
1811 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1812 * @param[in] size A the size of a bounding box to layout text within.
1813 * @param[in] layoutDirection The direction of the system language.
1815 * @return Whether the text model or decorations were updated.
1817 UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1820 * @brief Request a relayout using the ControlInterface.
1822 void RequestRelayout();
1824 public: // Input style change signals.
1826 * @return Whether the queue of input style changed signals is empty.
1828 bool IsInputStyleChangedSignalsQueueEmpty();
1831 * @brief Process all pending input style changed signals.
1833 * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1834 * text controls. Text controls may send signals to state the input style has changed.
1836 void ProcessInputStyleChangedSignals();
1838 public: // Text-input Event Queuing.
1840 * @brief Called by editable UI controls when keyboard focus is gained.
1842 void KeyboardFocusGainEvent();
1845 * @brief Called by editable UI controls when focus is lost.
1847 void KeyboardFocusLostEvent();
1850 * @brief Called by editable UI controls when key events are received.
1852 * @param[in] event The key event.
1853 * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1855 bool KeyEvent(const Dali::KeyEvent& event);
1858 * @brief Called by anchor when a tap gesture occurs.
1859 * @param[in] x The x position relative to the top-left of the parent control.
1860 * @param[in] y The y position relative to the top-left of the parent control.
1862 void AnchorEvent(float x, float y);
1865 * @brief Called by editable UI controls when a tap gesture occurs.
1866 * @param[in] tapCount The number of taps.
1867 * @param[in] x The x position relative to the top-left of the parent control.
1868 * @param[in] y The y position relative to the top-left of the parent control.
1870 void TapEvent(unsigned int tapCount, float x, float y);
1873 * @brief Called by editable UI controls when a pan gesture occurs.
1875 * @param[in] state The state of the gesture.
1876 * @param[in] displacement This distance panned since the last pan gesture.
1878 void PanEvent(GestureState state, const Vector2& displacement);
1881 * @brief Called by editable UI controls when a long press gesture occurs.
1883 * @param[in] state The state of the gesture.
1884 * @param[in] x The x position relative to the top-left of the parent control.
1885 * @param[in] y The y position relative to the top-left of the parent control.
1887 void LongPressEvent(GestureState state, float x, float y);
1890 * @brief Used to get the Primary cursor position.
1892 * @return Primary cursor position.
1894 CharacterIndex GetPrimaryCursorPosition() const;
1897 * @brief Used to set the Primary cursor position.
1899 * @param[in] index for the Primary cursor position.
1900 * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
1901 * @return[in] true if cursor position changed, false otherwise.
1903 bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
1906 * @brief Creates a selection event.
1908 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1910 * @param[in] x The x position relative to the top-left of the parent control.
1911 * @param[in] y The y position relative to the top-left of the parent control.
1912 * @param[in] selection type like the whole text is selected or unselected.
1914 void SelectEvent(float x, float y, SelectionType selection);
1917 * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
1919 void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
1922 * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
1924 Uint32Pair GetTextSelectionRange() const;
1927 * @copydoc Text::SelectableControlInterface::SelectWholeText()
1929 void SelectWholeText();
1932 * @copydoc Text::EditableControlInterface::CopyText()
1937 * @copydoc Text::EditableControlInterface::CutText()
1942 * @copydoc Text::EditableControlInterface::PasteText()
1947 * @copydoc Text::SelectableControlInterface::SelectNone()
1952 * @copydoc Text::SelectableControlInterface::SelectText()
1954 void SelectText(const uint32_t start, const uint32_t end);
1957 * @copydoc Text::SelectableControlInterface::GetSelectedText()
1959 string GetSelectedText() const;
1962 * @copydoc Text::EditableControlInterface::IsEditable()
1964 virtual bool IsEditable() const;
1967 * @copydoc Text::EditableControlInterface::SetEditable()
1969 virtual void SetEditable(bool editable);
1972 * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
1974 virtual void ScrollBy(Vector2 scroll);
1977 * @brief Whether the text is scrollable.
1978 * @return Returns true if the text is scrollable.
1980 bool IsScrollable(const Vector2& displacement);
1983 * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
1985 float GetHorizontalScrollPosition();
1988 * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
1990 float GetVerticalScrollPosition();
1993 * @brief Event received from input method context
1995 * @param[in] inputMethodContext The input method context.
1996 * @param[in] inputMethodContextEvent The event received.
1997 * @return A data struture indicating if update is needed, cursor position and current text.
1999 InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
2002 * @brief Event from Clipboard notifying an Item has been selected for pasting
2004 void PasteClipboardItemEvent();
2007 * @brief Return true when text control should clear key input focus when escape key is pressed.
2009 * @return Whether text control should clear key input focus or not when escape key is pressed.
2011 bool ShouldClearFocusOnEscape() const;
2014 * @brief Create an actor that renders the text background color
2016 * @return the created actor or an empty handle if no background color needs to be rendered.
2018 Actor CreateBackgroundActor();
2021 * @brief Used to reset the cursor position after setting a new text.
2023 * @param[in] cursorIndex Where to place the cursor.
2025 void ResetCursorPosition(CharacterIndex cursorIndex);
2028 * @brief The method acquires current position of cursor
2029 * @return unsigned value with cursor position
2031 CharacterIndex GetCursorPosition();
2034 * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text
2036 * @param[out] anchorActors the vector of actor (empty collection if no anchors available).
2038 void GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors);
2041 * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset
2043 * @param[in] characterOffset A position in text coords.
2045 * @return the index in anchor vector (-1 if an anchor not found)
2047 int GetAnchorIndex(size_t characterOffset);
2049 protected: // Inherit from Text::Decorator::ControllerInterface.
2051 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
2053 void GetTargetSize(Vector2& targetSize) override;
2056 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
2058 void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
2061 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
2063 void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
2065 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
2067 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
2069 void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
2071 protected: // Inherit from HiddenText.
2073 * @brief Invoked from HiddenText when showing time of the last character was expired
2075 void DisplayTimeExpired() override;
2077 private: // Private contructors & copy operator.
2079 * @brief Private constructor.
2082 : Controller(nullptr, nullptr, nullptr, nullptr)
2087 * @brief Private constructor.
2089 Controller(ControlInterface* controlInterface)
2090 : Controller(controlInterface, nullptr, nullptr, nullptr)
2095 * @brief Private constructor.
2097 Controller(ControlInterface* controlInterface,
2098 EditableControlInterface* editableControlInterface,
2099 SelectableControlInterface* selectableControlInterface,
2100 AnchorControlInterface* anchorControlInterface);
2102 Controller(const Controller& handle) = delete;
2103 Controller& operator=(const Controller& handle) = delete;
2105 protected: // Destructor.
2107 * @brief A reference counted object may only be deleted by calling Unreference().
2109 virtual ~Controller();
2112 struct Impl; ///< Made public for testing purposes
2115 struct EventHandler;
2116 struct InputFontHandler;
2117 struct InputProperties;
2118 struct PlaceholderHandler;
2121 struct SpannableHandler;
2123 std::unique_ptr<Impl> mImpl{nullptr};
2126 } // namespace Dali::Toolkit::Text
2128 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H