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