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/clipboard.h>
24 #include <dali/devel-api/adaptor-framework/input-method-context.h>
25 #include <dali/public-api/events/gesture.h>
28 #include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
29 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
30 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
31 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
32 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
33 #include <dali-toolkit/internal/text/hidden-text.h>
34 #include <dali-toolkit/internal/text/input-filter.h>
35 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
36 #include <dali-toolkit/internal/text/text-anchor-control-interface.h>
37 #include <dali-toolkit/internal/text/text-model-interface.h>
38 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
39 #include <dali-toolkit/public-api/text/text-enumerations.h>
41 namespace Dali::Toolkit::Text
44 class ControlInterface;
45 class EditableControlInterface;
47 class RenderingController;
50 * @brief Text selection operations .
54 INTERACTIVE = 0x0000, ///< Select the word where the cursor is located.
55 ALL = 0x0001, ///< Select the whole text.
56 NONE = 0x0002, ///< Unselect the whole text.
57 RANGE = 0x0003 ///< Select the range text.
60 typedef IntrusivePtr<Controller> ControllerPtr;
63 * @brief A Text Controller is used by UI Controls which display text.
65 * It manipulates the Logical & Visual text models on behalf of the UI Controls.
66 * It provides a view of the text that can be used by rendering back-ends.
68 * For selectable/editable UI controls, the controller handles input events from the UI control
69 * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
71 * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
73 class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public HiddenText::Observer, public ConnectionTracker
75 public: // Enumerated types.
77 * @brief Text related operations to be done in the relayout process.
81 NO_OPERATION = 0x0000,
82 CONVERT_TO_UTF32 = 0x0001,
84 VALIDATE_FONTS = 0x0004,
85 GET_LINE_BREAKS = 0x0008,
88 GET_GLYPH_METRICS = 0x0040,
90 UPDATE_LAYOUT_SIZE = 0x0100,
94 UPDATE_DIRECTION = 0x1000,
95 ALL_OPERATIONS = 0xFFFF
99 * @brief Used to distinguish between regular key events and InputMethodContext events
108 * @brief Used to specify whether to update the input style.
110 enum UpdateInputStyleType
113 DONT_UPDATE_INPUT_STYLE
117 * @brief Used to specify what has been updated after the Relayout() method has been called.
121 NONE_UPDATED = 0x0, ///< Nothing has been updated.
122 MODEL_UPDATED = 0x1, ///< The text's model has been updated.
123 DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
127 * @brief Different placeholder-text can be shown when the control is active/inactive.
131 PLACEHOLDER_TYPE_ACTIVE,
132 PLACEHOLDER_TYPE_INACTIVE,
136 * @brief Enumeration for Font Size Type.
140 POINT_SIZE, // The size of font in points.
141 PIXEL_SIZE // The size of font in pixels.
148 NO_ACTION, ///< Does no action if there is a tap on top of an area with no text.
149 HIGHLIGHT, ///< Highlights the nearest text (at the beginning or end of the text) and shows the text's selection popup.
150 SHOW_SELECTION_POPUP ///< Shows the text's selection popup.
162 TEXT_FIT_FONT_SIZE_TYPE
166 public: // Constructor.
168 * @brief Create a new instance of a Controller.
170 * @return A pointer to a new Controller.
172 static ControllerPtr New()
174 return ControllerPtr(new Controller());
178 * @brief Create a new instance of a Controller.
180 * @param[in] controlInterface The control's interface.
182 * @return A pointer to a new Controller.
184 static ControllerPtr New(ControlInterface* controlInterface)
186 return ControllerPtr(new Controller(controlInterface));
190 * @brief Create a new instance of a Controller.
192 * @param[in] controlInterface The control's interface.
193 * @param[in] editableControlInterface The editable control's interface.
194 * @param[in] selectableControlInterface The selectable control's interface.
195 * @param[in] anchorControlInterface The anchor control's interface.
197 * @return A pointer to a new Controller.
199 static ControllerPtr New(ControlInterface* controlInterface,
200 EditableControlInterface* editableControlInterface,
201 SelectableControlInterface* selectableControlInterface,
202 AnchorControlInterface* anchorControlInterface)
204 return ControllerPtr(new Controller(controlInterface,
205 editableControlInterface,
206 selectableControlInterface,
207 anchorControlInterface));
210 public: // Configure the text controller.
212 * @brief Called to enable text input.
214 * @note Selectable or editable controls should call this once after Controller::New().
215 * @param[in] decorator Used to create cursor, selection handle decorations etc.
216 * @param[in] inputMethodContext Used to manager ime.
218 void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
221 * @brief Used to switch between bitmap & vector based glyphs
223 * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
225 void SetGlyphType(TextAbstraction::GlyphType glyphType);
228 * @brief Enables/disables the mark-up processor.
230 * By default is disabled.
232 * @param[in] enable Whether to enable the mark-up processor.
234 void SetMarkupProcessorEnabled(bool enable);
237 * @brief Retrieves whether the mark-up processor is enabled.
239 * By default is disabled.
241 * @return @e true if the mark-up processor is enabled, otherwise returns @e false.
243 bool IsMarkupProcessorEnabled() const;
246 * @brief Retrieves whether the current text contains anchors.
248 * @return @e true if the current text contains anchors. @e false.
250 bool HasAnchors() const;
253 * @brief Enables/disables the auto text scrolling
255 * By default is disabled.
257 * @param[in] enable Whether to enable the auto scrolling
259 void SetAutoScrollEnabled(bool enable);
262 * @brief Whether the auto scrolling texture exceed max texture.
264 * By default is false.
266 * @param[in] exceed Whether the auto scrolling texture exceed max texture.
268 void SetAutoScrollMaxTextureExceeded(bool exceed);
271 * @brief Retrieves whether auto text scrolling is enabled.
273 * By default is disabled.
275 * @return @e true if auto scrolling is enabled, otherwise returns @e false.
277 bool IsAutoScrollEnabled() const;
280 * @brief Get direction of the text from the first line of text,
281 * @return bool rtl (right to left) is true
283 CharacterDirection GetAutoScrollDirection() const;
286 * @brief Get the alignment offset of the first line of text.
288 * @return The alignment offset.
290 float GetAutoScrollLineAlignment() const;
293 * @brief Enables the horizontal scrolling.
295 * @param[in] enable Whether to enable the horizontal scrolling.
297 void SetHorizontalScrollEnabled(bool enable);
300 * @brief Retrieves whether the horizontal scrolling is enabled.
302 * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
304 bool IsHorizontalScrollEnabled() const;
307 * @brief Enables the vertical scrolling.
309 * @param[in] enable Whether to enable the vertical scrolling.
311 void SetVerticalScrollEnabled(bool enable);
314 * @brief Retrieves whether the verticall scrolling is enabled.
316 * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
318 bool IsVerticalScrollEnabled() const;
321 * @brief Enables the smooth handle panning.
323 * @param[in] enable Whether to enable the smooth handle panning.
325 void SetSmoothHandlePanEnabled(bool enable);
328 * @brief Retrieves whether the smooth handle panning is enabled.
330 * @return @e true if the smooth handle panning is enabled.
332 bool IsSmoothHandlePanEnabled() const;
335 * @brief Sets the maximum number of characters that can be inserted into the TextModel
337 * @param[in] maxCharacters maximum number of characters to be accepted
339 void SetMaximumNumberOfCharacters(Length maxCharacters);
342 * @brief Sets the maximum number of characters that can be inserted into the TextModel
344 * @param[in] maxCharacters maximum number of characters to be accepted
346 int GetMaximumNumberOfCharacters();
349 * @brief Called to enable/disable cursor blink.
351 * @note Only editable controls should calls this.
352 * @param[in] enabled Whether the cursor should blink or not.
354 void SetEnableCursorBlink(bool enable);
357 * @brief Query whether cursor blink is enabled.
359 * @return Whether the cursor should blink or not.
361 bool GetEnableCursorBlink() const;
364 * @brief Whether to enable the multi-line layout.
366 * @param[in] enable \e true enables the multi-line (by default)
368 void SetMultiLineEnabled(bool enable);
371 * @return Whether the multi-line layout is enabled.
373 bool IsMultiLineEnabled() const;
376 * @brief Sets the text's horizontal alignment.
378 * @param[in] alignment The horizontal alignment.
380 void SetHorizontalAlignment(HorizontalAlignment::Type alignment);
383 * @copydoc ModelInterface::GetHorizontalAlignment()
385 HorizontalAlignment::Type GetHorizontalAlignment() const;
388 * @brief Sets the text's vertical alignment.
390 * @param[in] alignment The vertical alignment.
392 void SetVerticalAlignment(VerticalAlignment::Type alignment);
395 * @copydoc ModelInterface::GetVerticalAlignment()
397 VerticalAlignment::Type GetVerticalAlignment() const;
400 * @brief Sets the text's wrap mode
401 * @param[in] text wrap mode The unit of wrapping
403 void SetLineWrapMode(Text::LineWrap::Mode textWarpMode);
406 * @brief Retrieve text wrap mode previously set.
407 * @return text wrap mode
409 Text::LineWrap::Mode GetLineWrapMode() const;
412 * @brief Enable or disable the text elide.
414 * @param[in] enabled Whether to enable the text elide.
416 void SetTextElideEnabled(bool enabled);
419 * @copydoc ModelInterface::IsTextElideEnabled()
421 bool IsTextElideEnabled() const;
424 * @brief Enable or disable the text fit.
426 * @param[in] enabled Whether to enable the text fit.
428 void SetTextFitEnabled(bool enabled);
431 * @brief Whether the text fit is enabled or not.
433 * @return True if the text fit is enabled
435 bool IsTextFitEnabled() const;
438 * @brief Sets current line size.
440 * @param[in] lineSize line size value to store the MinLineSize set by user when TextFitArray is enabled.
442 void SetCurrentLineSize(float lineSize);
445 * @brief Retrieves the current line size.
447 * @return The current line size
449 float GetCurrentLineSize() const;
452 * @brief Sets minimum size valid for text fit.
454 * @param[in] minimum size value.
455 * @param[in] type The font size type is point size or pixel size
457 void SetTextFitMinSize(float pointSize, FontSizeType type);
460 * @brief Retrieves the minimum point size valid for text fit.
462 * @return The minimum point size valid for text fit
464 float GetTextFitMinSize() const;
467 * @brief Sets maximum size valid for text fit.
469 * @param[in] maximum size value.
470 * @param[in] type The font size type is point size or pixel size
472 void SetTextFitMaxSize(float pointSize, FontSizeType type);
475 * @brief Retrieves the maximum point size valid for text fit.
477 * @return The maximum point size valid for text fit
479 float GetTextFitMaxSize() const;
482 * @brief Sets step size for font increase valid for text fit.
484 * @param[in] step size value.
485 * @param[in] type The font size type is point size or pixel size
487 void SetTextFitStepSize(float step, FontSizeType type);
490 * @brief Retrieves the step point size valid for text fit.
492 * @return The step point size valid for text fit
494 float GetTextFitStepSize() const;
497 * @brief Sets content size valid for text fit.
499 * @param[in] Content size value.
501 void SetTextFitContentSize(Vector2 size);
504 * @brief Retrieves the content size valid for text fit.
506 * @return The content size valid for text fit
508 Vector2 GetTextFitContentSize() const;
511 * @brief Retrieve the fited point size.
513 * @return The fited point size.
515 float GetTextFitPointSize() const;
518 * @brief Sets whether the text fit properties have changed.
520 * @param[in] changed Whether to changed the text fit.
522 void SetTextFitChanged(bool changed);
525 * @brief Whether the text fit properties are changed or not.
527 * @return True if the text fit properties are changed
529 bool IsTextFitChanged() const;
532 * @brief Sets line size valid for text fit.
534 * @param[in] lineSize line size value
536 void SetTextFitLineSize(float lineSize);
539 * @brief Enable or disable the text fit array.
541 * @param[in] enabled Whether to enable the text fit array.
543 void SetTextFitArrayEnabled(bool enabled);
546 * @brief Whether the text fit array is enabled or not.
548 * @return True if the text fit array is enabled.
550 bool IsTextFitArrayEnabled() const;
553 * @brief Sets the text fit array.
555 * @param[in] fitOptions The list of text fit options.
557 void SetTextFitArray(std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions);
560 * @brief Retrieve the text fit array.
562 * @return The list of text fit options.
564 std::vector<Toolkit::DevelTextLabel::FitOption>& GetTextFitArray();
567 * @brief Sets disabled color opacity.
569 * @param[in] opacity The color opacity value in disabled state.
571 void SetDisabledColorOpacity(float opacity);
574 * @brief Retrieves the disabled color opacity.
576 * @return The disabled color opacity value for disabled state.
578 float GetDisabledColorOpacity() const;
581 * @brief Enable or disable the placeholder text elide.
582 * @param enabled Whether to enable the placeholder text elide.
584 void SetPlaceholderTextElideEnabled(bool enabled);
587 * @brief Whether the placeholder text elide property is enabled.
588 * @return True if the placeholder text elide property is enabled, false otherwise.
590 bool IsPlaceholderTextElideEnabled() const;
593 * @brief Enable or disable the text selection.
594 * @param[in] enabled Whether to enable the text selection.
596 void SetSelectionEnabled(bool enabled);
599 * @brief Whether the text selection is enabled or not.
600 * @return True if the text selection is enabled
602 bool IsSelectionEnabled() const;
605 * @brief Enable or disable the text selection using Shift key.
606 * @param enabled Whether to enable the text selection using Shift key
608 void SetShiftSelectionEnabled(bool enabled);
611 * @brief Whether the text selection using Shift key is enabled or not.
612 * @return True if the text selection using Shift key is enabled
614 bool IsShiftSelectionEnabled() const;
617 * @brief Enable or disable the grab handles for text selection.
619 * @param[in] enabled Whether to enable the grab handles
621 void SetGrabHandleEnabled(bool enabled);
624 * @brief Returns whether the grab handles are enabled.
626 * @return True if the grab handles are enabled
628 bool IsGrabHandleEnabled() const;
631 * @brief Enable or disable the grab handles for text selection.
633 * @param[in] enabled Whether to enable the grab handles
635 void SetGrabHandlePopupEnabled(bool enabled);
638 * @brief Returns whether the grab handles are enabled.
640 * @return True if the grab handles are enabled
642 bool IsGrabHandlePopupEnabled() const;
645 * @brief Sets input type to password
647 * @note The string is displayed hidden character
649 * @param[in] passwordInput True if password input is enabled.
651 void SetInputModePassword(bool passwordInput);
654 * @brief Returns whether the input mode type is set as password.
656 * @return True if input mode type is password
658 bool IsInputModePassword();
661 * @brief Sets the action when there is a double tap event on top of a text area with no text.
663 * @param[in] action The action to do.
665 void SetNoTextDoubleTapAction(NoTextTap::Action action);
668 * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
670 * @return The action to do.
672 NoTextTap::Action GetNoTextDoubleTapAction() const;
675 * @briefSets the action when there is a long press event on top of a text area with no text.
677 * @param[in] action The action to do.
679 void SetNoTextLongPressAction(NoTextTap::Action action);
682 * @brief Retrieves the action when there is a long press event on top of a text area with no text.
684 * @return The action to do.
686 NoTextTap::Action GetNoTextLongPressAction() const;
689 * @brief Query if Underline settings were provided by string or map
690 * @return bool true if set by string
692 bool IsUnderlineSetByString();
695 * Set method underline setting were set by
696 * @param[in] bool, true if set by string
698 void UnderlineSetByString(bool setByString);
701 * @brief Query if shadow settings were provided by string or map
702 * @return bool true if set by string
704 bool IsShadowSetByString();
707 * Set method shadow setting were set by
708 * @param[in] bool, true if set by string
710 void ShadowSetByString(bool setByString);
713 * @brief Query if outline settings were provided by string or map
714 * @return bool true if set by string
716 bool IsOutlineSetByString();
719 * Set method outline setting were set by
720 * @param[in] bool, true if set by string
722 void OutlineSetByString(bool setByString);
725 * @brief Query if font style settings were provided by string or map
726 * @return bool true if set by string
728 bool IsFontStyleSetByString();
731 * Set method font style setting were set by
732 * @param[in] bool, true if set by string
734 void FontStyleSetByString(bool setByString);
737 * @brief Query if Strikethrough settings were provided by string or map
738 * @return bool true if set by string
740 bool IsStrikethroughSetByString();
743 * Set method Strikethrough setting were set by
744 * @param[in] bool, true if set by string
746 void StrikethroughSetByString(bool setByString);
749 * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
751 * @param[in] height The height in pixels of the strikethrough
753 void SetStrikethroughHeight(float height);
756 * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
758 * @return The height of the strikethrough, or 0 if height is not overrided.
760 float GetStrikethroughHeight() const;
763 * @brief Set the strikethrough color.
765 * @param[in] color color of strikethrough.
767 void SetStrikethroughColor(const Vector4& color);
770 * @brief Retrieve the strikethrough color.
772 * @return The strikethrough color.
774 const Vector4& GetStrikethroughColor() const;
777 * @brief Set the strikethrough enabled flag.
779 * @param[in] enabled The strikethrough enabled flag.
781 void SetStrikethroughEnabled(bool enabled);
784 * @brief Returns whether the text has a strikethrough or not.
786 * @return The strikethrough state.
788 bool IsStrikethroughEnabled() const;
792 * @brief Replaces any text previously set.
794 * @note This will be converted into UTF-32 when stored in the text model.
795 * @param[in] text A string of UTF-8 characters.
797 void SetText(const std::string& text);
800 * @brief Retrieve any text previously set.
802 * @param[out] text A string of UTF-8 characters.
804 void GetText(std::string& text) const;
807 * @brief Retrieves number of characters previously set.
809 * @return A length of string of UTF-32 characters.
811 Length GetNumberOfCharacters() const;
814 * @brief Set the @p spannedText
815 * the spanned text contains content (text) and format (spans with ranges)
816 * the text is copied into text-controller and the spans are applied on ranges
818 * @param[in] spannedText the text with spans.
820 void SetSpannedText(const Text::Spanned& spannedText);
823 * @brief Replaces any placeholder text previously set.
825 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
826 * @param[in] text A string of UTF-8 characters.
828 void SetPlaceholderText(PlaceholderType type, const std::string& text);
831 * @brief Retrieve any placeholder text previously set.
833 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
834 * @param[out] A string of UTF-8 characters.
836 void GetPlaceholderText(PlaceholderType type, std::string& text) const;
839 * @ brief Update the text after a font change
840 * @param[in] newDefaultFont The new font to change to
842 void UpdateAfterFontChange(const std::string& newDefaultFont);
845 * @brief The method acquires currently selected text
846 * @param selectedText variable to place selected text in
848 void RetrieveSelection(std::string& selectedText) const;
851 * @brief The method sets selection in given range
852 * @param start index of first character
853 * @param end index of first character after selection
855 void SetSelection(int start, int end);
858 * @brief This method retrieve indexes of current selection
860 * @return a pair, where first element is left index of selection and second is the right one
862 std::pair<int, int> GetSelectionIndexes() const;
865 * Place string in system clipboard
866 * @param source std::string
868 void CopyStringToClipboard(const std::string& source);
871 * Place currently selected text in system clipboard
872 * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
874 void SendSelectionToClipboard(bool deleteAfterSending);
876 public: // Default style & Input style
878 * @brief Set the default font family.
880 * @param[in] defaultFontFamily The default font family.
882 void SetDefaultFontFamily(const std::string& defaultFontFamily);
885 * @brief Retrieve the default font family.
887 * @return The default font family.
889 std::string GetDefaultFontFamily() const;
892 * @brief Sets the placeholder text font family.
893 * @param[in] placeholderTextFontFamily The placeholder text font family.
895 void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
898 * @brief Retrieves the placeholder text font family.
900 * @return The placeholder text font family
902 std::string GetPlaceholderFontFamily() const;
905 * @brief Sets the default font weight.
907 * @param[in] weight The font weight.
909 void SetDefaultFontWeight(FontWeight weight);
912 * @brief Whether the font's weight has been defined.
914 bool IsDefaultFontWeightDefined() const;
917 * @brief Retrieves the default font weight.
919 * @return The default font weight.
921 FontWeight GetDefaultFontWeight() const;
924 * @brief Sets the placeholder text font weight.
926 * @param[in] weight The font weight
928 void SetPlaceholderTextFontWeight(FontWeight weight);
931 * @brief Whether the font's weight has been defined.
933 * @return True if the placeholder text font weight is defined
935 bool IsPlaceholderTextFontWeightDefined() const;
938 * @brief Retrieves the placeholder text font weight.
940 * @return The placeholder text font weight
942 FontWeight GetPlaceholderTextFontWeight() const;
945 * @brief Sets the default font width.
947 * @param[in] width The font width.
949 void SetDefaultFontWidth(FontWidth width);
952 * @brief Whether the font's width has been defined.
954 bool IsDefaultFontWidthDefined() const;
957 * @brief Retrieves the default font width.
959 * @return The default font width.
961 FontWidth GetDefaultFontWidth() const;
964 * @brief Sets the placeholder text font width.
966 * @param[in] width The font width
968 void SetPlaceholderTextFontWidth(FontWidth width);
971 * @brief Whether the font's width has been defined.
973 * @return True if the placeholder text font width is defined
975 bool IsPlaceholderTextFontWidthDefined() const;
978 * @brief Retrieves the placeholder text font width.
980 * @return The placeholder text font width
982 FontWidth GetPlaceholderTextFontWidth() const;
985 * @brief Sets the default font slant.
987 * @param[in] slant The font slant.
989 void SetDefaultFontSlant(FontSlant slant);
992 * @brief Whether the font's slant has been defined.
994 bool IsDefaultFontSlantDefined() const;
997 * @brief Retrieves the default font slant.
999 * @return The default font slant.
1001 FontSlant GetDefaultFontSlant() const;
1004 * @brief Sets the placeholder text font slant.
1006 * @param[in] slant The font slant
1008 void SetPlaceholderTextFontSlant(FontSlant slant);
1011 * @brief Whether the font's slant has been defined.
1013 * @return True if the placeholder text font slant is defined
1015 bool IsPlaceholderTextFontSlantDefined() const;
1018 * @brief Retrieves the placeholder text font slant.
1020 * @return The placeholder text font slant
1022 FontSlant GetPlaceholderTextFontSlant() const;
1025 * @brief Set the default font size.
1027 * @param[in] fontSize The default font size
1028 * @param[in] type The font size type is point size or pixel size
1030 void SetDefaultFontSize(float fontSize, FontSizeType type);
1033 * @brief Retrieve the default point size.
1035 * @param[in] type The font size type
1036 * @return The default point size.
1038 float GetDefaultFontSize(FontSizeType type) const;
1041 * @brief Set the font size scale.
1043 * @param[in] scale The font size scale
1045 void SetFontSizeScale(float scale);
1048 * @brief Get the font size scale.
1050 * @return The font size scale.
1052 float GetFontSizeScale() const;
1055 * @brief Set the font size scale enabled flag.
1057 * @param[in] enabled whether to enable the font size scale.
1059 void SetFontSizeScaleEnabled(bool enabled);
1062 * @brief Returns whether the font size scale is enabled or not.
1064 * @return @e true if the font size scale is enabled, otherwise returns @e false.
1066 bool IsFontSizeScaleEnabled() const;
1069 * @brief Sets the Placeholder text font size.
1070 * @param[in] fontSize The placeholder text font size
1071 * @param[in] type The font size type is point size or pixel size
1073 void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
1076 * @brief Retrieves the Placeholder text font size.
1077 * @param[in] type The font size type
1078 * @return The placeholder font size
1080 float GetPlaceholderTextFontSize(FontSizeType type) const;
1083 * @brief Sets the text's default color.
1085 * @param color The default color.
1087 void SetDefaultColor(const Vector4& color);
1090 * @brief Retrieves the text's default color.
1092 * @return The default color.
1094 const Vector4& GetDefaultColor() const;
1097 * @brief Sets the user interaction enabled.
1099 * @param enabled whether to enable the user interaction.
1101 void SetUserInteractionEnabled(bool enabled);
1104 * @brief Whether the user interaction is enabled.
1106 * @return true if the user interaction is enabled, false otherwise.
1108 bool IsUserInteractionEnabled() const;
1111 * @brief Set the text color
1113 * @param textColor The text color
1115 void SetPlaceholderTextColor(const Vector4& textColor);
1118 * @brief Retrieve the text color
1120 * @return The text color
1122 const Vector4& GetPlaceholderTextColor() const;
1125 * @brief Set the shadow offset.
1127 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
1129 void SetShadowOffset(const Vector2& shadowOffset);
1132 * @brief Retrieve the shadow offset.
1134 * @return The shadow offset.
1136 const Vector2& GetShadowOffset() const;
1139 * @brief Set the shadow color.
1141 * @param[in] shadowColor The shadow color.
1143 void SetShadowColor(const Vector4& shadowColor);
1146 * @brief Retrieve the shadow color.
1148 * @return The shadow color.
1150 const Vector4& GetShadowColor() const;
1153 * @brief Set the shadow blur radius.
1155 * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
1157 void SetShadowBlurRadius(const float& shadowBlurRadius);
1160 * @brief Retrieve the shadow blur radius.
1162 * @return The shadow blur radius.
1164 const float& GetShadowBlurRadius() const;
1167 * @brief Set the underline color.
1169 * @param[in] color color of underline.
1171 void SetUnderlineColor(const Vector4& color);
1174 * @brief Retrieve the underline color.
1176 * @return The underline color.
1178 const Vector4& GetUnderlineColor() const;
1181 * @brief Set the underline enabled flag.
1183 * @param[in] enabled The underline enabled flag.
1185 void SetUnderlineEnabled(bool enabled);
1188 * @brief Returns whether the text is underlined or not.
1190 * @return The underline state.
1192 bool IsUnderlineEnabled() const;
1195 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
1197 * @param[in] height The height in pixels of the underline
1199 void SetUnderlineHeight(float height);
1202 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
1204 * @return The height of the underline, or 0 if height is not overrided.
1206 float GetUnderlineHeight() const;
1209 * @brief Sets the underline type.
1210 * @param[in] type The underline type.
1212 void SetUnderlineType(Text::Underline::Type type);
1215 * @brief Retrieve underline type.
1216 * @return The underline type.
1218 Text::Underline::Type GetUnderlineType() const;
1221 * @brief Set the width of the dashes of the dashed underline.
1223 * @param[in] width The width in pixels of the dashes of the dashed underline.
1225 void SetDashedUnderlineWidth(float width);
1228 * @brief Retrieves the width of the dashes of the dashed underline.
1230 * @return The width of the dashes of the dashed underline.
1232 float GetDashedUnderlineWidth() const;
1235 * @brief Set the gap between the dashes of the dashed underline.
1237 * @param[in] gap The gap between the dashes of the dashed underline.
1239 void SetDashedUnderlineGap(float gap);
1242 * @brief Retrieves the gap between the dashes of the dashed underline.
1244 * @return The The gap between the dashes of the dashed underline.
1246 float GetDashedUnderlineGap() const;
1249 * @brief Set the outline color.
1251 * @param[in] color color of outline.
1253 void SetOutlineColor(const Vector4& color);
1256 * @brief Retrieve the outline color.
1258 * @return The outline color.
1260 const Vector4& GetOutlineColor() const;
1263 * @brief Set the outline width
1265 * @param[in] width The width in pixels of the outline, 0 indicates no outline
1267 void SetOutlineWidth(uint16_t width);
1270 * @brief Retrieves the width of an outline
1272 * @return The width of the outline.
1274 uint16_t GetOutlineWidth() const;
1277 * @brief Set the background color.
1279 * @param[in] color color of background.
1281 void SetBackgroundColor(const Vector4& color);
1284 * @brief Retrieve the background color.
1286 * @return The background color.
1288 const Vector4& GetBackgroundColor() const;
1291 * @brief Set the background enabled flag.
1293 * @param[in] enabled The background enabled flag.
1295 void SetBackgroundEnabled(bool enabled);
1298 * @brief Returns whether to enable text background or not.
1300 * @return Whether text background is enabled.
1302 bool IsBackgroundEnabled() const;
1305 * @brief Sets the emboss's properties string.
1307 * @note The string is stored to be recovered.
1309 * @param[in] embossProperties The emboss's properties string.
1311 void SetDefaultEmbossProperties(const std::string& embossProperties);
1314 * @brief Retrieves the emboss's properties string.
1316 * @return The emboss's properties string.
1318 std::string GetDefaultEmbossProperties() const;
1321 * @brief Sets the outline's properties string.
1323 * @note The string is stored to be recovered.
1325 * @param[in] outlineProperties The outline's properties string.
1327 void SetDefaultOutlineProperties(const std::string& outlineProperties);
1330 * @brief Retrieves the outline's properties string.
1332 * @return The outline's properties string.
1334 std::string GetDefaultOutlineProperties() const;
1337 * @brief Sets the default line spacing.
1339 * @param[in] lineSpacing The line spacing.
1341 * @return True if lineSpacing has been updated, false otherwise
1343 bool SetDefaultLineSpacing(float lineSpacing);
1346 * @brief Retrieves the default line spacing.
1348 * @return The line spacing.
1350 float GetDefaultLineSpacing() const;
1353 * @brief Sets the default line size.
1355 * @param[in] lineSize The line size.
1357 * @return True if lineSize has been updated, false otherwise
1359 bool SetDefaultLineSize(float lineSize);
1362 * @brief Retrieves the default line size.
1364 * @return The line size.
1366 float GetDefaultLineSize() const;
1369 * @brief Sets the relative line size to the original line size.
1371 * @param[in] relativeLineSize The relativeline size.
1373 * @return True if relativeLineSize has been updated, false otherwise
1375 bool SetRelativeLineSize(float lineSize);
1378 * @brief Retrieves the relative line size.
1380 * @return The relative line size.
1382 float GetRelativeLineSize() const;
1385 * @brief Sets the input text's color.
1387 * @param[in] color The input text's color.
1389 void SetInputColor(const Vector4& color);
1392 * @brief Retrieves the input text's color.
1394 * @return The input text's color.
1396 const Vector4& GetInputColor() const;
1399 * @brief Sets the input text's font family name.
1401 * @param[in] fontFamily The text's font family name.
1403 void SetInputFontFamily(const std::string& fontFamily);
1406 * @brief Retrieves the input text's font family name.
1408 * @return The input text's font family name.
1410 std::string GetInputFontFamily() const;
1413 * @brief Sets the input font's weight.
1415 * @param[in] weight The input font's weight.
1417 void SetInputFontWeight(FontWeight weight);
1420 * @return Whether the font's weight has been defined.
1422 bool IsInputFontWeightDefined() const;
1425 * @brief Retrieves the input font's weight.
1427 * @return The input font's weight.
1429 FontWeight GetInputFontWeight() const;
1432 * @brief Sets the input font's width.
1434 * @param[in] width The input font's width.
1436 void SetInputFontWidth(FontWidth width);
1439 * @return Whether the font's width has been defined.
1441 bool IsInputFontWidthDefined() const;
1444 * @brief Retrieves the input font's width.
1446 * @return The input font's width.
1448 FontWidth GetInputFontWidth() const;
1451 * @brief Sets the input font's slant.
1453 * @param[in] slant The input font's slant.
1455 void SetInputFontSlant(FontSlant slant);
1458 * @return Whether the font's slant has been defined.
1460 bool IsInputFontSlantDefined() const;
1463 * @brief Retrieves the input font's slant.
1465 * @return The input font's slant.
1467 FontSlant GetInputFontSlant() const;
1470 * @brief Sets the input font's point size.
1472 * @param[in] size The input font's point size.
1474 void SetInputFontPointSize(float size);
1477 * @brief Retrieves the input font's point size.
1479 * @return The input font's point size.
1481 float GetInputFontPointSize() const;
1484 * @brief Sets the input line spacing.
1486 * @param[in] lineSpacing The line spacing.
1488 void SetInputLineSpacing(float lineSpacing);
1491 * @brief Retrieves the input line spacing.
1493 * @return The line spacing.
1495 float GetInputLineSpacing() const;
1498 * @brief Sets the input shadow's properties string.
1500 * @note The string is stored to be recovered.
1502 * @param[in] shadowProperties The shadow's properties string.
1504 void SetInputShadowProperties(const std::string& shadowProperties);
1507 * @brief Retrieves the input shadow's properties string.
1509 * @return The shadow's properties string.
1511 std::string GetInputShadowProperties() const;
1514 * @brief Sets the input underline's properties string.
1516 * @note The string is stored to be recovered.
1518 * @param[in] underlineProperties The underline's properties string.
1520 void SetInputUnderlineProperties(const std::string& underlineProperties);
1523 * @brief Retrieves the input underline's properties string.
1525 * @return The underline's properties string.
1527 std::string GetInputUnderlineProperties() const;
1530 * @brief Sets the input emboss's properties string.
1532 * @note The string is stored to be recovered.
1534 * @param[in] embossProperties The emboss's properties string.
1536 void SetInputEmbossProperties(const std::string& embossProperties);
1539 * @brief Retrieves the input emboss's properties string.
1541 * @return The emboss's properties string.
1543 std::string GetInputEmbossProperties() const;
1546 * @brief Sets input the outline's properties string.
1548 * @note The string is stored to be recovered.
1550 * @param[in] outlineProperties The outline's properties string.
1552 void SetInputOutlineProperties(const std::string& outlineProperties);
1555 * @brief Retrieves the input outline's properties string.
1557 * @return The outline's properties string.
1559 std::string GetInputOutlineProperties() const;
1562 * @brief Sets the input strikethrough's properties string.
1564 * @note The string is stored to be recovered.
1566 * @param[in] strikethroughProperties The strikethrough's properties string.
1568 void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
1571 * @brief Retrieves the input strikethrough's properties string.
1573 * @return The strikethrough's properties string.
1575 std::string GetInputStrikethroughProperties() const;
1578 * @brief Set the control's interface.
1580 * @param[in] controlInterface The control's interface.
1582 void SetControlInterface(ControlInterface* controlInterface);
1585 * @brief Set the anchor control's interface.
1587 * @param[in] anchorControlInterface The control's interface.
1589 void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
1592 * @brief Sets the character spacing.
1594 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1596 * @param[in] characterSpacing The character spacing.
1598 void SetCharacterSpacing(float characterSpacing);
1601 * @brief Retrieves the character spacing.
1603 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1605 * @return The character spacing.
1607 const float GetCharacterSpacing() const;
1609 public: // Queries & retrieves.
1611 * @brief Return the layout engine.
1613 * @return A reference to the layout engine.
1615 Layout::Engine& GetLayoutEngine();
1618 * @brief Return a view of the text.
1620 * @return A reference to the view.
1625 * @copydoc Control::GetNaturalSize()
1627 Vector3 GetNaturalSize();
1630 * @copydoc Control::GetHeightForWidth()
1632 float GetHeightForWidth(float width);
1635 * @brief Calculates the point size for text for given layout()
1637 void FitPointSizeforLayout(Size layoutSize);
1640 * @brief Calculates the point size for text for given layout() using fit array.
1642 void FitArrayPointSizeforLayout(Size layoutSize);
1645 * @brief Checks if the point size fits within the layout size.
1647 * @return Whether the point size fits within the layout size.
1649 bool CheckForTextFit(float pointSize, Size& layoutSize);
1652 * @brief Retrieves the text's number of lines for a given width.
1653 * @param[in] width The width of the text's area.
1654 * @ return The number of lines.
1656 int GetLineCount(float width);
1659 * @brief Retrieves the text's model.
1661 * @return A pointer to the text's model.
1663 const ModelInterface* GetTextModel() const;
1666 * @brief Used to get scrolled distance by user input
1668 * @return Distance from last scroll offset to new scroll offset
1670 float GetScrollAmountByUserInput();
1673 * @brief Get latest scroll amount, control size and layout size
1675 * This method is used to get information of control's scroll
1676 * @param[out] scrollPosition The current scrolled position
1677 * @param[out] controlHeight The size of a UI control
1678 * @param[out] layoutHeight The size of a bounding box to layout text within.
1680 * @return Whether the text scroll position is changed or not after last update.
1682 bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1685 * @brief Used to set the hidden input option
1687 void SetHiddenInputOption(const Property::Map& options);
1690 * @brief Used to get the hidden input option
1692 void GetHiddenInputOption(Property::Map& options);
1695 * @brief Used to set the input filter option
1697 void SetInputFilterOption(const Property::Map& options);
1700 * @brief Used to get the input filter option
1702 void GetInputFilterOption(Property::Map& options);
1705 * @brief Sets the Placeholder Properties.
1707 * @param[in] map The placeholder property map
1709 void SetPlaceholderProperty(const Property::Map& map);
1712 * @brief Retrieves the Placeholder Property map.
1714 * @param[out] map The property map
1716 void GetPlaceholderProperty(Property::Map& map);
1719 * @brief Checks text direction.
1720 * @return The text direction.
1722 Toolkit::DevelText::TextDirection::Type GetTextDirection();
1725 * @brief Retrieves vertical line alignment
1726 * @return The vertical line alignment
1728 Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1731 * @brief Sets vertical line alignment
1732 * @param[in] alignment The vertical line alignment for the text
1734 void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1737 * @brief Retrieves ellipsis position
1738 * @return The ellipsis position
1740 Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
1743 * @brief Sets ellipsis position
1744 * @param[in] ellipsisPosition The ellipsis position for the text
1746 void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
1749 * @brief Retrieves ignoreSpaceAfterText value from model
1750 * @return The value of ignoreSpaceAfterText
1752 bool IsIgnoreSpacesAfterText() const;
1755 * @brief Sets ignoreSpaceAfterText value to model
1756 * @param[in] ignore The value of ignoreSpacesAfterText for the text
1758 void SetIgnoreSpacesAfterText(bool ignore);
1761 * @brief Sets SetMatchLayoutDirection value to model
1762 * @param[in] match The value of matchLayoutDirection for the text
1764 void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
1767 * @brief Retrieves matchLayoutDirection value from model
1768 * @return The value of matchLayoutDirection
1770 DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
1773 * @brief Sets layoutDirection type value.
1774 * @param[in] layoutDirection The value of the layout direction type.
1776 void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1779 * @brief Gets layoutDirection type value.
1780 * @param[in] actor The actor which will get the layout direction type.
1781 * @return The value of the layout direction type.
1783 Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
1786 * @brief Get the rendered size of a specific text range.
1787 * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
1788 * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
1790 * @param[in] startIndex start index of the text requested to calculate size for.
1791 * @param[in] endIndex end index(included) of the text requested to calculate size for.
1792 * @return list of sizes of the reuested text.
1794 Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
1797 * @brief Get the top/left rendered position of a specific text range.
1798 * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
1799 * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
1801 * @param[in] startIndex start index of the text requested to get position to.
1802 * @param[in] endIndex end index(included) of the text requested to get position to.
1803 * @return list of positions of the requested text.
1805 Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
1808 * @brief Get the line bounding rectangle.
1809 * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
1811 * @param[in] lineIndex line index to which we want to calculate the geometry for.
1812 * @return bounding rectangle.
1814 Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex);
1817 * @brief Get the char bounding rectangle.
1818 * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
1820 * @param[in] charIndex character index to which we want to calculate the geometry for.
1821 * @return bounding rectangle.
1823 Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
1826 * @brief Get the character index.
1827 * If the text is not yet rendered or the text is empty, -1 is returned.
1829 * @param[in] visualX visual x position.
1830 * @param[in] visualY visual y position.
1831 * @return character index.
1833 int GetCharacterIndexAtPosition(float visualX, float visualY);
1836 * @brief Gets the bounding box of a specific text range.
1838 * @param[in] startIndex start index of the text requested to get bounding box to.
1839 * @param[in] endIndex end index(included) of the text requested to get bounding box to.
1840 * @return bounding box of the requested text.
1842 Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
1845 * @brief Sets the layout direction changed.
1847 void ChangedLayoutDirection();
1850 * @brief Retrieves if showing real text or not.
1851 * @return The value of showing real text.
1853 bool IsShowingRealText() const;
1855 public: // Relayout.
1857 * @brief Triggers a relayout which updates View (if necessary).
1859 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1860 * @param[in] size A the size of a bounding box to layout text within.
1861 * @param[in] layoutDirection The direction of the system language.
1863 * @return Whether the text model or decorations were updated.
1865 UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1868 * @brief Request a relayout using the ControlInterface.
1870 void RequestRelayout();
1872 public: // Input style change signals.
1874 * @return Whether the queue of input style changed signals is empty.
1876 bool IsInputStyleChangedSignalsQueueEmpty();
1879 * @brief Process all pending input style changed signals.
1881 * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1882 * text controls. Text controls may send signals to state the input style has changed.
1884 void ProcessInputStyleChangedSignals();
1886 public: // Text-input Event Queuing.
1888 * @brief Called by editable UI controls when keyboard focus is gained.
1890 void KeyboardFocusGainEvent();
1893 * @brief Called by editable UI controls when focus is lost.
1895 void KeyboardFocusLostEvent();
1898 * @brief Called by editable UI controls when key events are received.
1900 * @param[in] event The key event.
1901 * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1903 bool KeyEvent(const Dali::KeyEvent& event);
1906 * @brief Called by anchor when a tap gesture occurs.
1907 * @param[in] x The x position relative to the top-left of the parent control.
1908 * @param[in] y The y position relative to the top-left of the parent control.
1910 void AnchorEvent(float x, float y);
1913 * @brief Called by editable UI controls when a tap gesture occurs.
1914 * @param[in] tapCount The number of taps.
1915 * @param[in] x The x position relative to the top-left of the parent control.
1916 * @param[in] y The y position relative to the top-left of the parent control.
1918 void TapEvent(unsigned int tapCount, float x, float y);
1921 * @brief Called by editable UI controls when a pan gesture occurs.
1923 * @param[in] state The state of the gesture.
1924 * @param[in] displacement This distance panned since the last pan gesture.
1926 void PanEvent(GestureState state, const Vector2& displacement);
1929 * @brief Called by editable UI controls when a long press gesture occurs.
1931 * @param[in] state The state of the gesture.
1932 * @param[in] x The x position relative to the top-left of the parent control.
1933 * @param[in] y The y position relative to the top-left of the parent control.
1935 void LongPressEvent(GestureState state, float x, float y);
1938 * @brief Used to get the Primary cursor position.
1940 * @return Primary cursor position.
1942 CharacterIndex GetPrimaryCursorPosition() const;
1945 * @brief Used to set the Primary cursor position.
1947 * @param[in] index for the Primary cursor position.
1948 * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
1949 * @return[in] true if cursor position changed, false otherwise.
1951 bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
1954 * @brief Creates a selection event.
1956 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1958 * @param[in] x The x position relative to the top-left of the parent control.
1959 * @param[in] y The y position relative to the top-left of the parent control.
1960 * @param[in] selection type like the whole text is selected or unselected.
1962 void SelectEvent(float x, float y, SelectionType selection);
1965 * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
1967 void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
1970 * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
1972 Uint32Pair GetTextSelectionRange() const;
1975 * @copydoc Text::SelectableControlInterface::SelectWholeText()
1977 void SelectWholeText();
1980 * @copydoc Text::EditableControlInterface::CopyText()
1985 * @copydoc Text::EditableControlInterface::CutText()
1990 * @copydoc Text::EditableControlInterface::PasteText()
1995 * @copydoc Text::SelectableControlInterface::SelectNone()
2000 * @copydoc Text::SelectableControlInterface::SelectText()
2002 void SelectText(const uint32_t start, const uint32_t end);
2005 * @copydoc Text::SelectableControlInterface::GetSelectedText()
2007 string GetSelectedText() const;
2010 * @copydoc Text::EditableControlInterface::IsEditable()
2012 virtual bool IsEditable() const;
2015 * @copydoc Text::EditableControlInterface::SetEditable()
2017 virtual void SetEditable(bool editable);
2020 * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
2022 virtual void ScrollBy(Vector2 scroll);
2025 * @brief Whether the text is scrollable.
2026 * @return Returns true if the text is scrollable.
2028 bool IsScrollable(const Vector2& displacement);
2031 * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
2033 float GetHorizontalScrollPosition();
2036 * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
2038 float GetVerticalScrollPosition();
2041 * @brief Event received from input method context
2043 * @param[in] inputMethodContext The input method context.
2044 * @param[in] inputMethodContextEvent The event received.
2045 * @return A data struture indicating if update is needed, cursor position and current text.
2047 InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
2050 * @brief Event from Clipboard notifying an Item has been selected for pasting
2052 * @param[in] id The id of the data request.
2053 * @param[in] mimeType The mime type of data received.
2054 * @param[in] data The data received.
2056 * This event is executed by receiving the Clipboard's DataReceivedSignal.
2058 void PasteClipboardItemEvent(uint32_t id, const char* mimeType, const char* data);
2061 * @brief Return true when text control should clear key input focus when escape key is pressed.
2063 * @return Whether text control should clear key input focus or not when escape key is pressed.
2065 bool ShouldClearFocusOnEscape() const;
2068 * @brief Create an actor that renders the text background color
2070 * @return the created actor or an empty handle if no background color needs to be rendered.
2072 Actor CreateBackgroundActor();
2075 * @brief Used to reset the cursor position after setting a new text.
2077 * @param[in] cursorIndex Where to place the cursor.
2079 void ResetCursorPosition(CharacterIndex cursorIndex);
2082 * @brief The method acquires current position of cursor
2083 * @return unsigned value with cursor position
2085 CharacterIndex GetCursorPosition();
2088 * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text
2090 * @param[out] anchorActors the vector of actor (empty collection if no anchors available).
2092 void GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors);
2095 * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset
2097 * @param[in] characterOffset A position in text coords.
2099 * @return the index in anchor vector (-1 if an anchor not found)
2101 int GetAnchorIndex(size_t characterOffset);
2103 protected: // Inherit from Text::Decorator::ControllerInterface.
2105 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
2107 void GetTargetSize(Vector2& targetSize) override;
2110 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
2112 void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
2115 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
2117 void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
2119 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
2121 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
2123 void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
2125 protected: // Inherit from HiddenText.
2127 * @brief Invoked from HiddenText when showing time of the last character was expired
2129 void DisplayTimeExpired() override;
2131 private: // Private contructors & copy operator.
2133 * @brief Private constructor.
2136 : Controller(nullptr, nullptr, nullptr, nullptr)
2141 * @brief Private constructor.
2143 Controller(ControlInterface* controlInterface)
2144 : Controller(controlInterface, nullptr, nullptr, nullptr)
2149 * @brief Private constructor.
2151 Controller(ControlInterface* controlInterface,
2152 EditableControlInterface* editableControlInterface,
2153 SelectableControlInterface* selectableControlInterface,
2154 AnchorControlInterface* anchorControlInterface);
2156 Controller(const Controller& handle) = delete;
2157 Controller& operator=(const Controller& handle) = delete;
2159 protected: // Destructor.
2161 * @brief A reference counted object may only be deleted by calling Unreference().
2163 virtual ~Controller();
2166 struct Impl; ///< Made public for testing purposes
2169 struct EventHandler;
2170 struct InputFontHandler;
2171 struct InputProperties;
2172 struct PlaceholderHandler;
2175 struct SpannableHandler;
2177 std::unique_ptr<Impl> mImpl{nullptr};
2180 } // namespace Dali::Toolkit::Text
2182 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H