+ /**
+ * @brief Retrieves the placeholder text font width.
+ *
+ * @return The placeholder text font width
+ */
+ FontWidth GetPlaceholderTextFontWidth() const;
+
+ /**
+ * @brief Sets the default font slant.
+ *
+ * @param[in] slant The font slant.
+ */
+ void SetDefaultFontSlant( FontSlant slant );
+
+ /**
+ * @brief Whether the font's slant has been defined.
+ */
+ bool IsDefaultFontSlantDefined() const;
+
+ /**
+ * @brief Retrieves the default font slant.
+ *
+ * @return The default font slant.
+ */
+ FontSlant GetDefaultFontSlant() const;
+
+ /**
+ * @brief Sets the placeholder text font slant.
+ *
+ * @param[in] slant The font slant
+ */
+ void SetPlaceholderTextFontSlant( FontSlant slant );
+
+ /**
+ * @brief Whether the font's slant has been defined.
+ *
+ * @return True if the placeholder text font slant is defined
+ */
+ bool IsPlaceholderTextFontSlantDefined() const;
+
+ /**
+ * @brief Retrieves the placeholder text font slant.
+ *
+ * @return The placeholder text font slant
+ */
+ FontSlant GetPlaceholderTextFontSlant() const;
+
+ /**
+ * @brief Set the default font size.
+ *
+ * @param[in] fontSize The default font size
+ * @param[in] type The font size type is point size or pixel size
+ */
+ void SetDefaultFontSize( float fontSize, FontSizeType type );
+
+ /**
+ * @brief Retrieve the default point size.
+ *
+ * @param[in] type The font size type
+ * @return The default point size.
+ */
+ float GetDefaultFontSize( FontSizeType type ) const;
+
+ /**
+ * @brief Sets the Placeholder text font size.
+ * @param[in] fontSize The placeholder text font size
+ * @param[in] type The font size type is point size or pixel size
+ */
+ void SetPlaceholderTextFontSize( float fontSize, FontSizeType type );
+
+ /**
+ * @brief Retrieves the Placeholder text font size.
+ * @param[in] type The font size type
+ * @return The placeholder font size
+ */
+ float GetPlaceholderTextFontSize( FontSizeType type ) const;
+
+ /**
+ * @brief Sets the text's default color.
+ *
+ * @param color The default color.
+ */
+ void SetDefaultColor( const Vector4& color );
+
+ /**
+ * @brief Retrieves the text's default color.
+ *
+ * @return The default color.
+ */
+ const Vector4& GetDefaultColor() const;
+
+ /**
+ * @brief Set the text color
+ *
+ * @param textColor The text color
+ */
+ void SetPlaceholderTextColor( const Vector4& textColor );
+
+ /**
+ * @brief Retrieve the text color
+ *
+ * @return The text color
+ */
+ const Vector4& GetPlaceholderTextColor() const;
+
+ /**
+ * @brief Set the shadow offset.
+ *
+ * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
+ */
+ void SetShadowOffset( const Vector2& shadowOffset );
+
+ /**
+ * @brief Retrieve the shadow offset.
+ *
+ * @return The shadow offset.
+ */
+ const Vector2& GetShadowOffset() const;
+
+ /**
+ * @brief Set the shadow color.
+ *
+ * @param[in] shadowColor The shadow color.
+ */
+ void SetShadowColor( const Vector4& shadowColor );
+
+ /**
+ * @brief Retrieve the shadow color.
+ *
+ * @return The shadow color.
+ */
+ const Vector4& GetShadowColor() const;
+
+ /**
+ * @brief Set the underline color.
+ *
+ * @param[in] color color of underline.
+ */
+ void SetUnderlineColor( const Vector4& color );
+
+ /**
+ * @brief Retrieve the underline color.
+ *
+ * @return The underline color.
+ */
+ const Vector4& GetUnderlineColor() const;
+
+ /**
+ * @brief Set the underline enabled flag.
+ *
+ * @param[in] enabled The underline enabled flag.
+ */
+ void SetUnderlineEnabled( bool enabled );
+
+ /**
+ * @brief Returns whether the text is underlined or not.
+ *
+ * @return The underline state.
+ */
+ bool IsUnderlineEnabled() const;
+
+ /**
+ * @brief Set the override used for underline height, 0 indicates height will be supplied by font metrics
+ *
+ * @param[in] height The height in pixels of the underline
+ */
+ void SetUnderlineHeight( float height );
+
+ /**
+ * @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
+ *
+ * @return The height of the underline, or 0 if height is not overrided.
+ */
+ float GetUnderlineHeight() const;
+
+ /**
+ * @brief Sets the emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetDefaultEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetDefaultEmbossProperties() const;
+
+ /**
+ * @brief Sets the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetDefaultOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetDefaultOutlineProperties() const;
+
+ /**
+ * @brief Sets the default line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetDefaultLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the default line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetDefaultLineSpacing() const;
+
+ /**
+ * @brief Sets the input text's color.
+ *
+ * @param[in] color The input text's color.
+ */
+ void SetInputColor( const Vector4& color );
+
+ /**
+ * @brief Retrieves the input text's color.
+ *
+ * @return The input text's color.
+ */
+ const Vector4& GetInputColor() const;
+
+ /**
+ * @brief Sets the input text's font family name.
+ *
+ * @param[in] fontFamily The text's font family name.
+ */
+ void SetInputFontFamily( const std::string& fontFamily );
+
+ /**
+ * @brief Retrieves the input text's font family name.
+ *
+ * @return The input text's font family name.
+ */
+ const std::string& GetInputFontFamily() const;
+
+ /**
+ * @brief Sets the input font's weight.
+ *
+ * @param[in] weight The input font's weight.
+ */
+ void SetInputFontWeight( FontWeight weight );
+
+ /**
+ * @return Whether the font's weight has been defined.
+ */
+ bool IsInputFontWeightDefined() const;
+
+ /**
+ * @brief Retrieves the input font's weight.
+ *
+ * @return The input font's weight.
+ */
+ FontWeight GetInputFontWeight() const;
+
+ /**
+ * @brief Sets the input font's width.
+ *
+ * @param[in] width The input font's width.
+ */
+ void SetInputFontWidth( FontWidth width );
+
+ /**
+ * @return Whether the font's width has been defined.
+ */
+ bool IsInputFontWidthDefined() const;
+
+ /**
+ * @brief Retrieves the input font's width.
+ *
+ * @return The input font's width.
+ */
+ FontWidth GetInputFontWidth() const;
+
+ /**
+ * @brief Sets the input font's slant.
+ *
+ * @param[in] slant The input font's slant.
+ */
+ void SetInputFontSlant( FontSlant slant );
+
+ /**
+ * @return Whether the font's slant has been defined.
+ */
+ bool IsInputFontSlantDefined() const;
+
+ /**
+ * @brief Retrieves the input font's slant.
+ *
+ * @return The input font's slant.
+ */
+ FontSlant GetInputFontSlant() const;
+
+ /**
+ * @brief Sets the input font's point size.
+ *
+ * @param[in] size The input font's point size.
+ */
+ void SetInputFontPointSize( float size );
+
+ /**
+ * @brief Retrieves the input font's point size.
+ *
+ * @return The input font's point size.
+ */
+ float GetInputFontPointSize() const;
+
+ /**
+ * @brief Sets the input line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetInputLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the input line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetInputLineSpacing() const;
+
+ /**
+ * @brief Sets the input shadow's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] shadowProperties The shadow's properties string.
+ */
+ void SetInputShadowProperties( const std::string& shadowProperties );
+
+ /**
+ * @brief Retrieves the input shadow's properties string.
+ *
+ * @return The shadow's properties string.
+ */
+ const std::string& GetInputShadowProperties() const;
+
+ /**
+ * @brief Sets the input underline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] underlineProperties The underline's properties string.
+ */
+ void SetInputUnderlineProperties( const std::string& underlineProperties );
+
+ /**
+ * @brief Retrieves the input underline's properties string.
+ *
+ * @return The underline's properties string.
+ */
+ const std::string& GetInputUnderlineProperties() const;
+
+ /**
+ * @brief Sets the input emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetInputEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the input emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetInputEmbossProperties() const;
+
+ /**
+ * @brief Sets input the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetInputOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the input outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetInputOutlineProperties() const;
+
+ /**
+ * @brief Set the control's interface.
+ *
+ * @param[in] controlInterface The control's interface.
+ */
+ void SetControlInterface( ControlInterface* controlInterface );
+
+public: // Queries & retrieves.
+
+ /**
+ * @brief Return the layout engine.
+ *
+ * @return A reference to the layout engine.
+ */
+ Layout::Engine& GetLayoutEngine();
+
+ /**
+ * @brief Return a view of the text.
+ *
+ * @return A reference to the view.
+ */
+ View& GetView();
+
+ /**
+ * @copydoc Control::GetNaturalSize()
+ */
+ Vector3 GetNaturalSize();
+
+ /**
+ * @copydoc Control::GetHeightForWidth()
+ */
+ float GetHeightForWidth( float width );
+
+ /**
+ * @brief Retrieves the text's number of lines for a given width.
+ * @param[in] width The width of the text's area.
+ * @ return The number of lines.
+ */
+ int GetLineCount( float width );
+
+ /**
+ * @brief Retrieves the text's model.
+ *
+ * @return A pointer to the text's model.
+ */
+ const ModelInterface* const GetTextModel() const;
+
+ /**
+ * @brief Used to get scrolled distance by user input
+ *
+ * @return Distance from last scroll offset to new scroll offset
+ */
+ float GetScrollAmountByUserInput();
+
+ /**
+ * @brief Get latest scroll amount, control size and layout size
+ *
+ * This method is used to get information of control's scroll
+ * @param[out] scrollPosition The current scrolled position
+ * @param[out] controlHeight The size of a UI control
+ * @param[out] layoutHeight The size of a bounding box to layout text within.
+ *
+ * @return Whether the text scroll position is changed or not after last update.
+ */
+ bool GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight );
+
+ /**
+ * @brief Used to set the hidden input option
+ */
+ void SetHiddenInputOption( const Property::Map& options );
+
+ /**
+ * @brief Used to get the hidden input option
+ */
+ void GetHiddenInputOption( Property::Map& options );
+
+ /**
+ * @brief Sets the Placeholder Properties.
+ *
+ * @param[in] map The placeholder property map
+ */
+ void SetPlaceholderProperty( const Property::Map& map );
+
+ /**
+ * @brief Retrieves the Placeholder Property map.
+ *
+ * @param[out] map The property map
+ */
+ void GetPlaceholderProperty( Property::Map& map );
+
+public: // Relayout.
+
+ /**
+ * @brief Triggers a relayout which updates View (if necessary).
+ *
+ * @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
+ * @param[in] size A the size of a bounding box to layout text within.
+ *
+ * @return Whether the text model or decorations were updated.
+ */
+ UpdateTextType Relayout( const Size& size );
+
+ /**
+ * @brief Request a relayout using the ControlInterface.
+ */
+ void RequestRelayout();
+
+public: // Input style change signals.
+
+ /**
+ * @return Whether the queue of input style changed signals is empty.
+ */
+ bool IsInputStyleChangedSignalsQueueEmpty();
+
+ /**
+ * @brief Process all pending input style changed signals.
+ *
+ * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
+ * text controls. Text controls may send signals to state the input style has changed.
+ */
+ void ProcessInputStyleChangedSignals();
+
+public: // Text-input Event Queuing.
+
+ /**
+ * @brief Called by editable UI controls when keyboard focus is gained.
+ */
+ void KeyboardFocusGainEvent();
+
+ /**
+ * @brief Called by editable UI controls when focus is lost.
+ */
+ void KeyboardFocusLostEvent();
+
+ /**
+ * @brief Called by editable UI controls when key events are received.
+ *
+ * @param[in] event The key event.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
+ */
+ bool KeyEvent( const Dali::KeyEvent& event );
+
+ /**
+ * @brief Called by editable UI controls when a tap gesture occurs.
+ * @param[in] tapCount The number of taps.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
+ */
+ void TapEvent( unsigned int tapCount, float x, float y );
+
+ /**
+ * @brief Called by editable UI controls when a pan gesture occurs.
+ *
+ * @param[in] state The state of the gesture.
+ * @param[in] displacement This distance panned since the last pan gesture.
+ */
+ void PanEvent( Gesture::State state, const Vector2& displacement );
+
+ /**
+ * @brief Called by editable UI controls when a long press gesture occurs.
+ *
+ * @param[in] state The state of the gesture.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
+ */
+ void LongPressEvent( Gesture::State state, float x, float y );
+
+ /**
+ * @brief Event received from IMF manager
+ *
+ * @param[in] imfManager The IMF manager.
+ * @param[in] imfEvent The event received.
+ * @return A data struture indicating if update is needed, cursor position and current text.
+ */
+ ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
+
+ /**
+ * @brief Event from Clipboard notifying an Item has been selected for pasting
+ */
+ void PasteClipboardItemEvent();
+
+ /**
+ * @brief Return true when text control should clear key input focus when escape key is pressed.
+ *
+ * @return Whether text control should clear key input focus or not when escape key is pressed.
+ */
+ bool ShouldClearFocusOnEscape() const;
+
+protected: // Inherit from Text::Decorator::ControllerInterface.
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
+ */
+ virtual void GetTargetSize( Vector2& targetSize );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
+ */
+ virtual void AddDecoration( Actor& actor, bool needsClipping );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
+ */
+ virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
+
+protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
+
+ /**
+ * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
+ */
+ virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
+
+protected: // Inherit from HiddenText.
+
+ /**
+ * @brief Invoked from HiddenText when showing time of the last character was expired
+ */
+ virtual void DisplayTimeExpired();
+
+private: // Update.
+
+ /**
+ * @brief Called by editable UI controls when key events are received.
+ *
+ * @param[in] text The text to insert.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
+ */
+ void InsertText( const std::string& text, InsertType type );
+
+ /**
+ * @brief Paste given string into Text model
+ * @param[in] stringToPaste this string will be inserted into the text model
+ */
+ void PasteText( const std::string& stringToPaste );
+
+ /**
+ * @brief Remove a given number of characters
+ *
+ * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
+ * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
+ * style when pre-edit text is removed.
+ *
+ * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
+ * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
+ * @param[in] type Whether to update the input style.
+ * @return True if the remove was successful.
+ */
+ bool RemoveText( int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type );
+
+ /**
+ * @brief Checks if text is selected and if so removes it.
+ * @return true if text was removed
+ */
+ bool RemoveSelectedText();
+
+private: // Relayout.
+
+ /**
+ * @brief Lays-out the text.
+ *
+ * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
+ *
+ * @param[in] size A the size of a bounding box to layout text within.
+ * @param[in] operations The layout operations which need to be done.
+ * @param[out] layoutSize The size of the laid-out text.
+ */
+ bool DoRelayout( const Size& size,
+ OperationsMask operations,
+ Size& layoutSize );
+
+ /**
+ * @brief Calulates the vertical offset to align the text inside the bounding box.
+ *
+ * @param[in] size The size of the bounding box.
+ */
+ void CalculateVerticalOffset( const Size& size );
+
+private: // Events.
+
+ /**
+ * @brief Process queued events which modify the model.
+ */
+ void ProcessModifyEvents();
+
+ /**
+ * @brief Used to process an event queued from SetText()
+ */
+ void TextReplacedEvent();
+
+ /**
+ * @brief Used to process an event queued from key events etc.
+ */
+ void TextInsertedEvent();
+
+ /**
+ * @brief Used to process an event queued from backspace key etc.
+ */
+ void TextDeletedEvent();
+
+ /**
+ * @brief Creates a selection event.
+ *
+ * It could be called from the TapEvent (double tap) or when the text selection popup's sellect all button is pressed.
+ *
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
+ * @param[in] selectAll Whether the whole text is selected.
+ */
+ void SelectEvent( float x, float y, bool selectAll );
+
+ /**
+ * @brief Helper to KeyEvent() to handle the backspace case.
+ *
+ * @return True if a character was deleted.
+ */
+ bool BackspaceKeyEvent();
+
+private: // Helpers.
+
+ /**
+ * @brief Used to remove the text included the placeholder text.
+ */
+ void ResetText();
+
+ /**
+ * @brief Helper to show the place holder text..
+ */
+ void ShowPlaceholderText();
+
+ /**
+ * @brief Helper to clear font-specific data (only).
+ */
+ void ClearFontData();
+
+ /**
+ * @brief Helper to clear text's style data.
+ */
+ void ClearStyleData();
+
+ /**
+ * @brief Used to reset the cursor position after setting a new text.
+ *
+ * @param[in] cursorIndex Where to place the cursor.
+ */
+ void ResetCursorPosition( CharacterIndex cursorIndex );
+
+ /**
+ * @brief Used to reset the scroll position after setting a new text.
+ */
+ void ResetScrollPosition();
+
+private: // Private contructors & copy operator.
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller();
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller( ControlInterface* controlInterface );
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface );
+
+ // Undefined
+ Controller( const Controller& handle );