// EXTERNAL INCLUDES
#include <string>
+#include <dali/devel-api/adaptor-framework/imf-manager.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/events/gesture.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/font-run.h>
+#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-view.h>
* It provides a view of the text that can be used by rendering back-ends.
*
* For selectable/editable UI controls, the controller handles input events from the UI control
- * and decorations (grab handles etc) via an observer interface.
+ * and decorations (grab handles etc) via an interface.
*/
-class Controller : public RefObject, public Decorator::Observer
+class Controller : public RefObject, public Decorator::ControllerInterface
{
public:
static ControllerPtr New( ControlInterface& controlInterface );
/**
+ * @brief Called to enable text input.
+ *
+ * @note Selectable or editable controls should call this once after Controller::New().
+ * @param[in] decorator Used to create cursor, selection handle decorations etc.
+ */
+ void EnableTextInput( DecoratorPtr decorator );
+
+ /**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
float GetUnderlineHeight() const;
/**
- * @brief Called to enable text input.
- *
- * @note Only selectable or editable controls should calls this.
- * @param[in] decorator Used to create cursor, selection handle decorations etc.
- */
- void EnableTextInput( DecoratorPtr decorator );
-
- /**
* @brief Called to enable/disable cursor blink.
*
* @note Only editable controls should calls this.
void ResetText();
/**
+ * @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();
+
+ /**
* @brief Used to process an event queued from SetText()
*/
void TextReplacedEvent();
Size& layoutSize );
/**
+ * @brief Whether to enable the multi-line layout.
+ *
+ * @param[in] enable \e true enables the multi-line (by default)
+ */
+ void SetMultiLineEnabled( bool enable );
+
+ /**
+ * @return Whether the multi-line layout is enabled.
+ */
+ bool IsMultiLineEnabled() const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
+ */
+ void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
+ */
+ LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
+ */
+ void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
+ */
+ LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
+
+ /**
* @brief Calulates the alignment of the whole text inside the bounding box.
*
* @param[in] size The size of the bounding box.
void PanEvent( Gesture::State state, const Vector2& displacement );
/**
- * @copydoc Dali::Toolkit::Text::Decorator::Observer::HandleEvent()
+ * @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.
*/
- virtual void HandleEvent( HandleType handle, HandleState state, float x, float y );
+ ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
+ */
+ virtual void GetTargetSize( Vector2& targetSize );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
+ */
+ virtual void AddDecoration( Actor& actor );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
+ */
+ virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
protected:
private:
/**
+ * @brief Helper to clear font-specific data.
+ */
+ void ShowPlaceholderText();
+
+ /**
+ * @brief Helper to clear all the model data except for LogicalModel::mText.
+ */
+ void ClearModelData();
+
+ /**
+ * @brief Helper to clear font-specific data (only).
+ */
+ void ClearFontData();
+
+ /**
* @brief Private constructor.
*/
Controller( ControlInterface& controlInterface );