Updated all header files to new format
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/input-method-context.h>
23 #include <dali/public-api/events/gesture.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
27 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
28 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
29 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
30 #include <dali-toolkit/internal/text/hidden-text.h>
31 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
32 #include <dali-toolkit/internal/text/text-model-interface.h>
33 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
34 #include <dali-toolkit/public-api/text/text-enumerations.h>
35
36 namespace Dali
37 {
38 namespace Toolkit
39 {
40 namespace Text
41 {
42 class Controller;
43 class ControlInterface;
44 class EditableControlInterface;
45 class View;
46 class RenderingController;
47
48 /**
49    * @brief Text selection operations .
50    */
51 enum SelectionType
52 {
53   INTERACTIVE = 0x0000,
54   ALL         = 0x0001,
55   NONE        = 0x0002
56 };
57
58 typedef IntrusivePtr<Controller> ControllerPtr;
59
60 /**
61  * @brief A Text Controller is used by UI Controls which display text.
62  *
63  * It manipulates the Logical & Visual text models on behalf of the UI Controls.
64  * It provides a view of the text that can be used by rendering back-ends.
65  *
66  * For selectable/editable UI controls, the controller handles input events from the UI control
67  * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
68  *
69  * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
70  */
71 class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public HiddenText::Observer
72 {
73 public: // Enumerated types.
74   /**
75    * @brief Text related operations to be done in the relayout process.
76    */
77   enum OperationsMask
78   {
79     NO_OPERATION       = 0x0000,
80     CONVERT_TO_UTF32   = 0x0001,
81     GET_SCRIPTS        = 0x0002,
82     VALIDATE_FONTS     = 0x0004,
83     GET_LINE_BREAKS    = 0x0008,
84     BIDI_INFO          = 0x0010,
85     SHAPE_TEXT         = 0x0020,
86     GET_GLYPH_METRICS  = 0x0040,
87     LAYOUT             = 0x0080,
88     UPDATE_LAYOUT_SIZE = 0x0100,
89     REORDER            = 0x0200,
90     ALIGN              = 0x0400,
91     COLOR              = 0x0800,
92     UPDATE_DIRECTION   = 0x1000,
93     ALL_OPERATIONS     = 0xFFFF
94   };
95
96   /**
97    * @brief Used to distinguish between regular key events and InputMethodContext events
98    */
99   enum InsertType
100   {
101     COMMIT,
102     PRE_EDIT
103   };
104
105   /**
106    * @brief Used to specify whether to update the input style.
107    */
108   enum UpdateInputStyleType
109   {
110     UPDATE_INPUT_STYLE,
111     DONT_UPDATE_INPUT_STYLE
112   };
113
114   /**
115    * @brief Used to specify what has been updated after the Relayout() method has been called.
116    */
117   enum UpdateTextType
118   {
119     NONE_UPDATED      = 0x0, ///< Nothing has been updated.
120     MODEL_UPDATED     = 0x1, ///< The text's model has been updated.
121     DECORATOR_UPDATED = 0x2  ///< The decoration has been updated.
122   };
123
124   /**
125    * @brief Different placeholder-text can be shown when the control is active/inactive.
126    */
127   enum PlaceholderType
128   {
129     PLACEHOLDER_TYPE_ACTIVE,
130     PLACEHOLDER_TYPE_INACTIVE,
131   };
132
133   /**
134    * @brief Enumeration for Font Size Type.
135    */
136   enum FontSizeType
137   {
138     POINT_SIZE, // The size of font in points.
139     PIXEL_SIZE  // The size of font in pixels.
140   };
141
142   struct NoTextTap
143   {
144     enum Action
145     {
146       NO_ACTION,           ///< Does no action if there is a tap on top of an area with no text.
147       HIGHLIGHT,           ///< Highlights the nearest text (at the beginning or end of the text) and shows the text's selection popup.
148       SHOW_SELECTION_POPUP ///< Shows the text's selection popup.
149     };
150   };
151
152   struct TextFitInfo
153   {
154     enum Property
155     {
156       TEXT_FIT_ENABLE,
157       TEXT_FIT_MIN_SIZE,
158       TEXT_FIT_MAX_SIZE,
159       TEXT_FIT_STEP_SIZE,
160       TEXT_FIT_FONT_SIZE_TYPE
161     };
162   };
163
164 public: // Constructor.
165   /**
166    * @brief Create a new instance of a Controller.
167    *
168    * @return A pointer to a new Controller.
169    */
170   static ControllerPtr New();
171
172   /**
173    * @brief Create a new instance of a Controller.
174    *
175    * @param[in] controlInterface The control's interface.
176    *
177    * @return A pointer to a new Controller.
178    */
179   static ControllerPtr New(ControlInterface* controlInterface);
180
181   /**
182    * @brief Create a new instance of a Controller.
183    *
184    * @param[in] controlInterface The control's interface.
185    * @param[in] editableControlInterface The editable control's interface.
186    * @param[in] selectableControlInterface The selectable control's interface.
187    *
188    * @return A pointer to a new Controller.
189    */
190   static ControllerPtr New(ControlInterface*           controlInterface,
191                            EditableControlInterface*   editableControlInterface,
192                            SelectableControlInterface* selectableControlInterface);
193
194 public: // Configure the text controller.
195   /**
196    * @brief Called to enable text input.
197    *
198    * @note Selectable or editable controls should call this once after Controller::New().
199    * @param[in] decorator Used to create cursor, selection handle decorations etc.
200    * @param[in] inputMethodContext Used to manager ime.
201    */
202   void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
203
204   /**
205    * @brief Used to switch between bitmap & vector based glyphs
206    *
207    * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
208    */
209   void SetGlyphType(TextAbstraction::GlyphType glyphType);
210
211   /**
212    * @brief Enables/disables the mark-up processor.
213    *
214    * By default is disabled.
215    *
216    * @param[in] enable Whether to enable the mark-up processor.
217    */
218   void SetMarkupProcessorEnabled(bool enable);
219
220   /**
221    * @brief Retrieves whether the mark-up processor is enabled.
222    *
223    * By default is disabled.
224    *
225    * @return @e true if the mark-up processor is enabled, otherwise returns @e false.
226    */
227   bool IsMarkupProcessorEnabled() const;
228
229   /**
230    * @brief Enables/disables the auto text scrolling
231    *
232    * By default is disabled.
233    *
234    * @param[in] enable Whether to enable the auto scrolling
235    */
236   void SetAutoScrollEnabled(bool enable);
237
238   /**
239    * @brief Retrieves whether auto text scrolling is enabled.
240    *
241    * By default is disabled.
242    *
243    * @return @e true if auto scrolling is enabled, otherwise returns @e false.
244    */
245   bool IsAutoScrollEnabled() const;
246
247   /**
248    * @brief Get direction of the text from the first line of text,
249    * @return bool rtl (right to left) is true
250    */
251   CharacterDirection GetAutoScrollDirection() const;
252
253   /**
254    * @brief Get the alignment offset of the first line of text.
255    *
256    * @return The alignment offset.
257    */
258   float GetAutoScrollLineAlignment() const;
259
260   /**
261    * @brief Enables the horizontal scrolling.
262    *
263    * @param[in] enable Whether to enable the horizontal scrolling.
264    */
265   void SetHorizontalScrollEnabled(bool enable);
266
267   /**
268    * @brief Retrieves whether the horizontal scrolling is enabled.
269    *
270    * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
271    */
272   bool IsHorizontalScrollEnabled() const;
273
274   /**
275    * @brief Enables the vertical scrolling.
276    *
277    * @param[in] enable Whether to enable the vertical scrolling.
278    */
279   void SetVerticalScrollEnabled(bool enable);
280
281   /**
282    * @brief Retrieves whether the verticall scrolling is enabled.
283    *
284    * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
285    */
286   bool IsVerticalScrollEnabled() const;
287
288   /**
289    * @brief Enables the smooth handle panning.
290    *
291    * @param[in] enable Whether to enable the smooth handle panning.
292    */
293   void SetSmoothHandlePanEnabled(bool enable);
294
295   /**
296    * @brief Retrieves whether the smooth handle panning is enabled.
297    *
298    * @return @e true if the smooth handle panning is enabled.
299    */
300   bool IsSmoothHandlePanEnabled() const;
301
302   /**
303    * @brief Sets the maximum number of characters that can be inserted into the TextModel
304    *
305    * @param[in] maxCharacters maximum number of characters to be accepted
306    */
307   void SetMaximumNumberOfCharacters(Length maxCharacters);
308
309   /**
310    * @brief Sets the maximum number of characters that can be inserted into the TextModel
311    *
312    * @param[in] maxCharacters maximum number of characters to be accepted
313    */
314   int GetMaximumNumberOfCharacters();
315
316   /**
317    * @brief Called to enable/disable cursor blink.
318    *
319    * @note Only editable controls should calls this.
320    * @param[in] enabled Whether the cursor should blink or not.
321    */
322   void SetEnableCursorBlink(bool enable);
323
324   /**
325    * @brief Query whether cursor blink is enabled.
326    *
327    * @return Whether the cursor should blink or not.
328    */
329   bool GetEnableCursorBlink() const;
330
331   /**
332    * @brief Whether to enable the multi-line layout.
333    *
334    * @param[in] enable \e true enables the multi-line (by default)
335    */
336   void SetMultiLineEnabled(bool enable);
337
338   /**
339    * @return Whether the multi-line layout is enabled.
340    */
341   bool IsMultiLineEnabled() const;
342
343   /**
344    * @brief Sets the text's horizontal alignment.
345    *
346    * @param[in] alignment The horizontal alignment.
347    */
348   void SetHorizontalAlignment(HorizontalAlignment::Type alignment);
349
350   /**
351    * @copydoc ModelInterface::GetHorizontalAlignment()
352    */
353   HorizontalAlignment::Type GetHorizontalAlignment() const;
354
355   /**
356    * @brief Sets the text's vertical alignment.
357    *
358    * @param[in] alignment The vertical alignment.
359    */
360   void SetVerticalAlignment(VerticalAlignment::Type alignment);
361
362   /**
363    * @copydoc ModelInterface::GetVerticalAlignment()
364    */
365   VerticalAlignment::Type GetVerticalAlignment() const;
366
367   /**
368    * @brief Sets the text's wrap mode
369    * @param[in] text wrap mode The unit of wrapping
370    */
371   void SetLineWrapMode(Text::LineWrap::Mode textWarpMode);
372
373   /**
374    * @brief Retrieve text wrap mode previously set.
375    * @return text wrap mode
376    */
377   Text::LineWrap::Mode GetLineWrapMode() const;
378
379   /**
380    * @brief Enable or disable the text elide.
381    *
382    * @param[in] enabled Whether to enable the text elide.
383    */
384   void SetTextElideEnabled(bool enabled);
385
386   /**
387    * @copydoc ModelInterface::IsTextElideEnabled()
388    */
389   bool IsTextElideEnabled() const;
390
391   /**
392    * @brief Enable or disable the text fit.
393    *
394    * @param[in] enabled Whether to enable the text fit.
395    */
396   void SetTextFitEnabled(bool enabled);
397
398   /**
399    * @brief Whether the text fit is enabled or not.
400    *
401    * @return True if the text fit is enabled
402    */
403   bool IsTextFitEnabled() const;
404
405   /**
406    * @brief Sets minimum size valid for text fit.
407    *
408    * @param[in] minimum size value.
409    * @param[in] type The font size type is point size or pixel size
410    */
411   void SetTextFitMinSize(float pointSize, FontSizeType type);
412
413   /**
414    * @brief Retrieves the minimum point size valid for text fit.
415    *
416    * @return The minimum point size valid for text fit
417    */
418   float GetTextFitMinSize() const;
419
420   /**
421    * @brief Sets maximum size valid for text fit.
422    *
423    * @param[in] maximum size value.
424    * @param[in] type The font size type is point size or pixel size
425    */
426   void SetTextFitMaxSize(float pointSize, FontSizeType type);
427
428   /**
429    * @brief Retrieves the maximum point size valid for text fit.
430    *
431    * @return The maximum point size valid for text fit
432    */
433   float GetTextFitMaxSize() const;
434
435   /**
436    * @brief Sets step size for font increase valid for text fit.
437    *
438    * @param[in] step size value.
439    * @param[in] type The font size type is point size or pixel size
440    */
441   void SetTextFitStepSize(float step, FontSizeType type);
442
443   /**
444    * @brief Retrieves the step point size valid for text fit.
445    *
446    * @return The step point size valid for text fit
447    */
448   float GetTextFitStepSize() const;
449
450   /**
451    * @brief Sets content size valid for text fit.
452    *
453    * @param[in] Content size value.
454    */
455   void SetTextFitContentSize(Vector2 size);
456
457   /**
458    * @brief Retrieves the content size valid for text fit.
459    *
460    * @return The content size valid for text fit
461    */
462   Vector2 GetTextFitContentSize() const;
463
464   /**
465    * @brief Enable or disable the placeholder text elide.
466    * @param enabled Whether to enable the placeholder text elide.
467    */
468   void SetPlaceholderTextElideEnabled(bool enabled);
469
470   /**
471    * @brief Whether the placeholder text elide property is enabled.
472    * @return True if the placeholder text elide property is enabled, false otherwise.
473    */
474   bool IsPlaceholderTextElideEnabled() const;
475
476   /**
477    * @brief Enable or disable the text selection.
478    * @param[in] enabled Whether to enable the text selection.
479    */
480   void SetSelectionEnabled(bool enabled);
481
482   /**
483    * @brief Whether the text selection is enabled or not.
484    * @return True if the text selection is enabled
485    */
486   bool IsSelectionEnabled() const;
487
488   /**
489    * @brief Enable or disable the text selection using Shift key.
490    * @param enabled Whether to enable the text selection using Shift key
491    */
492   void SetShiftSelectionEnabled(bool enabled);
493
494   /**
495    * @brief Whether the text selection using Shift key is enabled or not.
496    * @return True if the text selection using Shift key is enabled
497    */
498   bool IsShiftSelectionEnabled() const;
499
500   /**
501    * @brief Enable or disable the grab handles for text selection.
502    *
503    * @param[in] enabled Whether to enable the grab handles
504    */
505   void SetGrabHandleEnabled(bool enabled);
506
507   /**
508    * @brief Returns whether the grab handles are enabled.
509    *
510    * @return True if the grab handles are enabled
511    */
512   bool IsGrabHandleEnabled() const;
513
514   /**
515    * @brief Enable or disable the grab handles for text selection.
516    *
517    * @param[in] enabled Whether to enable the grab handles
518    */
519   void SetGrabHandlePopupEnabled(bool enabled);
520
521   /**
522    * @brief Returns whether the grab handles are enabled.
523    *
524    * @return True if the grab handles are enabled
525    */
526   bool IsGrabHandlePopupEnabled() const;
527
528   /**
529    * @brief Sets input type to password
530    *
531    * @note The string is displayed hidden character
532    *
533    * @param[in] passwordInput True if password input is enabled.
534    */
535   void SetInputModePassword(bool passwordInput);
536
537   /**
538    * @brief Returns whether the input mode type is set as password.
539    *
540    * @return True if input mode type is password
541    */
542   bool IsInputModePassword();
543
544   /**
545    * @brief Sets the action when there is a double tap event on top of a text area with no text.
546    *
547    * @param[in] action The action to do.
548    */
549   void SetNoTextDoubleTapAction(NoTextTap::Action action);
550
551   /**
552    * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
553    *
554    * @return The action to do.
555    */
556   NoTextTap::Action GetNoTextDoubleTapAction() const;
557
558   /**
559    * @briefSets the action when there is a long press event on top of a text area with no text.
560    *
561    * @param[in] action The action to do.
562    */
563   void SetNoTextLongPressAction(NoTextTap::Action action);
564
565   /**
566    * @brief Retrieves the action when there is a long press event on top of a text area with no text.
567    *
568    * @return The action to do.
569    */
570   NoTextTap::Action GetNoTextLongPressAction() const;
571
572   /**
573    * @brief Query if Underline settings were provided by string or map
574    * @return bool true if set by string
575    */
576   bool IsUnderlineSetByString();
577
578   /**
579    * Set method underline setting were set by
580    * @param[in] bool, true if set by string
581    */
582   void UnderlineSetByString(bool setByString);
583
584   /**
585    * @brief Query if shadow settings were provided by string or map
586    * @return bool true if set by string
587    */
588   bool IsShadowSetByString();
589
590   /**
591    * Set method shadow setting were set by
592    * @param[in] bool, true if set by string
593    */
594   void ShadowSetByString(bool setByString);
595
596   /**
597    * @brief Query if outline settings were provided by string or map
598    * @return bool true if set by string
599    */
600   bool IsOutlineSetByString();
601
602   /**
603    * Set method outline setting were set by
604    * @param[in] bool, true if set by string
605    */
606   void OutlineSetByString(bool setByString);
607
608   /**
609    * @brief Query if font style settings were provided by string or map
610    * @return bool true if set by string
611    */
612   bool IsFontStyleSetByString();
613
614   /**
615    * Set method font style setting were set by
616    * @param[in] bool, true if set by string
617    */
618   void FontStyleSetByString(bool setByString);
619
620 public: // Update.
621   /**
622    * @brief Replaces any text previously set.
623    *
624    * @note This will be converted into UTF-32 when stored in the text model.
625    * @param[in] text A string of UTF-8 characters.
626    */
627   void SetText(const std::string& text);
628
629   /**
630    * @brief Retrieve any text previously set.
631    *
632    * @param[out] text A string of UTF-8 characters.
633    */
634   void GetText(std::string& text) const;
635
636   /**
637    * @brief Replaces any placeholder text previously set.
638    *
639    * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
640    * @param[in] text A string of UTF-8 characters.
641    */
642   void SetPlaceholderText(PlaceholderType type, const std::string& text);
643
644   /**
645    * @brief Retrieve any placeholder text previously set.
646    *
647    * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
648    * @param[out] A string of UTF-8 characters.
649    */
650   void GetPlaceholderText(PlaceholderType type, std::string& text) const;
651
652   /**
653    * @ brief Update the text after a font change
654    * @param[in] newDefaultFont The new font to change to
655    */
656   void UpdateAfterFontChange(const std::string& newDefaultFont);
657
658   /**
659    * @brief The method acquires currently selected text
660    * @param selectedText variable to place selected text in
661    */
662   void RetrieveSelection(std::string& selectedText) const;
663
664   /**
665    * @brief The method sets selection in given range
666    * @param start index of first character
667    * @param end   index of first character after selection
668    */
669   void SetSelection(int start, int end);
670
671   /**
672    * @brief This method retrieve indexes of current selection
673    *
674    * @return a pair, where first element is left index of selection and second is the right one
675    */
676   std::pair<int, int> GetSelectionIndexes() const;
677
678   /**
679    * Place string in system clipboard
680    * @param source std::string
681    */
682   void CopyStringToClipboard(const std::string& source);
683
684   /**
685    * Place currently selected text in system clipboard
686    * @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
687    */
688   void SendSelectionToClipboard(bool deleteAfterSending);
689
690 public: // Default style & Input style
691   /**
692    * @brief Set the default font family.
693    *
694    * @param[in] defaultFontFamily The default font family.
695    */
696   void SetDefaultFontFamily(const std::string& defaultFontFamily);
697
698   /**
699    * @brief Retrieve the default font family.
700    *
701    * @return The default font family.
702    */
703   const std::string& GetDefaultFontFamily() const;
704
705   /**
706    * @brief Sets the placeholder text font family.
707    * @param[in] placeholderTextFontFamily The placeholder text font family.
708    */
709   void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
710
711   /**
712    * @brief Retrieves the placeholder text font family.
713    *
714    * @return The placeholder text font family
715    */
716   const std::string& GetPlaceholderFontFamily() const;
717
718   /**
719    * @brief Sets the default font weight.
720    *
721    * @param[in] weight The font weight.
722    */
723   void SetDefaultFontWeight(FontWeight weight);
724
725   /**
726    * @brief Whether the font's weight has been defined.
727    */
728   bool IsDefaultFontWeightDefined() const;
729
730   /**
731    * @brief Retrieves the default font weight.
732    *
733    * @return The default font weight.
734    */
735   FontWeight GetDefaultFontWeight() const;
736
737   /**
738    * @brief Sets the placeholder text font weight.
739    *
740    * @param[in] weight The font weight
741    */
742   void SetPlaceholderTextFontWeight(FontWeight weight);
743
744   /**
745    * @brief Whether the font's weight has been defined.
746    *
747    * @return True if the placeholder text font weight is defined
748    */
749   bool IsPlaceholderTextFontWeightDefined() const;
750
751   /**
752    * @brief Retrieves the placeholder text font weight.
753    *
754    * @return The placeholder text font weight
755    */
756   FontWeight GetPlaceholderTextFontWeight() const;
757
758   /**
759    * @brief Sets the default font width.
760    *
761    * @param[in] width The font width.
762    */
763   void SetDefaultFontWidth(FontWidth width);
764
765   /**
766    * @brief Whether the font's width has been defined.
767    */
768   bool IsDefaultFontWidthDefined() const;
769
770   /**
771    * @brief Retrieves the default font width.
772    *
773    * @return The default font width.
774    */
775   FontWidth GetDefaultFontWidth() const;
776
777   /**
778    * @brief Sets the placeholder text font width.
779    *
780    * @param[in] width The font width
781    */
782   void SetPlaceholderTextFontWidth(FontWidth width);
783
784   /**
785    * @brief Whether the font's width has been defined.
786    *
787    * @return True if the placeholder text font width is defined
788    */
789   bool IsPlaceholderTextFontWidthDefined() const;
790
791   /**
792    * @brief Retrieves the placeholder text font width.
793    *
794    * @return The placeholder text font width
795    */
796   FontWidth GetPlaceholderTextFontWidth() const;
797
798   /**
799    * @brief Sets the default font slant.
800    *
801    * @param[in] slant The font slant.
802    */
803   void SetDefaultFontSlant(FontSlant slant);
804
805   /**
806    * @brief Whether the font's slant has been defined.
807    */
808   bool IsDefaultFontSlantDefined() const;
809
810   /**
811    * @brief Retrieves the default font slant.
812    *
813    * @return The default font slant.
814    */
815   FontSlant GetDefaultFontSlant() const;
816
817   /**
818    * @brief Sets the placeholder text font slant.
819    *
820    * @param[in] slant The font slant
821    */
822   void SetPlaceholderTextFontSlant(FontSlant slant);
823
824   /**
825    * @brief Whether the font's slant has been defined.
826    *
827    * @return True if the placeholder text font slant is defined
828    */
829   bool IsPlaceholderTextFontSlantDefined() const;
830
831   /**
832    * @brief Retrieves the placeholder text font slant.
833    *
834    * @return The placeholder text font slant
835    */
836   FontSlant GetPlaceholderTextFontSlant() const;
837
838   /**
839    * @brief Set the default font size.
840    *
841    * @param[in] fontSize The default font size
842    * @param[in] type The font size type is point size or pixel size
843    */
844   void SetDefaultFontSize(float fontSize, FontSizeType type);
845
846   /**
847    * @brief Retrieve the default point size.
848    *
849    * @param[in] type The font size type
850    * @return The default point size.
851    */
852   float GetDefaultFontSize(FontSizeType type) const;
853
854   /**
855    * @brief Set the font size scale.
856    *
857    * @param[in] scale The font size scale
858    */
859   void SetFontSizeScale(float scale);
860
861   /**
862    * @brief Get the font size scale.
863    *
864    * @return The font size scale.
865    */
866   float GetFontSizeScale() const;
867
868   /**
869    * @brief Sets the Placeholder text font size.
870    * @param[in] fontSize The placeholder text font size
871    * @param[in] type The font size type is point size or pixel size
872    */
873   void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
874
875   /**
876    * @brief Retrieves the Placeholder text font size.
877    * @param[in] type The font size type
878    * @return The placeholder font size
879    */
880   float GetPlaceholderTextFontSize(FontSizeType type) const;
881
882   /**
883    * @brief Sets the text's default color.
884    *
885    * @param color The default color.
886    */
887   void SetDefaultColor(const Vector4& color);
888
889   /**
890    * @brief Retrieves the text's default color.
891    *
892    * @return The default color.
893    */
894   const Vector4& GetDefaultColor() const;
895
896   /**
897    * @brief Set the text color
898    *
899    * @param textColor The text color
900    */
901   void SetPlaceholderTextColor(const Vector4& textColor);
902
903   /**
904    * @brief Retrieve the text color
905    *
906    * @return The text color
907    */
908   const Vector4& GetPlaceholderTextColor() const;
909
910   /**
911    * @brief Set the shadow offset.
912    *
913    * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
914    */
915   void SetShadowOffset(const Vector2& shadowOffset);
916
917   /**
918    * @brief Retrieve the shadow offset.
919    *
920    * @return The shadow offset.
921    */
922   const Vector2& GetShadowOffset() const;
923
924   /**
925    * @brief Set the shadow color.
926    *
927    * @param[in] shadowColor The shadow color.
928    */
929   void SetShadowColor(const Vector4& shadowColor);
930
931   /**
932    * @brief Retrieve the shadow color.
933    *
934    * @return The shadow color.
935    */
936   const Vector4& GetShadowColor() const;
937
938   /**
939    * @brief Set the shadow blur radius.
940    *
941    * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
942    */
943   void SetShadowBlurRadius(const float& shadowBlurRadius);
944
945   /**
946    * @brief Retrieve the shadow blur radius.
947    *
948    * @return The shadow blur radius.
949    */
950   const float& GetShadowBlurRadius() const;
951
952   /**
953    * @brief Set the underline color.
954    *
955    * @param[in] color color of underline.
956    */
957   void SetUnderlineColor(const Vector4& color);
958
959   /**
960    * @brief Retrieve the underline color.
961    *
962    * @return The underline color.
963    */
964   const Vector4& GetUnderlineColor() const;
965
966   /**
967    * @brief Set the underline enabled flag.
968    *
969    * @param[in] enabled The underline enabled flag.
970    */
971   void SetUnderlineEnabled(bool enabled);
972
973   /**
974    * @brief Returns whether the text is underlined or not.
975    *
976    * @return The underline state.
977    */
978   bool IsUnderlineEnabled() const;
979
980   /**
981    * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
982    *
983    * @param[in] height The height in pixels of the underline
984    */
985   void SetUnderlineHeight(float height);
986
987   /**
988    * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
989    *
990    * @return The height of the underline, or 0 if height is not overrided.
991    */
992   float GetUnderlineHeight() const;
993
994   /**
995    * @brief Set the outline color.
996    *
997    * @param[in] color color of outline.
998    */
999   void SetOutlineColor(const Vector4& color);
1000
1001   /**
1002    * @brief Retrieve the outline color.
1003    *
1004    * @return The outline color.
1005    */
1006   const Vector4& GetOutlineColor() const;
1007
1008   /**
1009    * @brief Set the outline width
1010    *
1011    * @param[in] width The width in pixels of the outline, 0 indicates no outline
1012    */
1013   void SetOutlineWidth(uint16_t width);
1014
1015   /**
1016    * @brief Retrieves the width of an outline
1017    *
1018    * @return The width of the outline.
1019    */
1020   uint16_t GetOutlineWidth() const;
1021
1022   /**
1023    * @brief Set the background color.
1024    *
1025    * @param[in] color color of background.
1026    */
1027   void SetBackgroundColor(const Vector4& color);
1028
1029   /**
1030    * @brief Retrieve the background color.
1031    *
1032    * @return The background color.
1033    */
1034   const Vector4& GetBackgroundColor() const;
1035
1036   /**
1037    * @brief Set the background enabled flag.
1038    *
1039    * @param[in] enabled The background enabled flag.
1040    */
1041   void SetBackgroundEnabled(bool enabled);
1042
1043   /**
1044    * @brief Returns whether to enable text background or not.
1045    *
1046    * @return Whether text background is enabled.
1047    */
1048   bool IsBackgroundEnabled() const;
1049
1050   /**
1051    * @brief Sets the emboss's properties string.
1052    *
1053    * @note The string is stored to be recovered.
1054    *
1055    * @param[in] embossProperties The emboss's properties string.
1056    */
1057   void SetDefaultEmbossProperties(const std::string& embossProperties);
1058
1059   /**
1060    * @brief Retrieves the emboss's properties string.
1061    *
1062    * @return The emboss's properties string.
1063    */
1064   const std::string& GetDefaultEmbossProperties() const;
1065
1066   /**
1067    * @brief Sets the outline's properties string.
1068    *
1069    * @note The string is stored to be recovered.
1070    *
1071    * @param[in] outlineProperties The outline's properties string.
1072    */
1073   void SetDefaultOutlineProperties(const std::string& outlineProperties);
1074
1075   /**
1076    * @brief Retrieves the outline's properties string.
1077    *
1078    * @return The outline's properties string.
1079    */
1080   const std::string& GetDefaultOutlineProperties() const;
1081
1082   /**
1083    * @brief Sets the default line spacing.
1084    *
1085    * @param[in] lineSpacing The line spacing.
1086    *
1087    * @return True if lineSpacing has been updated, false otherwise
1088    */
1089   bool SetDefaultLineSpacing(float lineSpacing);
1090
1091   /**
1092    * @brief Retrieves the default line spacing.
1093    *
1094    * @return The line spacing.
1095    */
1096   float GetDefaultLineSpacing() const;
1097
1098   /**
1099    * @brief Sets the default line size.
1100    *
1101    * @param[in] lineSize The line size.
1102    *
1103    * @return True if lineSize has been updated, false otherwise
1104    */
1105   bool SetDefaultLineSize(float lineSize);
1106
1107   /**
1108    * @brief Retrieves the default line size.
1109    *
1110    * @return The line size.
1111    */
1112   float GetDefaultLineSize() const;
1113
1114   /**
1115    * @brief Sets the input text's color.
1116    *
1117    * @param[in] color The input text's color.
1118    */
1119   void SetInputColor(const Vector4& color);
1120
1121   /**
1122    * @brief Retrieves the input text's color.
1123    *
1124    * @return The input text's color.
1125    */
1126   const Vector4& GetInputColor() const;
1127
1128   /**
1129    * @brief Sets the input text's font family name.
1130    *
1131    * @param[in] fontFamily The text's font family name.
1132    */
1133   void SetInputFontFamily(const std::string& fontFamily);
1134
1135   /**
1136    * @brief Retrieves the input text's font family name.
1137    *
1138    * @return The input text's font family name.
1139    */
1140   const std::string& GetInputFontFamily() const;
1141
1142   /**
1143    * @brief Sets the input font's weight.
1144    *
1145    * @param[in] weight The input font's weight.
1146    */
1147   void SetInputFontWeight(FontWeight weight);
1148
1149   /**
1150    * @return Whether the font's weight has been defined.
1151    */
1152   bool IsInputFontWeightDefined() const;
1153
1154   /**
1155    * @brief Retrieves the input font's weight.
1156    *
1157    * @return The input font's weight.
1158    */
1159   FontWeight GetInputFontWeight() const;
1160
1161   /**
1162    * @brief Sets the input font's width.
1163    *
1164    * @param[in] width The input font's width.
1165    */
1166   void SetInputFontWidth(FontWidth width);
1167
1168   /**
1169    * @return Whether the font's width has been defined.
1170    */
1171   bool IsInputFontWidthDefined() const;
1172
1173   /**
1174    * @brief Retrieves the input font's width.
1175    *
1176    * @return The input font's width.
1177    */
1178   FontWidth GetInputFontWidth() const;
1179
1180   /**
1181    * @brief Sets the input font's slant.
1182    *
1183    * @param[in] slant The input font's slant.
1184    */
1185   void SetInputFontSlant(FontSlant slant);
1186
1187   /**
1188    * @return Whether the font's slant has been defined.
1189    */
1190   bool IsInputFontSlantDefined() const;
1191
1192   /**
1193    * @brief Retrieves the input font's slant.
1194    *
1195    * @return The input font's slant.
1196    */
1197   FontSlant GetInputFontSlant() const;
1198
1199   /**
1200    * @brief Sets the input font's point size.
1201    *
1202    * @param[in] size The input font's point size.
1203    */
1204   void SetInputFontPointSize(float size);
1205
1206   /**
1207    * @brief Retrieves the input font's point size.
1208    *
1209    * @return The input font's point size.
1210    */
1211   float GetInputFontPointSize() const;
1212
1213   /**
1214    * @brief Sets the input line spacing.
1215    *
1216    * @param[in] lineSpacing The line spacing.
1217    */
1218   void SetInputLineSpacing(float lineSpacing);
1219
1220   /**
1221    * @brief Retrieves the input line spacing.
1222    *
1223    * @return The line spacing.
1224    */
1225   float GetInputLineSpacing() const;
1226
1227   /**
1228    * @brief Sets the input shadow's properties string.
1229    *
1230    * @note The string is stored to be recovered.
1231    *
1232    * @param[in] shadowProperties The shadow's properties string.
1233    */
1234   void SetInputShadowProperties(const std::string& shadowProperties);
1235
1236   /**
1237    * @brief Retrieves the input shadow's properties string.
1238    *
1239    * @return The shadow's properties string.
1240    */
1241   const std::string& GetInputShadowProperties() const;
1242
1243   /**
1244    * @brief Sets the input underline's properties string.
1245    *
1246    * @note The string is stored to be recovered.
1247    *
1248    * @param[in] underlineProperties The underline's properties string.
1249    */
1250   void SetInputUnderlineProperties(const std::string& underlineProperties);
1251
1252   /**
1253    * @brief Retrieves the input underline's properties string.
1254    *
1255    * @return The underline's properties string.
1256    */
1257   const std::string& GetInputUnderlineProperties() const;
1258
1259   /**
1260    * @brief Sets the input emboss's properties string.
1261    *
1262    * @note The string is stored to be recovered.
1263    *
1264    * @param[in] embossProperties The emboss's properties string.
1265    */
1266   void SetInputEmbossProperties(const std::string& embossProperties);
1267
1268   /**
1269    * @brief Retrieves the input emboss's properties string.
1270    *
1271    * @return The emboss's properties string.
1272    */
1273   const std::string& GetInputEmbossProperties() const;
1274
1275   /**
1276    * @brief Sets input the outline's properties string.
1277    *
1278    * @note The string is stored to be recovered.
1279    *
1280    * @param[in] outlineProperties The outline's properties string.
1281    */
1282   void SetInputOutlineProperties(const std::string& outlineProperties);
1283
1284   /**
1285    * @brief Retrieves the input outline's properties string.
1286    *
1287    * @return The outline's properties string.
1288    */
1289   const std::string& GetInputOutlineProperties() const;
1290
1291   /**
1292    * @brief Set the control's interface.
1293    *
1294    * @param[in] controlInterface The control's interface.
1295    */
1296   void SetControlInterface(ControlInterface* controlInterface);
1297
1298 public: // Queries & retrieves.
1299   /**
1300    * @brief Return the layout engine.
1301    *
1302    * @return A reference to the layout engine.
1303    */
1304   Layout::Engine& GetLayoutEngine();
1305
1306   /**
1307    * @brief Return a view of the text.
1308    *
1309    * @return A reference to the view.
1310    */
1311   View& GetView();
1312
1313   /**
1314    * @copydoc Control::GetNaturalSize()
1315    */
1316   Vector3 GetNaturalSize();
1317
1318   /**
1319    * @copydoc Control::GetHeightForWidth()
1320    */
1321   float GetHeightForWidth(float width);
1322
1323   /**
1324    * @brief Calculates the point size for text for given layout()
1325    */
1326   void FitPointSizeforLayout(Size layoutSize);
1327
1328   /**
1329    * @brief Checks if the point size fits within the layout size.
1330    *
1331    * @return Whether the point size fits within the layout size.
1332    */
1333   bool CheckForTextFit(float pointSize, Size& layoutSize);
1334
1335   /**
1336    * @brief Retrieves the text's number of lines for a given width.
1337    * @param[in] width The width of the text's area.
1338    * @ return The number of lines.
1339    */
1340   int GetLineCount(float width);
1341
1342   /**
1343    * @brief Retrieves the text's model.
1344    *
1345    * @return A pointer to the text's model.
1346    */
1347   const ModelInterface* const GetTextModel() const;
1348
1349   /**
1350    * @brief Used to get scrolled distance by user input
1351    *
1352    * @return Distance from last scroll offset to new scroll offset
1353    */
1354   float GetScrollAmountByUserInput();
1355
1356   /**
1357    * @brief Get latest scroll amount, control size and layout size
1358    *
1359    * This method is used to get information of control's scroll
1360    * @param[out] scrollPosition The current scrolled position
1361    * @param[out] controlHeight The size of a UI control
1362    * @param[out] layoutHeight The size of a bounding box to layout text within.
1363    *
1364    * @return Whether the text scroll position is changed or not after last update.
1365    */
1366   bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
1367
1368   /**
1369    * @brief Used to set the hidden input option
1370    */
1371   void SetHiddenInputOption(const Property::Map& options);
1372
1373   /**
1374    * @brief Used to get the hidden input option
1375    */
1376   void GetHiddenInputOption(Property::Map& options);
1377
1378   /**
1379    * @brief Sets the Placeholder Properties.
1380    *
1381    * @param[in] map The placeholder property map
1382    */
1383   void SetPlaceholderProperty(const Property::Map& map);
1384
1385   /**
1386    * @brief Retrieves the Placeholder Property map.
1387    *
1388    * @param[out] map The property map
1389    */
1390   void GetPlaceholderProperty(Property::Map& map);
1391
1392   /**
1393    * @brief Checks text direction.
1394    * @return The text direction.
1395    */
1396   Toolkit::DevelText::TextDirection::Type GetTextDirection();
1397
1398   /**
1399    * @brief Retrieves vertical line alignment
1400    * @return The vertical line alignment
1401    */
1402   Toolkit::DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const;
1403
1404   /**
1405    * @brief Sets vertical line alignment
1406    * @param[in] alignment The vertical line alignment for the text
1407    */
1408   void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
1409
1410   /**
1411    * @brief Retrieves ignoreSpaceAfterText value from model
1412    * @return The value of ignoreSpaceAfterText
1413    */
1414   bool IsIgnoreSpacesAfterText() const;
1415
1416   /**
1417    * @brief Sets ignoreSpaceAfterText value to model
1418    * @param[in] ignore The value of ignoreSpacesAfterText for the text
1419    */
1420   void SetIgnoreSpacesAfterText(bool ignore);
1421
1422   /**
1423    * @brief Retrieves matchSystemLanguageDirection value from model
1424    * @return The value of matchSystemLanguageDirection
1425    */
1426   bool IsMatchSystemLanguageDirection() const;
1427
1428   /**
1429    * @brief Sets matchSystemLanguageDirection value to model
1430    * @param[in] match The value of matchSystemLanguageDirection for the text
1431    */
1432   void SetMatchSystemLanguageDirection(bool match);
1433
1434   /**
1435    * @brief Sets layoutDirection value
1436    * @param[in] layoutDirection The value of system language direction
1437    */
1438   void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
1439
1440   /**
1441    * @brief Retrieves if showing real text or not.
1442    * @return The value of showing real text.
1443    */
1444   bool IsShowingRealText() const;
1445
1446 public: // Relayout.
1447   /**
1448    * @brief Triggers a relayout which updates View (if necessary).
1449    *
1450    * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
1451    * @param[in] size A the size of a bounding box to layout text within.
1452    * @param[in] layoutDirection The direction of the system language.
1453    *
1454    * @return Whether the text model or decorations were updated.
1455    */
1456   UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
1457
1458   /**
1459    * @brief Request a relayout using the ControlInterface.
1460    */
1461   void RequestRelayout();
1462
1463 public: // Input style change signals.
1464   /**
1465    * @return Whether the queue of input style changed signals is empty.
1466    */
1467   bool IsInputStyleChangedSignalsQueueEmpty();
1468
1469   /**
1470    * @brief Process all pending input style changed signals.
1471    *
1472    * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
1473    * text controls. Text controls may send signals to state the input style has changed.
1474    */
1475   void ProcessInputStyleChangedSignals();
1476
1477 public: // Text-input Event Queuing.
1478   /**
1479    * @brief Called by editable UI controls when keyboard focus is gained.
1480    */
1481   void KeyboardFocusGainEvent();
1482
1483   /**
1484    * @brief Called by editable UI controls when focus is lost.
1485    */
1486   void KeyboardFocusLostEvent();
1487
1488   /**
1489    * @brief Called by editable UI controls when key events are received.
1490    *
1491    * @param[in] event The key event.
1492    * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1493    */
1494   bool KeyEvent(const Dali::KeyEvent& event);
1495
1496   /**
1497    * @brief Called by editable UI controls when a tap gesture occurs.
1498    * @param[in] tapCount The number of taps.
1499    * @param[in] x The x position relative to the top-left of the parent control.
1500    * @param[in] y The y position relative to the top-left of the parent control.
1501    */
1502   void TapEvent(unsigned int tapCount, float x, float y);
1503
1504   /**
1505    * @brief Called by editable UI controls when a pan gesture occurs.
1506    *
1507    * @param[in] state The state of the gesture.
1508    * @param[in] displacement This distance panned since the last pan gesture.
1509    */
1510   void PanEvent(GestureState state, const Vector2& displacement);
1511
1512   /**
1513    * @brief Called by editable UI controls when a long press gesture occurs.
1514    *
1515    * @param[in] state The state of the gesture.
1516    * @param[in] x The x position relative to the top-left of the parent control.
1517    * @param[in] y The y position relative to the top-left of the parent control.
1518    */
1519   void LongPressEvent(GestureState state, float x, float y);
1520
1521   /**
1522    * @brief Used to get the Primary cursor position.
1523    *
1524    * @return Primary cursor position.
1525    */
1526   CharacterIndex GetPrimaryCursorPosition() const;
1527
1528   /**
1529    * @brief Used to set the Primary cursor position.
1530    *
1531    * @param[in] index for the Primary cursor position.
1532    * @return[in] true if cursor position changed, false otherwise.
1533    */
1534   bool SetPrimaryCursorPosition(CharacterIndex index);
1535
1536   /**
1537    * @brief Creates a selection event.
1538    *
1539    * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1540    *
1541    * @param[in] x The x position relative to the top-left of the parent control.
1542    * @param[in] y The y position relative to the top-left of the parent control.
1543    * @param[in] selection type like the whole text is selected or unselected.
1544    */
1545   void SelectEvent(float x, float y, SelectionType selection);
1546
1547   /**
1548    * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
1549    */
1550   void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
1551
1552   /**
1553    * @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
1554    */
1555   Uint32Pair GetTextSelectionRange() const;
1556
1557   /**
1558    * @copydoc Text::SelectableControlInterface::SelectWholeText()
1559    */
1560   void SelectWholeText();
1561
1562   /**
1563    * @copydoc Text::SelectableControlInterface::SelectNone()
1564    */
1565   void SelectNone();
1566
1567   /**
1568    * @copydoc Text::SelectableControlInterface::GetSelectedText()
1569    */
1570   string GetSelectedText() const;
1571
1572   /**
1573    * @copydoc Text::EditableControlInterface::IsEditable()
1574    */
1575   virtual bool IsEditable() const;
1576
1577   /**
1578    * @copydoc Text::EditableControlInterface::SetEditable()
1579    */
1580   virtual void SetEditable(bool editable);
1581
1582   /**
1583    * @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
1584    */
1585   virtual void ScrollBy(Vector2 scroll);
1586
1587   /**
1588    * @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
1589    */
1590   float GetHorizontalScrollPosition();
1591
1592   /**
1593    * @copydoc Dali::Toolkit::Internal::TextEditor::GetVerticalScrollPosition()
1594    */
1595   float GetVerticalScrollPosition();
1596
1597   /**
1598    * @brief Event received from input method context
1599    *
1600    * @param[in] inputMethodContext The input method context.
1601    * @param[in] inputMethodContextEvent The event received.
1602    * @return A data struture indicating if update is needed, cursor position and current text.
1603    */
1604   InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
1605
1606   /**
1607    * @brief Event from Clipboard notifying an Item has been selected for pasting
1608    */
1609   void PasteClipboardItemEvent();
1610
1611   /**
1612    * @brief Return true when text control should clear key input focus when escape key is pressed.
1613    *
1614    * @return Whether text control should clear key input focus or not when escape key is pressed.
1615    */
1616   bool ShouldClearFocusOnEscape() const;
1617
1618   /**
1619    * @brief Create an actor that renders the text background color
1620    *
1621    * @return the created actor or an empty handle if no background color needs to be rendered.
1622    */
1623   Actor CreateBackgroundActor();
1624
1625   /**
1626    * @brief Used to reset the cursor position after setting a new text.
1627    *
1628    * @param[in] cursorIndex Where to place the cursor.
1629    */
1630   void ResetCursorPosition(CharacterIndex cursorIndex);
1631
1632   /**
1633    * @brief The method acquires current position of cursor
1634    * @return unsigned value with cursor position
1635    */
1636   CharacterIndex GetCursorPosition();
1637
1638 protected: // Inherit from Text::Decorator::ControllerInterface.
1639   /**
1640    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
1641    */
1642   void GetTargetSize(Vector2& targetSize) override;
1643
1644   /**
1645    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
1646    */
1647   void AddDecoration(Actor& actor, bool needsClipping) override;
1648
1649   /**
1650    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
1651    */
1652   void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
1653
1654 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
1655   /**
1656    * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
1657    */
1658   void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
1659
1660 protected: // Inherit from HiddenText.
1661   /**
1662    * @brief Invoked from HiddenText when showing time of the last character was expired
1663    */
1664   void DisplayTimeExpired() override;
1665
1666 private: // Update.
1667   /**
1668    * @brief Called by editable UI controls when key events are received.
1669    *
1670    * @param[in] text The text to insert.
1671    * @param[in] type Used to distinguish between regular key events and InputMethodContext events.
1672    */
1673   void InsertText(const std::string& text, InsertType type);
1674
1675   /**
1676    * @brief Paste given string into Text model
1677    * @param[in] stringToPaste this string will be inserted into the text model
1678    */
1679   void PasteText(const std::string& stringToPaste);
1680
1681   /**
1682    * @brief Remove a given number of characters
1683    *
1684    * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
1685    * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
1686    * style when pre-edit text is removed.
1687    *
1688    * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
1689    * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
1690    * @param[in] type Whether to update the input style.
1691    * @return True if the remove was successful.
1692    */
1693   bool RemoveText(int                  cursorOffset,
1694                   int                  numberOfCharacters,
1695                   UpdateInputStyleType type);
1696
1697   /**
1698    * @brief Checks if text is selected and if so removes it.
1699    * @return true if text was removed
1700    */
1701   bool RemoveSelectedText();
1702
1703 private: // Relayout.
1704   /**
1705    * @brief Lays-out the text.
1706    *
1707    * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
1708    *
1709    * @param[in] size A the size of a bounding box to layout text within.
1710    * @param[in] operations The layout operations which need to be done.
1711    * @param[out] layoutSize The size of the laid-out text.
1712    */
1713   bool DoRelayout(const Size&    size,
1714                   OperationsMask operations,
1715                   Size&          layoutSize);
1716
1717   /**
1718    * @brief Calulates the vertical offset to align the text inside the bounding box.
1719    *
1720    * @param[in] size The size of the bounding box.
1721    */
1722   void CalculateVerticalOffset(const Size& size);
1723
1724 private: // Events.
1725   /**
1726    * @brief Process queued events which modify the model.
1727    */
1728   void ProcessModifyEvents();
1729
1730   /**
1731    * @brief Used to process an event queued from SetText()
1732    */
1733   void TextReplacedEvent();
1734
1735   /**
1736    * @brief Used to process an event queued from key events etc.
1737    */
1738   void TextInsertedEvent();
1739
1740   /**
1741    * @brief Used to process an event queued from backspace key etc.
1742    */
1743   void TextDeletedEvent();
1744
1745   /**
1746    * @brief Helper to KeyEvent() to handle the backspace or delete key case.
1747    *
1748    * @param[in] keyCode The keycode for the key pressed
1749    * @return True if a character was deleted.
1750    */
1751   bool DeleteEvent(int keyCode);
1752
1753 private: // Helpers.
1754   /**
1755    * @brief Used to remove the text included the placeholder text.
1756    */
1757   void ResetText();
1758
1759   /**
1760    * @brief Helper to show the place holder text..
1761    */
1762   void ShowPlaceholderText();
1763
1764   /**
1765    * @brief Helper to clear font-specific data (only).
1766    */
1767   void ClearFontData();
1768
1769   /**
1770    * @brief Helper to clear text's style data.
1771    */
1772   void ClearStyleData();
1773
1774   /**
1775    * @brief Used to reset the scroll position after setting a new text.
1776    */
1777   void ResetScrollPosition();
1778
1779 private: // Private contructors & copy operator.
1780   /**
1781    * @brief Private constructor.
1782    */
1783   Controller();
1784
1785   /**
1786    * @brief Private constructor.
1787    */
1788   Controller(ControlInterface* controlInterface);
1789
1790   /**
1791    * @brief Private constructor.
1792    */
1793   Controller(ControlInterface*           controlInterface,
1794              EditableControlInterface*   editableControlInterface,
1795              SelectableControlInterface* selectableControlInterface);
1796
1797   // Undefined
1798   Controller(const Controller& handle);
1799
1800   // Undefined
1801   Controller& operator=(const Controller& handle);
1802
1803 protected: // Destructor.
1804   /**
1805    * @brief A reference counted object may only be deleted by calling Unreference().
1806    */
1807   virtual ~Controller();
1808
1809 public:
1810   struct Impl; ///< Made public for testing purposes
1811
1812 private:
1813   struct EventHandler;
1814   struct InputFontHandler;
1815   struct PlaceholderHandler;
1816   struct Relayouter;
1817   struct TextUpdater;
1818
1819   Impl* mImpl;
1820 };
1821
1822 } // namespace Text
1823
1824 } // namespace Toolkit
1825
1826 } // namespace Dali
1827
1828 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H