1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
5 * Copyright (c) 2024 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/integration-api/processor-interface.h>
26 #include <dali/public-api/events/gesture.h>
29 #include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
30 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
31 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
32 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
33 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
34 #include <dali-toolkit/internal/text/hidden-text.h>
35 #include <dali-toolkit/internal/text/input-filter.h>
36 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
37 #include <dali-toolkit/internal/text/text-anchor-control-interface.h>
38 #include <dali-toolkit/internal/text/text-model-interface.h>
39 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
40 #include <dali-toolkit/public-api/text/text-enumerations.h>
42 namespace Dali::Toolkit::Text
45 class ControlInterface;
46 class EditableControlInterface;
48 class RenderingController;
51 * @brief Text selection operations .
55 INTERACTIVE = 0x0000, ///< Select the word where the cursor is located.
56 ALL = 0x0001, ///< Select the whole text.
57 NONE = 0x0002, ///< Unselect the whole text.
58 RANGE = 0x0003 ///< Select the range text.
61 typedef IntrusivePtr<Controller> ControllerPtr;
64 * @brief A Text Controller is used by UI Controls which display text.
66 * It manipulates the Logical & Visual text models on behalf of the UI Controls.
67 * It provides a view of the text that can be used by rendering back-ends.
69 * For selectable/editable UI controls, the controller handles input events from the UI control
70 * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
72 * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
74 class Controller : public RefObject,
75 public Decorator::ControllerInterface,
76 public TextSelectionPopupCallbackInterface,
77 public HiddenText::Observer,
78 public ConnectionTracker,
79 public Integration::Processor
81 public: // Enumerated types.
83 * @brief Text related operations to be done in the relayout process.
87 NO_OPERATION = 0x0000,
88 CONVERT_TO_UTF32 = 0x0001,
90 VALIDATE_FONTS = 0x0004,
91 GET_LINE_BREAKS = 0x0008,
94 GET_GLYPH_METRICS = 0x0040,
96 UPDATE_LAYOUT_SIZE = 0x0100,
100 UPDATE_DIRECTION = 0x1000,
101 ALL_OPERATIONS = 0xFFFF
105 * @brief Used to distinguish between regular key events and InputMethodContext events
114 * @brief Used to specify whether to update the input style.
116 enum UpdateInputStyleType
119 DONT_UPDATE_INPUT_STYLE
123 * @brief Used to specify what has been updated after the Relayout() method has been called.
127 NONE_UPDATED = 0x0, ///< Nothing has been updated.
128 MODEL_UPDATED = 0x1, ///< The text's model has been updated.
129 DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
133 * @brief Different placeholder-text can be shown when the control is active/inactive.
137 PLACEHOLDER_TYPE_ACTIVE,
138 PLACEHOLDER_TYPE_INACTIVE,
142 * @brief Enumeration for Font Size Type.
146 POINT_SIZE, // The size of font in points.
147 PIXEL_SIZE // The size of font in pixels.
154 NO_ACTION, ///< Does no action if there is a tap on top of an area with no text.
155 HIGHLIGHT, ///< Highlights the nearest text (at the beginning or end of the text) and shows the text's selection popup.
156 SHOW_SELECTION_POPUP ///< Shows the text's selection popup.
168 TEXT_FIT_FONT_SIZE_TYPE
172 public: // Constructor.
174 * @brief Create a new instance of a Controller.
176 * @return A pointer to a new Controller.
178 static ControllerPtr New()
180 return ControllerPtr(new Controller());
184 * @brief Create a new instance of a Controller.
186 * @param[in] controlInterface The control's interface.
188 * @return A pointer to a new Controller.
190 static ControllerPtr New(ControlInterface* controlInterface)
192 return ControllerPtr(new Controller(controlInterface));
196 * @brief Create a new instance of a Controller.
198 * @param[in] controlInterface The control's interface.
199 * @param[in] editableControlInterface The editable control's interface.
200 * @param[in] selectableControlInterface The selectable control's interface.
201 * @param[in] anchorControlInterface The anchor control's interface.
203 * @return A pointer to a new Controller.
205 static ControllerPtr New(ControlInterface* controlInterface,
206 EditableControlInterface* editableControlInterface,
207 SelectableControlInterface* selectableControlInterface,
208 AnchorControlInterface* anchorControlInterface)
210 return ControllerPtr(new Controller(controlInterface,
211 editableControlInterface,
212 selectableControlInterface,
213 anchorControlInterface));
216 public: // Configure the text controller.
218 * @brief Called to enable text input.
220 * @note Selectable or editable controls should call this once after Controller::New().
221 * @param[in] decorator Used to create cursor, selection handle decorations etc.
222 * @param[in] inputMethodContext Used to manager ime.
224 void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
227 * @brief Used to switch between bitmap & vector based glyphs
229 * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
231 void SetGlyphType(TextAbstraction::GlyphType glyphType);
234 * @brief Enables/disables the mark-up processor.
236 * By default is disabled.
238 * @param[in] enable Whether to enable the mark-up processor.
240 void SetMarkupProcessorEnabled(bool enable);
243 * @brief Retrieves whether the mark-up processor is enabled.
245 * By default is disabled.
247 * @return @e true if the mark-up processor is enabled, otherwise returns @e false.
249 bool IsMarkupProcessorEnabled() const;
252 * @brief Retrieves whether the current text contains anchors.
254 * @return @e true if the current text contains anchors. @e false.
256 bool HasAnchors() const;
259 * @brief Enables/disables the auto text scrolling
261 * By default is disabled.
263 * @param[in] enable Whether to enable the auto scrolling
265 void SetAutoScrollEnabled(bool enable);
268 * @brief Whether the auto scrolling texture exceed max texture.
270 * By default is false.
272 * @param[in] exceed Whether the auto scrolling texture exceed max texture.
274 void SetAutoScrollMaxTextureExceeded(bool exceed);
277 * @brief Retrieves whether auto text scrolling is enabled.
279 * By default is disabled.
281 * @return @e true if auto scrolling is enabled, otherwise returns @e false.
283 bool IsAutoScrollEnabled() const;
286 * @brief Get direction of the text from the first line of text,
287 * @return bool rtl (right to left) is true
289 CharacterDirection GetAutoScrollDirection() const;
292 * @brief Get the alignment offset of the first line of text.
294 * @return The alignment offset.
296 float GetAutoScrollLineAlignment() const;
299 * @brief Enables the horizontal scrolling.
301 * @param[in] enable Whether to enable the horizontal scrolling.
303 void SetHorizontalScrollEnabled(bool enable);
306 * @brief Retrieves whether the horizontal scrolling is enabled.
308 * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
310 bool IsHorizontalScrollEnabled() const;
313 * @brief Enables the vertical scrolling.
315 * @param[in] enable Whether to enable the vertical scrolling.
317 void SetVerticalScrollEnabled(bool enable);
320 * @brief Retrieves whether the verticall scrolling is enabled.
322 * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
324 bool IsVerticalScrollEnabled() const;
327 * @brief Enables the smooth handle panning.
329 * @param[in] enable Whether to enable the smooth handle panning.
331 void SetSmoothHandlePanEnabled(bool enable);
334 * @brief Retrieves whether the smooth handle panning is enabled.
336 * @return @e true if the smooth handle panning is enabled.
338 bool IsSmoothHandlePanEnabled() const;
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 void SetMaximumNumberOfCharacters(Length maxCharacters);
348 * @brief Sets the maximum number of characters that can be inserted into the TextModel
350 * @param[in] maxCharacters maximum number of characters to be accepted
352 int GetMaximumNumberOfCharacters();
355 * @brief Called to enable/disable cursor blink.
357 * @note Only editable controls should calls this.
358 * @param[in] enabled Whether the cursor should blink or not.
360 void SetEnableCursorBlink(bool enable);
363 * @brief Query whether cursor blink is enabled.
365 * @return Whether the cursor should blink or not.
367 bool GetEnableCursorBlink() const;
370 * @brief Whether to enable the multi-line layout.
372 * @param[in] enable \e true enables the multi-line (by default)
374 void SetMultiLineEnabled(bool enable);
377 * @return Whether the multi-line layout is enabled.
379 bool IsMultiLineEnabled() const;
382 * @brief Sets the text's horizontal alignment.
384 * @param[in] alignment The horizontal alignment.
386 void SetHorizontalAlignment(HorizontalAlignment::Type alignment);
389 * @copydoc ModelInterface::GetHorizontalAlignment()
391 HorizontalAlignment::Type GetHorizontalAlignment() const;
394 * @brief Sets the text's vertical alignment.
396 * @param[in] alignment The vertical alignment.
398 void SetVerticalAlignment(VerticalAlignment::Type alignment);
401 * @copydoc ModelInterface::GetVerticalAlignment()
403 VerticalAlignment::Type GetVerticalAlignment() const;
406 * @brief Sets the text's wrap mode
407 * @param[in] text wrap mode The unit of wrapping
409 void SetLineWrapMode(Text::LineWrap::Mode textWarpMode);
412 * @brief Retrieve text wrap mode previously set.
413 * @return text wrap mode
415 Text::LineWrap::Mode GetLineWrapMode() const;
418 * @brief Enable or disable the text elide.
420 * @param[in] enabled Whether to enable the text elide.
422 void SetTextElideEnabled(bool enabled);
425 * @copydoc ModelInterface::IsTextElideEnabled()
427 bool IsTextElideEnabled() const;
430 * @brief Enable or disable the text fit.
432 * @param[in] enabled Whether to enable the text fit.
434 void SetTextFitEnabled(bool enabled);
437 * @brief Whether the text fit is enabled or not.
439 * @return True if the text fit is enabled
441 bool IsTextFitEnabled() const;
444 * @brief Sets current line size.
446 * @param[in] lineSize line size value to store the MinLineSize set by user when TextFitArray is enabled.
448 void SetCurrentLineSize(float lineSize);
451 * @brief Retrieves the current line size.
453 * @return The current line size
455 float GetCurrentLineSize() const;
458 * @brief Sets minimum size valid for text fit.
460 * @param[in] minimum size value.
461 * @param[in] type The font size type is point size or pixel size
463 void SetTextFitMinSize(float pointSize, FontSizeType type);
466 * @brief Retrieves the minimum point size valid for text fit.
468 * @return The minimum point size valid for text fit
470 float GetTextFitMinSize() const;
473 * @brief Sets maximum size valid for text fit.
475 * @param[in] maximum size value.
476 * @param[in] type The font size type is point size or pixel size
478 void SetTextFitMaxSize(float pointSize, FontSizeType type);
481 * @brief Retrieves the maximum point size valid for text fit.
483 * @return The maximum point size valid for text fit
485 float GetTextFitMaxSize() const;
488 * @brief Sets step size for font increase valid for text fit.
490 * @param[in] step size value.
491 * @param[in] type The font size type is point size or pixel size
493 void SetTextFitStepSize(float step, FontSizeType type);
496 * @brief Retrieves the step point size valid for text fit.
498 * @return The step point size valid for text fit
500 float GetTextFitStepSize() const;
503 * @brief Sets content size valid for text fit.
505 * @param[in] Content size value.
507 void SetTextFitContentSize(Vector2 size);
510 * @brief Retrieves the content size valid for text fit.
512 * @return The content size valid for text fit
514 Vector2 GetTextFitContentSize() const;
517 * @brief Retrieve the fited point size.
519 * @return The fited point size.
521 float GetTextFitPointSize() const;
524 * @brief Sets whether the text fit properties have changed.
526 * @param[in] changed Whether to changed the text fit.
528 void SetTextFitChanged(bool changed);
531 * @brief Whether the text fit properties are changed or not.
533 * @return True if the text fit properties are changed
535 bool IsTextFitChanged() const;
538 * @brief Sets line size valid for text fit.
540 * @param[in] lineSize line size value
542 void SetTextFitLineSize(float lineSize);
545 * @brief Enable or disable the text fit array.
547 * @param[in] enabled Whether to enable the text fit array.
549 void SetTextFitArrayEnabled(bool enabled);
552 * @brief Whether the text fit array is enabled or not.
554 * @return True if the text fit array is enabled.
556 bool IsTextFitArrayEnabled() const;
559 * @brief Sets the text fit array.
561 * @param[in] fitOptions The list of text fit options.
563 void SetTextFitArray(std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions);
566 * @brief Retrieve the text fit array.
568 * @return The list of text fit options.
570 std::vector<Toolkit::DevelTextLabel::FitOption>& GetTextFitArray();
573 * @brief Sets disabled color opacity.
575 * @param[in] opacity The color opacity value in disabled state.
577 void SetDisabledColorOpacity(float opacity);
580 * @brief Retrieves the disabled color opacity.
582 * @return The disabled color opacity value for disabled state.
584 float GetDisabledColorOpacity() const;
587 * @brief Enable or disable the placeholder text elide.
588 * @param enabled Whether to enable the placeholder text elide.
590 void SetPlaceholderTextElideEnabled(bool enabled);
593 * @brief Whether the placeholder text elide property is enabled.
594 * @return True if the placeholder text elide property is enabled, false otherwise.
596 bool IsPlaceholderTextElideEnabled() const;
599 * @brief Enable or disable the text selection.
600 * @param[in] enabled Whether to enable the text selection.
602 void SetSelectionEnabled(bool enabled);
605 * @brief Whether the text selection is enabled or not.
606 * @return True if the text selection is enabled
608 bool IsSelectionEnabled() const;
611 * @brief Enable or disable the text selection using Shift key.
612 * @param enabled Whether to enable the text selection using Shift key
614 void SetShiftSelectionEnabled(bool enabled);
617 * @brief Whether the text selection using Shift key is enabled or not.
618 * @return True if the text selection using Shift key is enabled
620 bool IsShiftSelectionEnabled() const;
623 * @brief Enable or disable the grab handles for text selection.
625 * @param[in] enabled Whether to enable the grab handles
627 void SetGrabHandleEnabled(bool enabled);
630 * @brief Returns whether the grab handles are enabled.
632 * @return True if the grab handles are enabled
634 bool IsGrabHandleEnabled() const;
637 * @brief Enable or disable the grab handles for text selection.
639 * @param[in] enabled Whether to enable the grab handles
641 void SetGrabHandlePopupEnabled(bool enabled);
644 * @brief Returns whether the grab handles are enabled.
646 * @return True if the grab handles are enabled
648 bool IsGrabHandlePopupEnabled() const;
651 * @brief Sets input type to password
653 * @note The string is displayed hidden character
655 * @param[in] passwordInput True if password input is enabled.
657 void SetInputModePassword(bool passwordInput);
660 * @brief Returns whether the input mode type is set as password.
662 * @return True if input mode type is password
664 bool IsInputModePassword();
667 * @brief Sets the action when there is a double tap event on top of a text area with no text.
669 * @param[in] action The action to do.
671 void SetNoTextDoubleTapAction(NoTextTap::Action action);
674 * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
676 * @return The action to do.
678 NoTextTap::Action GetNoTextDoubleTapAction() const;
681 * @briefSets the action when there is a long press event on top of a text area with no text.
683 * @param[in] action The action to do.
685 void SetNoTextLongPressAction(NoTextTap::Action action);
688 * @brief Retrieves the action when there is a long press event on top of a text area with no text.
690 * @return The action to do.
692 NoTextTap::Action GetNoTextLongPressAction() const;
695 * @brief Query if Underline settings were provided by string or map
696 * @return bool true if set by string
698 bool IsUnderlineSetByString();
701 * Set method underline setting were set by
702 * @param[in] bool, true if set by string
704 void UnderlineSetByString(bool setByString);
707 * @brief Query if shadow settings were provided by string or map
708 * @return bool true if set by string
710 bool IsShadowSetByString();
713 * Set method shadow setting were set by
714 * @param[in] bool, true if set by string
716 void ShadowSetByString(bool setByString);
719 * @brief Query if outline settings were provided by string or map
720 * @return bool true if set by string
722 bool IsOutlineSetByString();
725 * Set method outline setting were set by
726 * @param[in] bool, true if set by string
728 void OutlineSetByString(bool setByString);
731 * @brief Query if font style settings were provided by string or map
732 * @return bool true if set by string
734 bool IsFontStyleSetByString();
737 * Set method font style setting were set by
738 * @param[in] bool, true if set by string
740 void FontStyleSetByString(bool setByString);
743 * @brief Query if Strikethrough settings were provided by string or map
744 * @return bool true if set by string
746 bool IsStrikethroughSetByString();
749 * Set method Strikethrough setting were set by
750 * @param[in] bool, true if set by string
752 void StrikethroughSetByString(bool setByString);
755 * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
757 * @param[in] height The height in pixels of the strikethrough
759 void SetStrikethroughHeight(float height);
762 * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
764 * @return The height of the strikethrough, or 0 if height is not overrided.
766 float GetStrikethroughHeight() const;
769 * @brief Set the strikethrough color.
771 * @param[in] color color of strikethrough.
773 void SetStrikethroughColor(const Vector4& color);
776 * @brief Retrieve the strikethrough color.
778 * @return The strikethrough color.
780 const Vector4& GetStrikethroughColor() const;
783 * @brief Set the strikethrough enabled flag.
785 * @param[in] enabled The strikethrough enabled flag.
787 void SetStrikethroughEnabled(bool enabled);
790 * @brief Returns whether the text has a strikethrough or not.
792 * @return The strikethrough state.
794 bool IsStrikethroughEnabled() const;
798 * @brief Replaces any text previously set.
800 * @note This will be converted into UTF-32 when stored in the text model.
801 * @param[in] text A string of UTF-8 characters.
803 void SetText(const std::string& text);
806 * @brief Retrieve any text previously set.
808 * @param[out] text A string of UTF-8 characters.
810 void GetText(std::string& text) const;
813 * @brief Retrieves number of characters previously set.
815 * @return A length of string of UTF-32 characters.
817 Length GetNumberOfCharacters() const;
820 * @brief Set the @p spannedText
821 * the spanned text contains content (text) and format (spans with ranges)
822 * the text is copied into text-controller and the spans are applied on ranges
824 * @param[in] spannedText the text with spans.
826 void SetSpannedText(const Text::Spanned& spannedText);
829 * @brief Replaces any placeholder text previously set.
831 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
832 * @param[in] text A string of UTF-8 characters.
834 void SetPlaceholderText(PlaceholderType type, const std::string& text);
837 * @brief Retrieve any placeholder text previously set.
839 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
840 * @param[out] A string of UTF-8 characters.
842 void GetPlaceholderText(PlaceholderType type, std::string& text) const;
845 * @ brief Update the text after a font change
846 * @param[in] newDefaultFont The new font to change to
848 void UpdateAfterFontChange(const std::string& newDefaultFont);
851 * @brief The method acquires currently selected text
852 * @param selectedText variable to place selected text in
854 void RetrieveSelection(std::string& selectedText) const;
857 * @brief The method sets selection in given range
858 * @param start index of first character
859 * @param end index of first character after selection
861 void SetSelection(int start, int end);
864 * @brief This method retrieve indexes of current selection
866 * @return a pair, where first element is left index of selection and second is the right one
868 std::pair<int, int> GetSelectionIndexes() const;
871 * Place string in system clipboard
872 * @param source std::string
874 void CopyStringToClipboard(const std::string& source);
877 * Place currently selected text in system clipboard
878 * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
880 void SendSelectionToClipboard(bool deleteAfterSending);
882 public: // Default style & Input style
884 * @brief Set the default font family.
886 * @param[in] defaultFontFamily The default font family.
888 void SetDefaultFontFamily(const std::string& defaultFontFamily);
891 * @brief Retrieve the default font family.
893 * @return The default font family.
895 std::string GetDefaultFontFamily() const;
898 * @brief Sets the placeholder text font family.
899 * @param[in] placeholderTextFontFamily The placeholder text font family.
901 void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
904 * @brief Retrieves the placeholder text font family.
906 * @return The placeholder text font family
908 std::string GetPlaceholderFontFamily() const;
911 * @brief Sets the default font weight.
913 * @param[in] weight The font weight.
915 void SetDefaultFontWeight(FontWeight weight);
918 * @brief Whether the font's weight has been defined.
920 bool IsDefaultFontWeightDefined() const;
923 * @brief Retrieves the default font weight.
925 * @return The default font weight.
927 FontWeight GetDefaultFontWeight() const;
930 * @brief Sets the placeholder text font weight.
932 * @param[in] weight The font weight
934 void SetPlaceholderTextFontWeight(FontWeight weight);
937 * @brief Whether the font's weight has been defined.
939 * @return True if the placeholder text font weight is defined
941 bool IsPlaceholderTextFontWeightDefined() const;
944 * @brief Retrieves the placeholder text font weight.
946 * @return The placeholder text font weight
948 FontWeight GetPlaceholderTextFontWeight() const;
951 * @brief Sets the default font width.
953 * @param[in] width The font width.
955 void SetDefaultFontWidth(FontWidth width);
958 * @brief Whether the font's width has been defined.
960 bool IsDefaultFontWidthDefined() const;
963 * @brief Retrieves the default font width.
965 * @return The default font width.
967 FontWidth GetDefaultFontWidth() const;
970 * @brief Sets the placeholder text font width.
972 * @param[in] width The font width
974 void SetPlaceholderTextFontWidth(FontWidth width);
977 * @brief Whether the font's width has been defined.
979 * @return True if the placeholder text font width is defined
981 bool IsPlaceholderTextFontWidthDefined() const;
984 * @brief Retrieves the placeholder text font width.
986 * @return The placeholder text font width
988 FontWidth GetPlaceholderTextFontWidth() const;
991 * @brief Sets the default font slant.
993 * @param[in] slant The font slant.
995 void SetDefaultFontSlant(FontSlant slant);
998 * @brief Whether the font's slant has been defined.
1000 bool IsDefaultFontSlantDefined() const;
1003 * @brief Retrieves the default font slant.
1005 * @return The default font slant.
1007 FontSlant GetDefaultFontSlant() const;
1010 * @brief Sets the placeholder text font slant.
1012 * @param[in] slant The font slant
1014 void SetPlaceholderTextFontSlant(FontSlant slant);
1017 * @brief Whether the font's slant has been defined.
1019 * @return True if the placeholder text font slant is defined
1021 bool IsPlaceholderTextFontSlantDefined() const;
1024 * @brief Retrieves the placeholder text font slant.
1026 * @return The placeholder text font slant
1028 FontSlant GetPlaceholderTextFontSlant() const;
1031 * @brief Set the default font size.
1033 * @param[in] fontSize The default font size
1034 * @param[in] type The font size type is point size or pixel size
1036 void SetDefaultFontSize(float fontSize, FontSizeType type);
1039 * @brief Retrieve the default point size.
1041 * @param[in] type The font size type
1042 * @return The default point size.
1044 float GetDefaultFontSize(FontSizeType type) const;
1047 * @brief Set the font size scale.
1049 * @param[in] scale The font size scale
1051 void SetFontSizeScale(float scale);
1054 * @brief Get the font size scale.
1056 * @return The font size scale.
1058 float GetFontSizeScale() const;
1061 * @brief Set the font size scale enabled flag.
1063 * @param[in] enabled whether to enable the font size scale.
1065 void SetFontSizeScaleEnabled(bool enabled);
1068 * @brief Returns whether the font size scale is enabled or not.
1070 * @return @e true if the font size scale is enabled, otherwise returns @e false.
1072 bool IsFontSizeScaleEnabled() const;
1075 * @brief Sets the Placeholder text font size.
1076 * @param[in] fontSize The placeholder text font size
1077 * @param[in] type The font size type is point size or pixel size
1079 void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
1082 * @brief Retrieves the Placeholder text font size.
1083 * @param[in] type The font size type
1084 * @return The placeholder font size
1086 float GetPlaceholderTextFontSize(FontSizeType type) const;
1089 * @brief Sets the text's default color.
1091 * @param color The default color.
1093 void SetDefaultColor(const Vector4& color);
1096 * @brief Retrieves the text's default color.
1098 * @return The default color.
1100 const Vector4& GetDefaultColor() const;
1103 * @brief Sets the anchor's default color.
1105 * @param color The anchor color.
1107 void SetAnchorColor(const Vector4& color);
1110 * @brief Retrieves the anchor's default color.
1112 * @return The anchor color.
1114 const Vector4& GetAnchorColor() const;
1117 * @brief Sets the anchor's clicked color.
1119 * @param color The anchor color.
1121 void SetAnchorClickedColor(const Vector4& color);
1124 * @brief Retrieves the anchor's clicked color.
1126 * @return The anchor color.
1128 const Vector4& GetAnchorClickedColor() const;
1131 * @brief Sets the user interaction enabled.
1133 * @param enabled whether to enable the user interaction.
1135 void SetUserInteractionEnabled(bool enabled);
1138 * @brief Whether the user interaction is enabled.
1140 * @return true if the user interaction is enabled, false otherwise.
1142 bool IsUserInteractionEnabled() const;
1145 * @brief Set the text color
1147 * @param textColor The text color
1149 void SetPlaceholderTextColor(const Vector4& textColor);
1152 * @brief Retrieve the text color
1154 * @return The text color
1156 const Vector4& GetPlaceholderTextColor() const;
1159 * @brief Set the shadow offset.
1161 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
1163 void SetShadowOffset(const Vector2& shadowOffset);
1166 * @brief Retrieve the shadow offset.
1168 * @return The shadow offset.
1170 const Vector2& GetShadowOffset() const;
1173 * @brief Set the shadow color.
1175 * @param[in] shadowColor The shadow color.
1177 void SetShadowColor(const Vector4& shadowColor);
1180 * @brief Retrieve the shadow color.
1182 * @return The shadow color.
1184 const Vector4& GetShadowColor() const;
1187 * @brief Set the shadow blur radius.
1189 * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
1191 void SetShadowBlurRadius(const float& shadowBlurRadius);
1194 * @brief Retrieve the shadow blur radius.
1196 * @return The shadow blur radius.
1198 const float& GetShadowBlurRadius() const;
1201 * @brief Set the underline color.
1203 * @param[in] color color of underline.
1205 void SetUnderlineColor(const Vector4& color);
1208 * @brief Retrieve the underline color.
1210 * @return The underline color.
1212 const Vector4& GetUnderlineColor() const;
1215 * @brief Set the underline enabled flag.
1217 * @param[in] enabled The underline enabled flag.
1219 void SetUnderlineEnabled(bool enabled);
1222 * @brief Returns whether the text is underlined or not.
1224 * @return The underline state.
1226 bool IsUnderlineEnabled() const;
1229 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
1231 * @param[in] height The height in pixels of the underline
1233 void SetUnderlineHeight(float height);
1236 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
1238 * @return The height of the underline, or 0 if height is not overrided.
1240 float GetUnderlineHeight() const;
1243 * @brief Sets the underline type.
1244 * @param[in] type The underline type.
1246 void SetUnderlineType(Text::Underline::Type type);
1249 * @brief Retrieve underline type.
1250 * @return The underline type.
1252 Text::Underline::Type GetUnderlineType() const;
1255 * @brief Set the width of the dashes of the dashed underline.
1257 * @param[in] width The width in pixels of the dashes of the dashed underline.
1259 void SetDashedUnderlineWidth(float width);
1262 * @brief Retrieves the width of the dashes of the dashed underline.
1264 * @return The width of the dashes of the dashed underline.
1266 float GetDashedUnderlineWidth() const;
1269 * @brief Set the gap between the dashes of the dashed underline.
1271 * @param[in] gap The gap between the dashes of the dashed underline.
1273 void SetDashedUnderlineGap(float gap);
1276 * @brief Retrieves the gap between the dashes of the dashed underline.
1278 * @return The The gap between the dashes of the dashed underline.
1280 float GetDashedUnderlineGap() const;
1283 * @brief Set the outline color.
1285 * @param[in] color color of outline.
1287 void SetOutlineColor(const Vector4& color);
1290 * @brief Retrieve the outline color.
1292 * @return The outline color.
1294 const Vector4& GetOutlineColor() const;
1297 * @brief Set the outline width
1299 * @param[in] width The width in pixels of the outline, 0 indicates no outline
1301 void SetOutlineWidth(uint16_t width);
1304 * @brief Retrieves the width of an outline
1306 * @return The width of the outline.
1308 uint16_t GetOutlineWidth() const;
1311 * @brief Set the background color.
1313 * @param[in] color color of background.
1315 void SetBackgroundColor(const Vector4& color);
1318 * @brief Retrieve the background color.
1320 * @return The background color.
1322 const Vector4& GetBackgroundColor() const;
1325 * @brief Set the background enabled flag.
1327 * @param[in] enabled The background enabled flag.
1329 void SetBackgroundEnabled(bool enabled);
1332 * @brief Returns whether to enable text background or not.
1334 * @return Whether text background is enabled.
1336 bool IsBackgroundEnabled() const;
1339 * @brief Sets the emboss's properties string.
1341 * @note The string is stored to be recovered.
1343 * @param[in] embossProperties The emboss's properties string.
1345 void SetDefaultEmbossProperties(const std::string& embossProperties);
1348 * @brief Retrieves the emboss's properties string.
1350 * @return The emboss's properties string.
1352 std::string GetDefaultEmbossProperties() const;
1355 * @brief Sets the outline's properties string.
1357 * @note The string is stored to be recovered.
1359 * @param[in] outlineProperties The outline's properties string.
1361 void SetDefaultOutlineProperties(const std::string& outlineProperties);
1364 * @brief Retrieves the outline's properties string.
1366 * @return The outline's properties string.
1368 std::string GetDefaultOutlineProperties() const;
1371 * @brief Sets the default line spacing.
1373 * @param[in] lineSpacing The line spacing.
1375 * @return True if lineSpacing has been updated, false otherwise
1377 bool SetDefaultLineSpacing(float lineSpacing);
1380 * @brief Retrieves the default line spacing.
1382 * @return The line spacing.
1384 float GetDefaultLineSpacing() const;
1387 * @brief Sets the default line size.
1389 * @param[in] lineSize The line size.
1391 * @return True if lineSize has been updated, false otherwise
1393 bool SetDefaultLineSize(float lineSize);
1396 * @brief Retrieves the default line size.
1398 * @return The line size.
1400 float GetDefaultLineSize() const;
1403 * @brief Sets the relative line size to the original line size.
1405 * @param[in] relativeLineSize The relativeline size.
1407 * @return True if relativeLineSize has been updated, false otherwise
1409 bool SetRelativeLineSize(float lineSize);
1412 * @brief Retrieves the relative line size.
1414 * @return The relative line size.
1416 float GetRelativeLineSize() const;
1419 * @brief Sets the input text's color.
1421 * @param[in] color The input text's color.
1423 void SetInputColor(const Vector4& color);
1426 * @brief Retrieves the input text's color.
1428 * @return The input text's color.
1430 const Vector4& GetInputColor() const;
1433 * @brief Sets the input text's font family name.
1435 * @param[in] fontFamily The text's font family name.
1437 void SetInputFontFamily(const std::string& fontFamily);
1440 * @brief Retrieves the input text's font family name.
1442 * @return The input text's font family name.
1444 std::string GetInputFontFamily() const;
1447 * @brief Sets the input font's weight.
1449 * @param[in] weight The input font's weight.
1451 void SetInputFontWeight(FontWeight weight);
1454 * @return Whether the font's weight has been defined.
1456 bool IsInputFontWeightDefined() const;
1459 * @brief Retrieves the input font's weight.
1461 * @return The input font's weight.
1463 FontWeight GetInputFontWeight() const;
1466 * @brief Sets the input font's width.
1468 * @param[in] width The input font's width.
1470 void SetInputFontWidth(FontWidth width);
1473 * @return Whether the font's width has been defined.
1475 bool IsInputFontWidthDefined() const;
1478 * @brief Retrieves the input font's width.
1480 * @return The input font's width.
1482 FontWidth GetInputFontWidth() const;
1485 * @brief Sets the input font's slant.
1487 * @param[in] slant The input font's slant.
1489 void SetInputFontSlant(FontSlant slant);
1492 * @return Whether the font's slant has been defined.
1494 bool IsInputFontSlantDefined() const;
1497 * @brief Retrieves the input font's slant.
1499 * @return The input font's slant.
1501 FontSlant GetInputFontSlant() const;
1504 * @brief Sets the input font's point size.
1506 * @param[in] size The input font's point size.
1507 * @param[in] defaultFontSizeUpdated True If the default font size is updated and sets the input point size, false otherwise.
1509 void SetInputFontPointSize(float size, bool defaultFontSizeUpdated = false);
1512 * @brief Retrieves the input font's point size.
1514 * @return The input font's point size.
1516 float GetInputFontPointSize() const;
1519 * @brief Sets the input line spacing.
1521 * @param[in] lineSpacing The line spacing.
1523 void SetInputLineSpacing(float lineSpacing);
1526 * @brief Retrieves the input line spacing.
1528 * @return The line spacing.
1530 float GetInputLineSpacing() const;
1533 * @brief Sets the input shadow's properties string.
1535 * @note The string is stored to be recovered.
1537 * @param[in] shadowProperties The shadow's properties string.
1539 void SetInputShadowProperties(const std::string& shadowProperties);
1542 * @brief Retrieves the input shadow's properties string.
1544 * @return The shadow's properties string.
1546 std::string GetInputShadowProperties() const;
1549 * @brief Sets the input underline's properties string.
1551 * @note The string is stored to be recovered.
1553 * @param[in] underlineProperties The underline's properties string.
1555 void SetInputUnderlineProperties(const std::string& underlineProperties);
1558 * @brief Retrieves the input underline's properties string.
1560 * @return The underline's properties string.
1562 std::string GetInputUnderlineProperties() const;
1565 * @brief Sets the input emboss's properties string.
1567 * @note The string is stored to be recovered.
1569 * @param[in] embossProperties The emboss's properties string.
1571 void SetInputEmbossProperties(const std::string& embossProperties);
1574 * @brief Retrieves the input emboss's properties string.
1576 * @return The emboss's properties string.
1578 std::string GetInputEmbossProperties() const;
1581 * @brief Sets input the outline's properties string.
1583 * @note The string is stored to be recovered.
1585 * @param[in] outlineProperties The outline's properties string.
1587 void SetInputOutlineProperties(const std::string& outlineProperties);
1590 * @brief Retrieves the input outline's properties string.
1592 * @return The outline's properties string.
1594 std::string GetInputOutlineProperties() const;
1597 * @brief Sets the input strikethrough's properties string.
1599 * @note The string is stored to be recovered.
1601 * @param[in] strikethroughProperties The strikethrough's properties string.
1603 void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
1606 * @brief Retrieves the input strikethrough's properties string.
1608 * @return The strikethrough's properties string.
1610 std::string GetInputStrikethroughProperties() const;
1613 * @brief Set the control's interface.
1615 * @param[in] controlInterface The control's interface.
1617 void SetControlInterface(ControlInterface* controlInterface);
1620 * @brief Set the anchor control's interface.
1622 * @param[in] anchorControlInterface The control's interface.
1624 void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
1627 * @brief Sets the character spacing.
1629 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1631 * @param[in] characterSpacing The character spacing.
1633 void SetCharacterSpacing(float characterSpacing);
1636 * @brief Retrieves the character spacing.
1638 * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
1640 * @return The character spacing.
1642 const float GetCharacterSpacing() const;
1645 * @brief Sets the visual transform offset.
1647 * @param[in] offset The offset.
1649 void SetVisualTransformOffset(Vector2 offset);
1651 public: // Queries & retrieves.
1653 * @brief Return the layout engine.
1655 * @return A reference to the layout engine.
1657 Layout::Engine& GetLayoutEngine();
1660 * @brief Return a view of the text.
1662 * @return A reference to the view.
1667 * @copydoc Control::GetNaturalSize()
1669 Vector3 GetNaturalSize();
1672 * @copydoc Control::GetHeightForWidth()
1674 float GetHeightForWidth(float width);
1677 * @brief Calculates the point size for text for given layout()
1679 void FitPointSizeforLayout(Size layoutSize);
1682 * @brief Calculates the point size for text for given layout() using fit array.
1684 void FitArrayPointSizeforLayout(Size layoutSize);
1687 * @brief Checks if the point size fits within the layout size.
1689 * @return Whether the point size fits within the layout size.
1691 bool CheckForTextFit(float pointSize, Size& layoutSize);
1694 * @brief Retrieves the text's number of lines for a given width.
1695 * @param[in] width The width of the text's area.
1696 * @ return The number of lines.
1698 int GetLineCount(float width);
1701 * @brief Retrieves the text's model.
1703 * @return A pointer to the text's model.
1705 const ModelInterface* GetTextModel() const;
1708 * @brief Used to get scrolled distance by user input
1710 * @return Distance from last scroll offset to new scroll offset
1712 float GetScrollAmountByUserInput();
1715 * @brief Get latest scroll amount, control size and layout size
1717 * This method is used to get information of control's scroll
1718 * @param[out] scrollPosition The current scrolled position
1719 * @param[out] controlHeight The size of a UI control
1720 * @param[out] layoutHeight The size of a bounding box to layout text within.
1722 * @return Whether the text scroll position is changed or not after last update.
1724 bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1727 * @brief Used to set the hidden input option
1729 void SetHiddenInputOption(const Property::Map& options);
1732 * @brief Used to get the hidden input option
1734 void GetHiddenInputOption(Property::Map& options);
1737 * @brief Used to set the input filter option
1739 void SetInputFilterOption(const Property::Map& options);
1742 * @brief Used to get the input filter option
1744 void GetInputFilterOption(Property::Map& options);
1747 * @brief Sets the Placeholder Properties.
1749 * @param[in] map The placeholder property map
1751 void SetPlaceholderProperty(const Property::Map& map);
1754 * @brief Retrieves the Placeholder Property map.
1756 * @param[out] map The property map
1758 void GetPlaceholderProperty(Property::Map& map);
1761 * @brief Checks text direction.
1762 * @return The text direction.
1764 Toolkit::DevelText::TextDirection::Type GetTextDirection();
1767 * @brief Retrieves vertical line alignment
1768 * @return The vertical line alignment
1770 Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1773 * @brief Sets vertical line alignment
1774 * @param[in] alignment The vertical line alignment for the text
1776 void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1779 * @brief Retrieves ellipsis position
1780 * @return The ellipsis position
1782 Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
1785 * @brief Sets ellipsis position
1786 * @param[in] ellipsisPosition The ellipsis position for the text
1788 void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
1791 * @brief Retrieves ignoreSpaceAfterText value from model
1792 * @return The value of ignoreSpaceAfterText
1794 bool IsIgnoreSpacesAfterText() const;
1797 * @brief Sets ignoreSpaceAfterText value to model
1798 * @param[in] ignore The value of ignoreSpacesAfterText for the text
1800 void SetIgnoreSpacesAfterText(bool ignore);
1803 * @brief Sets SetMatchLayoutDirection value to model
1804 * @param[in] match The value of matchLayoutDirection for the text
1806 void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type);
1809 * @brief Retrieves matchLayoutDirection value from model
1810 * @return The value of matchLayoutDirection
1812 DevelText::MatchLayoutDirection GetMatchLayoutDirection() const;
1815 * @brief Sets layoutDirection type value.
1816 * @param[in] layoutDirection The value of the layout direction type.
1818 void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1821 * @brief Gets layoutDirection type value.
1822 * @param[in] actor The actor which will get the layout direction type.
1823 * @return The value of the layout direction type.
1825 Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
1828 * @brief Get the rendered size of a specific text range.
1829 * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
1830 * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
1832 * @param[in] startIndex start index of the text requested to calculate size for.
1833 * @param[in] endIndex end index(included) of the text requested to calculate size for.
1834 * @return list of sizes of the reuested text.
1836 Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
1839 * @brief Get the top/left rendered position of a specific text range.
1840 * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
1841 * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
1843 * @param[in] startIndex start index of the text requested to get position to.
1844 * @param[in] endIndex end index(included) of the text requested to get position to.
1845 * @return list of positions of the requested text.
1847 Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
1850 * @brief Get the line bounding rectangle.
1851 * if the requested index is out of range or the line is not yet rendered, a rect of {0, 0, 0, 0} is returned.
1853 * @param[in] lineIndex line index to which we want to calculate the geometry for.
1854 * @return bounding rectangle.
1856 Rect<float> GetLineBoundingRectangle(const uint32_t lineIndex);
1859 * @brief Get the char bounding rectangle.
1860 * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
1862 * @param[in] charIndex character index to which we want to calculate the geometry for.
1863 * @return bounding rectangle.
1865 Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
1868 * @brief Get the character index.
1869 * If the text is not yet rendered or the text is empty, -1 is returned.
1871 * @param[in] visualX visual x position.
1872 * @param[in] visualY visual y position.
1873 * @return character index.
1875 int GetCharacterIndexAtPosition(float visualX, float visualY);
1878 * @brief Gets the bounding box of a specific text range.
1880 * @param[in] startIndex start index of the text requested to get bounding box to.
1881 * @param[in] endIndex end index(included) of the text requested to get bounding box to.
1882 * @return bounding box of the requested text.
1884 Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
1887 * @brief Sets the layout direction changed.
1889 void ChangedLayoutDirection();
1892 * @brief Clear font and style data.
1894 void ResetFontAndStyleData();
1897 * @brief Retrieves if showing real text or not.
1898 * @return The value of showing real text.
1900 bool IsShowingRealText() const;
1902 public: // Relayout.
1904 * @brief Triggers a relayout which updates View (if necessary).
1906 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1907 * @param[in] size A the size of a bounding box to layout text within.
1908 * @param[in] layoutDirection The direction of the system language.
1910 * @return Whether the text model or decorations were updated.
1912 UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1915 * @brief Request a relayout using the ControlInterface.
1917 void RequestRelayout();
1919 public: // Input style change signals.
1921 * @return Whether the queue of input style changed signals is empty.
1923 bool IsInputStyleChangedSignalsQueueEmpty();
1926 * @brief Request process all pending input style changed signals.
1928 * Request to calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1929 * text controls. Text controls may send signals to state the input style has changed.
1931 * The signal will be execute next idle time, or skip if we fail to add idler.
1933 void RequestProcessInputStyleChangedSignals();
1937 * @brief Callbacks called on idle.
1939 * If there are notifications of change of input style on the queue, Toolkit::TextField::InputStyleChangedSignal() are emitted.
1941 void OnIdleSignal();
1943 public: // Text-input Event Queuing.
1945 * @brief Called by editable UI controls when keyboard focus is gained.
1947 void KeyboardFocusGainEvent();
1950 * @brief Called by editable UI controls when focus is lost.
1952 void KeyboardFocusLostEvent();
1955 * @brief Called by editable UI controls when key events are received.
1957 * @param[in] event The key event.
1958 * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1960 bool KeyEvent(const Dali::KeyEvent& event);
1963 * @brief Called by anchor when a tap gesture occurs.
1964 * @param[in] x The x position relative to the top-left of the parent control.
1965 * @param[in] y The y position relative to the top-left of the parent control.
1967 void AnchorEvent(float x, float y);
1970 * @brief Called by editable UI controls when a tap gesture occurs.
1971 * @param[in] tapCount The number of taps.
1972 * @param[in] x The x position relative to the top-left of the parent control.
1973 * @param[in] y The y position relative to the top-left of the parent control.
1975 void TapEvent(unsigned int tapCount, float x, float y);
1978 * @brief Called by editable UI controls when a pan gesture occurs.
1980 * @param[in] state The state of the gesture.
1981 * @param[in] displacement This distance panned since the last pan gesture.
1983 void PanEvent(GestureState state, const Vector2& displacement);
1986 * @brief Called by editable UI controls when a long press gesture occurs.
1988 * @param[in] state The state of the gesture.
1989 * @param[in] x The x position relative to the top-left of the parent control.
1990 * @param[in] y The y position relative to the top-left of the parent control.
1992 void LongPressEvent(GestureState state, float x, float y);
1995 * @brief Used to get the Primary cursor position.
1997 * @return Primary cursor position.
1999 CharacterIndex GetPrimaryCursorPosition() const;
2002 * @brief Used to set the Primary cursor position.
2004 * @param[in] index for the Primary cursor position.
2005 * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
2006 * @return[in] true if cursor position changed, false otherwise.
2008 bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
2011 * @brief Creates a selection event.
2013 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
2015 * @param[in] x The x position relative to the top-left of the parent control.
2016 * @param[in] y The y position relative to the top-left of the parent control.
2017 * @param[in] selection type like the whole text is selected or unselected.
2019 void SelectEvent(float x, float y, SelectionType selection);
2022 * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
2024 void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
2027 * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
2029 Uint32Pair GetTextSelectionRange() const;
2032 * @copydoc Text::SelectableControlInterface::SelectWholeText()
2034 void SelectWholeText();
2037 * @copydoc Text::EditableControlInterface::CopyText()
2042 * @copydoc Text::EditableControlInterface::CutText()
2047 * @copydoc Text::EditableControlInterface::PasteText()
2052 * @copydoc Text::SelectableControlInterface::SelectNone()
2057 * @copydoc Text::SelectableControlInterface::SelectText()
2059 void SelectText(const uint32_t start, const uint32_t end);
2062 * @copydoc Text::SelectableControlInterface::GetSelectedText()
2064 string GetSelectedText() const;
2067 * @copydoc Text::EditableControlInterface::IsEditable()
2069 virtual bool IsEditable() const;
2072 * @copydoc Text::EditableControlInterface::SetEditable()
2074 virtual void SetEditable(bool editable);
2077 * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
2079 virtual void ScrollBy(Vector2 scroll);
2082 * @brief Whether the text is scrollable.
2083 * @return Returns true if the text is scrollable.
2085 bool IsScrollable(const Vector2& displacement);
2088 * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
2090 float GetHorizontalScrollPosition();
2093 * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
2095 float GetVerticalScrollPosition();
2098 * @brief Event received from input method context
2100 * @param[in] inputMethodContext The input method context.
2101 * @param[in] inputMethodContextEvent The event received.
2102 * @return A data struture indicating if update is needed, cursor position and current text.
2104 InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
2107 * @brief Event from Clipboard notifying an Item has been selected for pasting
2109 * @param[in] id The id of the data request.
2110 * @param[in] mimeType The mime type of data received.
2111 * @param[in] data The data received.
2113 * This event is executed by receiving the Clipboard's DataReceivedSignal.
2115 void PasteClipboardItemEvent(uint32_t id, const char* mimeType, const char* data);
2118 * @brief Return true when text control should clear key input focus when escape key is pressed.
2120 * @return Whether text control should clear key input focus or not when escape key is pressed.
2122 bool ShouldClearFocusOnEscape() const;
2125 * @brief Create an actor that renders the text background color
2127 * @return the created actor or an empty handle if no background color needs to be rendered.
2129 Actor CreateBackgroundActor();
2132 * @brief Used to reset the cursor position after setting a new text.
2134 * @param[in] cursorIndex Where to place the cursor.
2136 void ResetCursorPosition(CharacterIndex cursorIndex);
2139 * @brief The method acquires current position of cursor
2140 * @return unsigned value with cursor position
2142 CharacterIndex GetCursorPosition();
2145 * @brief Resets a provided vector with actors that marks the position of anchors in markup enabled text
2147 * @param[out] anchorActors the vector of actor (empty collection if no anchors available).
2149 void GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors);
2152 * @brief Return an index of first anchor in the anchor vector whose boundaries includes given character offset
2154 * @param[in] characterOffset A position in text coords.
2156 * @return the index in anchor vector (-1 if an anchor not found)
2158 int GetAnchorIndex(size_t characterOffset);
2160 protected: // Inherit from Text::Decorator::ControllerInterface.
2162 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
2164 void GetTargetSize(Vector2& targetSize) override;
2167 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
2169 void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
2172 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
2174 void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
2176 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
2178 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
2180 void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
2182 protected: // Inherit from HiddenText.
2184 * @brief Invoked from HiddenText when showing time of the last character was expired
2186 void DisplayTimeExpired() override;
2188 protected: // Inherit from Integration::Processor
2190 * @copydoc Dali::Integration::Processor::Process()
2192 void Process(bool postProcess) override;
2195 * @copydoc Dali::Integration::Processor::GetProcessorName()
2197 std::string_view GetProcessorName() const override
2199 return "Text::Controller";
2202 private: // Private contructors & copy operator.
2204 * @brief Private constructor.
2207 : Controller(nullptr, nullptr, nullptr, nullptr)
2212 * @brief Private constructor.
2214 Controller(ControlInterface* controlInterface)
2215 : Controller(controlInterface, nullptr, nullptr, nullptr)
2220 * @brief Private constructor.
2222 Controller(ControlInterface* controlInterface,
2223 EditableControlInterface* editableControlInterface,
2224 SelectableControlInterface* selectableControlInterface,
2225 AnchorControlInterface* anchorControlInterface);
2227 Controller(const Controller& handle) = delete;
2228 Controller& operator=(const Controller& handle) = delete;
2230 protected: // Destructor.
2232 * @brief A reference counted object may only be deleted by calling Unreference().
2234 virtual ~Controller();
2237 struct Impl; ///< Made public for testing purposes
2240 struct EventHandler;
2241 struct InputFontHandler;
2242 struct InputProperties;
2243 struct PlaceholderHandler;
2246 struct SpannableHandler;
2248 std::unique_ptr<Impl> mImpl{nullptr};
2251 } // namespace Dali::Toolkit::Text
2253 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H