1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/adaptor-framework/imf-manager.h>
23 #include <dali/public-api/events/gesture.h>
26 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
27 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
28 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
29 #include <dali-toolkit/internal/text/text-model-interface.h>
41 class ControlInterface;
42 class EditableControlInterface;
44 class RenderingController;
46 typedef IntrusivePtr<Controller> ControllerPtr;
49 * @brief A Text Controller is used by UI Controls which display text.
51 * It manipulates the Logical & Visual text models on behalf of the UI Controls.
52 * It provides a view of the text that can be used by rendering back-ends.
54 * For selectable/editable UI controls, the controller handles input events from the UI control
55 * and decorations (grab handles etc) via the Decorator::ControllerInterface interface.
57 * The text selection popup button callbacks are as well handled via the TextSelectionPopupCallbackInterface interface.
59 class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface
61 public: // Enumerated types.
64 * @brief Text related operations to be done in the relayout process.
68 NO_OPERATION = 0x0000,
69 CONVERT_TO_UTF32 = 0x0001,
71 VALIDATE_FONTS = 0x0004,
72 GET_LINE_BREAKS = 0x0008,
73 GET_WORD_BREAKS = 0x0010,
76 GET_GLYPH_METRICS = 0x0080,
78 UPDATE_LAYOUT_SIZE = 0x0200,
82 UPDATE_DIRECTION = 0x2000,
83 ALL_OPERATIONS = 0xFFFF
87 * @brief Used to distinguish between regular key events and IMF events
96 * @brief Used to specify whether to update the input style.
98 enum UpdateInputStyleType
101 DONT_UPDATE_INPUT_STYLE
105 * @brief Used to specify what has been updated after the Relayout() method has been called.
109 NONE_UPDATED = 0x0, ///< Nothing has been updated.
110 MODEL_UPDATED = 0x1, ///< The text's model has been updated.
111 DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
115 * @brief Different placeholder-text can be shown when the control is active/inactive.
119 PLACEHOLDER_TYPE_ACTIVE,
120 PLACEHOLDER_TYPE_INACTIVE,
127 NO_ACTION, ///< Does no action if there is a tap on top of an area with no text.
128 HIGHLIGHT, ///< Highlights the nearest text (at the beginning or end of the text) and shows the text's selection popup.
129 SHOW_SELECTION_POPUP ///< Shows the text's selection popup.
133 public: // Constructor.
136 * @brief Create a new instance of a Controller.
138 * @return A pointer to a new Controller.
140 static ControllerPtr New();
143 * @brief Create a new instance of a Controller.
145 * @param[in] controlInterface The control's interface.
147 * @return A pointer to a new Controller.
149 static ControllerPtr New( ControlInterface* controlInterface );
152 * @brief Create a new instance of a Controller.
154 * @param[in] controlInterface The control's interface.
155 * @param[in] editableControlInterface The editable control's interface.
157 * @return A pointer to a new Controller.
159 static ControllerPtr New( ControlInterface* controlInterface,
160 EditableControlInterface* editableControlInterface );
162 public: // Configure the text controller.
165 * @brief Called to enable text input.
167 * @note Selectable or editable controls should call this once after Controller::New().
168 * @param[in] decorator Used to create cursor, selection handle decorations etc.
170 void EnableTextInput( DecoratorPtr decorator );
173 * @brief Used to switch between bitmap & vector based glyphs
175 * @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
177 void SetGlyphType( TextAbstraction::GlyphType glyphType );
180 * @brief Enables/disables the mark-up processor.
182 * By default is disabled.
184 * @param[in] enable Whether to enable the mark-up processor.
186 void SetMarkupProcessorEnabled( bool enable );
189 * @brief Retrieves whether the mark-up processor is enabled.
191 * By default is disabled.
193 * @return @e true if the mark-up processor is enabled, otherwise returns @e false.
195 bool IsMarkupProcessorEnabled() const;
198 * @brief Enables/disables the auto text scrolling
200 * By default is disabled.
202 * @param[in] enable Whether to enable the auto scrolling
204 void SetAutoScrollEnabled( bool enable );
207 * @brief Retrieves whether auto text scrolling is enabled.
209 * By default is disabled.
211 * @return @e true if auto scrolling is enabled, otherwise returns @e false.
213 bool IsAutoScrollEnabled() const;
216 * @brief Get direction of the text from the first line of text,
217 * @return bool rtl (right to left) is true
219 CharacterDirection GetAutoScrollDirection() const;
222 * @brief Get the alignment offset of the first line of text.
224 * @return The alignment offset.
226 float GetAutoScrollLineAlignment() const;
229 * @brief Enables the horizontal scrolling.
231 * @param[in] enable Whether to enable the horizontal scrolling.
233 void SetHorizontalScrollEnabled( bool enable );
236 * @brief Retrieves whether the horizontal scrolling is enabled.
238 * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
240 bool IsHorizontalScrollEnabled() const;
243 * @brief Enables the vertical scrolling.
245 * @param[in] enable Whether to enable the vertical scrolling.
247 void SetVerticalScrollEnabled( bool enable );
250 * @brief Retrieves whether the verticall scrolling is enabled.
252 * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
254 bool IsVerticalScrollEnabled() const;
257 * @brief Enables the smooth handle panning.
259 * @param[in] enable Whether to enable the smooth handle panning.
261 void SetSmoothHandlePanEnabled( bool enable );
264 * @brief Retrieves whether the smooth handle panning is enabled.
266 * @return @e true if the smooth handle panning is enabled.
268 bool IsSmoothHandlePanEnabled() const;
271 * @brief Sets the maximum number of characters that can be inserted into the TextModel
273 * @param[in] maxCharacters maximum number of characters to be accepted
275 void SetMaximumNumberOfCharacters( Length maxCharacters );
278 * @brief Sets the maximum number of characters that can be inserted into the TextModel
280 * @param[in] maxCharacters maximum number of characters to be accepted
282 int GetMaximumNumberOfCharacters();
285 * @brief Called to enable/disable cursor blink.
287 * @note Only editable controls should calls this.
288 * @param[in] enabled Whether the cursor should blink or not.
290 void SetEnableCursorBlink( bool enable );
293 * @brief Query whether cursor blink is enabled.
295 * @return Whether the cursor should blink or not.
297 bool GetEnableCursorBlink() const;
300 * @brief Whether to enable the multi-line layout.
302 * @param[in] enable \e true enables the multi-line (by default)
304 void SetMultiLineEnabled( bool enable );
307 * @return Whether the multi-line layout is enabled.
309 bool IsMultiLineEnabled() const;
312 * @brief Sets the text's horizontal alignment.
314 * @param[in] alignment The horizontal alignment.
316 void SetHorizontalAlignment( Layout::HorizontalAlignment alignment );
319 * @copydoc ModelInterface::GetHorizontalAlignment()
321 Layout::HorizontalAlignment GetHorizontalAlignment() const;
324 * @brief Sets the text's vertical alignment.
326 * @param[in] alignment The vertical alignment.
328 void SetVerticalAlignment( Layout::VerticalAlignment alignment );
331 * @copydoc ModelInterface::GetVerticalAlignment()
333 Layout::VerticalAlignment GetVerticalAlignment() const;
336 * @brief Enable or disable the text elide.
338 * @param[in] enabled Whether to enable the text elide.
340 void SetTextElideEnabled( bool enabled );
343 * @copydoc ModelInterface::IsTextElideEnabled()
345 bool IsTextElideEnabled() const;
348 * @brief Sets input type to password
350 * @note The string is displayed continuous "*"
352 * @param[in] passwordInput True if password input is enabled.
354 void SetInputModePassword( bool passwordInput );
357 * @brief Returns whether the input mode type is set as password.
359 * @return True if input mode type is password
361 bool IsInputModePassword();
364 * @brief Sets the action when there is a double tap event on top of a text area with no text.
366 * @param[in] action The action to do.
368 void SetNoTextDoubleTapAction( NoTextTap::Action action );
371 * @brief Retrieves the action when there is a double tap event on top of a text area with no text.
373 * @return The action to do.
375 NoTextTap::Action GetNoTextDoubleTapAction() const;
378 * @briefSets the action when there is a long press event on top of a text area with no text.
380 * @param[in] action The action to do.
382 void SetNoTextLongPressAction( NoTextTap::Action action );
385 * @brief Retrieves the action when there is a long press event on top of a text area with no text.
387 * @return The action to do.
389 NoTextTap::Action GetNoTextLongPressAction() const;
394 * @brief Replaces any text previously set.
396 * @note This will be converted into UTF-32 when stored in the text model.
397 * @param[in] text A string of UTF-8 characters.
399 void SetText( const std::string& text );
402 * @brief Retrieve any text previously set.
404 * @param[out] text A string of UTF-8 characters.
406 void GetText( std::string& text ) const;
409 * @brief Replaces any placeholder text previously set.
411 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
412 * @param[in] text A string of UTF-8 characters.
414 void SetPlaceholderText( PlaceholderType type, const std::string& text );
417 * @brief Retrieve any placeholder text previously set.
419 * @param[in] type Different placeholder-text can be shown when the control is active/inactive.
420 * @param[out] A string of UTF-8 characters.
422 void GetPlaceholderText( PlaceholderType type, std::string& text ) const;
425 * @ brief Update the text after a font change
426 * @param[in] newDefaultFont The new font to change to
428 void UpdateAfterFontChange( const std::string& newDefaultFont );
430 public: // Default style & Input style
433 * @brief Set the default font family.
435 * @param[in] defaultFontFamily The default font family.
437 void SetDefaultFontFamily( const std::string& defaultFontFamily );
440 * @brief Retrieve the default font family.
442 * @return The default font family.
444 const std::string& GetDefaultFontFamily() const;
447 * @brief Sets the default font weight.
449 * @param[in] weight The font weight.
451 void SetDefaultFontWeight( FontWeight weight );
454 * @brief Whether the font's weight has been defined.
456 bool IsDefaultFontWeightDefined() const;
459 * @brief Retrieves the default font weight.
461 * @return The default font weight.
463 FontWeight GetDefaultFontWeight() const;
466 * @brief Sets the default font width.
468 * @param[in] width The font width.
470 void SetDefaultFontWidth( FontWidth width );
473 * @brief Whether the font's width has been defined.
475 bool IsDefaultFontWidthDefined() const;
478 * @brief Retrieves the default font width.
480 * @return The default font width.
482 FontWidth GetDefaultFontWidth() const;
485 * @brief Sets the default font slant.
487 * @param[in] slant The font slant.
489 void SetDefaultFontSlant( FontSlant slant );
492 * @brief Whether the font's slant has been defined.
494 bool IsDefaultFontSlantDefined() const;
497 * @brief Retrieves the default font slant.
499 * @return The default font slant.
501 FontSlant GetDefaultFontSlant() const;
504 * @brief Set the default point size.
506 * @param[in] pointSize The default point size.
508 void SetDefaultPointSize( float pointSize );
511 * @brief Retrieve the default point size.
513 * @return The default point size.
515 float GetDefaultPointSize() const;
518 * @brief Sets the text's default color.
520 * @param color The default color.
522 void SetDefaultColor( const Vector4& color );
525 * @brief Retrieves the text's default color.
527 * @return The default color.
529 const Vector4& GetDefaultColor() const;
532 * @brief Set the text color
534 * @param textColor The text color
536 void SetPlaceholderTextColor( const Vector4& textColor );
539 * @brief Retrieve the text color
541 * @return The text color
543 const Vector4& GetPlaceholderTextColor() const;
546 * @brief Set the shadow offset.
548 * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
550 void SetShadowOffset( const Vector2& shadowOffset );
553 * @brief Retrieve the shadow offset.
555 * @return The shadow offset.
557 const Vector2& GetShadowOffset() const;
560 * @brief Set the shadow color.
562 * @param[in] shadowColor The shadow color.
564 void SetShadowColor( const Vector4& shadowColor );
567 * @brief Retrieve the shadow color.
569 * @return The shadow color.
571 const Vector4& GetShadowColor() const;
574 * @brief Set the underline color.
576 * @param[in] color color of underline.
578 void SetUnderlineColor( const Vector4& color );
581 * @brief Retrieve the underline color.
583 * @return The underline color.
585 const Vector4& GetUnderlineColor() const;
588 * @brief Set the underline enabled flag.
590 * @param[in] enabled The underline enabled flag.
592 void SetUnderlineEnabled( bool enabled );
595 * @brief Returns whether the text is underlined or not.
597 * @return The underline state.
599 bool IsUnderlineEnabled() const;
602 * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
604 * @param[in] height The height in pixels of the underline
606 void SetUnderlineHeight( float height );
609 * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
611 * @return The height of the underline, or 0 if height is not overrided.
613 float GetUnderlineHeight() const;
616 * @brief Sets the emboss's properties string.
618 * @note The string is stored to be recovered.
620 * @param[in] embossProperties The emboss's properties string.
622 void SetDefaultEmbossProperties( const std::string& embossProperties );
625 * @brief Retrieves the emboss's properties string.
627 * @return The emboss's properties string.
629 const std::string& GetDefaultEmbossProperties() const;
632 * @brief Sets the outline's properties string.
634 * @note The string is stored to be recovered.
636 * @param[in] outlineProperties The outline's properties string.
638 void SetDefaultOutlineProperties( const std::string& outlineProperties );
641 * @brief Retrieves the outline's properties string.
643 * @return The outline's properties string.
645 const std::string& GetDefaultOutlineProperties() const;
648 * @brief Sets the default line spacing.
650 * @param[in] lineSpacing The line spacing.
652 void SetDefaultLineSpacing( float lineSpacing );
655 * @brief Retrieves the default line spacing.
657 * @return The line spacing.
659 float GetDefaultLineSpacing() const;
662 * @brief Sets the input text's color.
664 * @param[in] color The input text's color.
666 void SetInputColor( const Vector4& color );
669 * @brief Retrieves the input text's color.
671 * @return The input text's color.
673 const Vector4& GetInputColor() const;
676 * @brief Sets the input text's font family name.
678 * @param[in] fontFamily The text's font family name.
680 void SetInputFontFamily( const std::string& fontFamily );
683 * @brief Retrieves the input text's font family name.
685 * @return The input text's font family name.
687 const std::string& GetInputFontFamily() const;
690 * @brief Sets the input font's weight.
692 * @param[in] weight The input font's weight.
694 void SetInputFontWeight( FontWeight weight );
697 * @return Whether the font's weight has been defined.
699 bool IsInputFontWeightDefined() const;
702 * @brief Retrieves the input font's weight.
704 * @return The input font's weight.
706 FontWeight GetInputFontWeight() const;
709 * @brief Sets the input font's width.
711 * @param[in] width The input font's width.
713 void SetInputFontWidth( FontWidth width );
716 * @return Whether the font's width has been defined.
718 bool IsInputFontWidthDefined() const;
721 * @brief Retrieves the input font's width.
723 * @return The input font's width.
725 FontWidth GetInputFontWidth() const;
728 * @brief Sets the input font's slant.
730 * @param[in] slant The input font's slant.
732 void SetInputFontSlant( FontSlant slant );
735 * @return Whether the font's slant has been defined.
737 bool IsInputFontSlantDefined() const;
740 * @brief Retrieves the input font's slant.
742 * @return The input font's slant.
744 FontSlant GetInputFontSlant() const;
747 * @brief Sets the input font's point size.
749 * @param[in] size The input font's point size.
751 void SetInputFontPointSize( float size );
754 * @brief Retrieves the input font's point size.
756 * @return The input font's point size.
758 float GetInputFontPointSize() const;
761 * @brief Sets the input line spacing.
763 * @param[in] lineSpacing The line spacing.
765 void SetInputLineSpacing( float lineSpacing );
768 * @brief Retrieves the input line spacing.
770 * @return The line spacing.
772 float GetInputLineSpacing() const;
775 * @brief Sets the input shadow's properties string.
777 * @note The string is stored to be recovered.
779 * @param[in] shadowProperties The shadow's properties string.
781 void SetInputShadowProperties( const std::string& shadowProperties );
784 * @brief Retrieves the input shadow's properties string.
786 * @return The shadow's properties string.
788 const std::string& GetInputShadowProperties() const;
791 * @brief Sets the input underline's properties string.
793 * @note The string is stored to be recovered.
795 * @param[in] underlineProperties The underline's properties string.
797 void SetInputUnderlineProperties( const std::string& underlineProperties );
800 * @brief Retrieves the input underline's properties string.
802 * @return The underline's properties string.
804 const std::string& GetInputUnderlineProperties() const;
807 * @brief Sets the input emboss's properties string.
809 * @note The string is stored to be recovered.
811 * @param[in] embossProperties The emboss's properties string.
813 void SetInputEmbossProperties( const std::string& embossProperties );
816 * @brief Retrieves the input emboss's properties string.
818 * @return The emboss's properties string.
820 const std::string& GetInputEmbossProperties() const;
823 * @brief Sets input the outline's properties string.
825 * @note The string is stored to be recovered.
827 * @param[in] outlineProperties The outline's properties string.
829 void SetInputOutlineProperties( const std::string& outlineProperties );
832 * @brief Retrieves the input outline's properties string.
834 * @return The outline's properties string.
836 const std::string& GetInputOutlineProperties() const;
838 public: // Queries & retrieves.
841 * @brief Return the layout engine.
843 * @return A reference to the layout engine.
845 Layout::Engine& GetLayoutEngine();
848 * @brief Return a view of the text.
850 * @return A reference to the view.
855 * @copydoc Control::GetNaturalSize()
857 Vector3 GetNaturalSize();
860 * @copydoc Control::GetHeightForWidth()
862 float GetHeightForWidth( float width );
865 * @brief Retrieves the text's model.
867 * @return A pointer to the text's model.
869 const ModelInterface* const GetTextModel() const;
872 * @brief Used to get scrolled distance by user input
874 * @return Distance from last scroll offset to new scroll offset
876 float GetScrollAmountByUserInput();
879 * @brief Get latest scroll amount, control size and layout size
881 * This method is used to get information of control's scroll
882 * @param[out] scrollPosition The current scrolled position
883 * @param[out] controlHeight The size of a UI control
884 * @param[out] layoutHeight The size of a bounding box to layout text within.
886 * @return Whether the text scroll position is changed or not after last update.
888 bool GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight );
893 * @brief Triggers a relayout which updates View (if necessary).
895 * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
896 * @param[in] size A the size of a bounding box to layout text within.
898 * @return Whether the text model or decorations were updated.
900 UpdateTextType Relayout( const Size& size );
903 * @brief Request a relayout using the ControlInterface.
905 void RequestRelayout();
907 public: // Input style change signals.
910 * @return Whether the queue of input style changed signals is empty.
912 bool IsInputStyleChangedSignalsQueueEmpty();
915 * @brief Process all pending input style changed signals.
917 * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
918 * text controls. Text controls may send signals to state the input style has changed.
920 void ProcessInputStyleChangedSignals();
922 public: // Text-input Event Queuing.
925 * @brief Called by editable UI controls when keyboard focus is gained.
927 void KeyboardFocusGainEvent();
930 * @brief Called by editable UI controls when focus is lost.
932 void KeyboardFocusLostEvent();
935 * @brief Called by editable UI controls when key events are received.
937 * @param[in] event The key event.
938 * @param[in] type Used to distinguish between regular key events and IMF events.
940 bool KeyEvent( const Dali::KeyEvent& event );
943 * @brief Called by editable UI controls when a tap gesture occurs.
944 * @param[in] tapCount The number of taps.
945 * @param[in] x The x position relative to the top-left of the parent control.
946 * @param[in] y The y position relative to the top-left of the parent control.
948 void TapEvent( unsigned int tapCount, float x, float y );
951 * @brief Called by editable UI controls when a pan gesture occurs.
953 * @param[in] state The state of the gesture.
954 * @param[in] displacement This distance panned since the last pan gesture.
956 void PanEvent( Gesture::State state, const Vector2& displacement );
959 * @brief Called by editable UI controls when a long press gesture occurs.
961 * @param[in] state The state of the gesture.
962 * @param[in] x The x position relative to the top-left of the parent control.
963 * @param[in] y The y position relative to the top-left of the parent control.
965 void LongPressEvent( Gesture::State state, float x, float y );
968 * @brief Event received from IMF manager
970 * @param[in] imfManager The IMF manager.
971 * @param[in] imfEvent The event received.
972 * @return A data struture indicating if update is needed, cursor position and current text.
974 ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
977 * @brief Event from Clipboard notifying an Item has been selected for pasting
979 void PasteClipboardItemEvent();
981 protected: // Inherit from Text::Decorator::ControllerInterface.
984 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
986 virtual void GetTargetSize( Vector2& targetSize );
989 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
991 virtual void AddDecoration( Actor& actor, bool needsClipping );
994 * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
996 virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
998 protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
1001 * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
1003 virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
1008 * @brief Called by editable UI controls when key events are received.
1010 * @param[in] text The text to insert.
1011 * @param[in] type Used to distinguish between regular key events and IMF events.
1013 void InsertText( const std::string& text, InsertType type );
1016 * @brief Paste given string into Text model
1017 * @param[in] stringToPaste this string will be inserted into the text model
1019 void PasteText( const std::string& stringToPaste );
1022 * @brief Remove a given number of characters
1024 * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
1025 * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
1026 * style when pre-edit text is removed.
1028 * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
1029 * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
1030 * @param[in] type Whether to update the input style.
1031 * @return True if the remove was successful.
1033 bool RemoveText( int cursorOffset,
1034 int numberOfCharacters,
1035 UpdateInputStyleType type );
1038 * @brief Checks if text is selected and if so removes it.
1039 * @return true if text was removed
1041 bool RemoveSelectedText();
1043 private: // Relayout.
1046 * @brief Lays-out the text.
1048 * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
1050 * @param[in] size A the size of a bounding box to layout text within.
1051 * @param[in] operations The layout operations which need to be done.
1052 * @param[out] layoutSize The size of the laid-out text.
1054 bool DoRelayout( const Size& size,
1055 OperationsMask operations,
1059 * @brief Calulates the vertical offset to align the text inside the bounding box.
1061 * @param[in] size The size of the bounding box.
1063 void CalculateVerticalOffset( const Size& size );
1068 * @brief Process queued events which modify the model.
1070 void ProcessModifyEvents();
1073 * @brief Used to process an event queued from SetText()
1075 void TextReplacedEvent();
1078 * @brief Used to process an event queued from key events etc.
1080 void TextInsertedEvent();
1083 * @brief Used to process an event queued from backspace key etc.
1085 void TextDeletedEvent();
1088 * @brief Creates a selection event.
1090 * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
1092 * @param[in] x The x position relative to the top-left of the parent control.
1093 * @param[in] y The y position relative to the top-left of the parent control.
1094 * @param[in] selectAll Whether the whole text is selected.
1096 void SelectEvent( float x, float y, bool selectAll );
1099 * @brief Helper to KeyEvent() to handle the backspace case.
1101 * @return True if a character was deleted.
1103 bool BackspaceKeyEvent();
1105 private: // Helpers.
1108 * @brief Used to remove the text included the placeholder text.
1113 * @brief Helper to show the place holder text..
1115 void ShowPlaceholderText();
1118 * @brief Helper to clear font-specific data (only).
1120 void ClearFontData();
1123 * @brief Helper to clear text's style data.
1125 void ClearStyleData();
1128 * @brief Used to reset the cursor position after setting a new text.
1130 * @param[in] cursorIndex Where to place the cursor.
1132 void ResetCursorPosition( CharacterIndex cursorIndex );
1135 * @brief Used to reset the scroll position after setting a new text.
1137 void ResetScrollPosition();
1139 private: // Private contructors & copy operator.
1142 * @brief Private constructor.
1147 * @brief Private constructor.
1149 Controller( ControlInterface* controlInterface );
1152 * @brief Private constructor.
1154 Controller( ControlInterface* controlInterface,
1155 EditableControlInterface* editableControlInterface );
1158 Controller( const Controller& handle );
1161 Controller& operator=( const Controller& handle );
1163 protected: // Destructor.
1166 * @brief A reference counted object may only be deleted by calling Unreference().
1168 virtual ~Controller();
1178 } // namespace Toolkit
1182 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H