namespace Text
{
+//Forward declarations
+struct CursorInfo;
+
struct Event
{
// Used to queue input events until DoRelayout()
Param p3;
};
-struct CursorInfo
-{
- CursorInfo()
- : primaryPosition(),
- secondaryPosition(),
- lineOffset( 0.f ),
- lineHeight( 0.f ),
- primaryCursorHeight( 0.f ),
- secondaryCursorHeight( 0.f ),
- isSecondaryCursor( false )
- {}
-
- ~CursorInfo()
- {}
-
- Vector2 primaryPosition; ///< The primary cursor's position.
- Vector2 secondaryPosition; ///< The secondary cursor's position.
- float lineOffset; ///< The vertical offset where the line containing the cursor starts.
- float lineHeight; ///< The height of the line where the cursor is placed.
- float primaryCursorHeight; ///< The primary cursor's height.
- float secondaryCursorHeight; ///< The secondary cursor's height.
- bool isSecondaryCursor; ///< Whether the secondary cursor is valid.
-};
-
struct EventData
{
enum State
InputStyle mInputStyle; ///< The style to be set to the new inputed text.
- /**
- * 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
- * Typically this will have a negative value with scrolling occurs.
- */
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
-
State mState; ///< Selection mode, edit mode etc.
CharacterIndex mPrimaryCursorPosition; ///< Index into logical model for primary cursor.
}
};
+struct UnderlineDefaults
+{
+ std::string properties;
+ // TODO: complete with underline parameters.
+};
+
+struct ShadowDefaults
+{
+ std::string properties;
+ // TODO: complete with shadow parameters.
+};
+
+struct EmbossDefaults
+{
+ std::string properties;
+ // TODO: complete with emboss parameters.
+};
+
+struct OutlineDefaults
+{
+ std::string properties;
+ // TODO: complete with outline parameters.
+};
+
struct Controller::Impl
{
Impl( ControlInterface& controlInterface )
mLogicalModel(),
mVisualModel(),
mFontDefaults( NULL ),
+ mUnderlineDefaults( NULL ),
+ mShadowDefaults( NULL ),
+ mEmbossDefaults( NULL ),
+ mOutlineDefaults( NULL ),
mEventData( NULL ),
mFontClient(),
mClipboard(),
mLayoutEngine(),
mModifyEvents(),
mTextColor( Color::BLACK ),
- mAlignmentOffset(),
mTextUpdateInfo(),
mOperationsPending( NO_OPERATION ),
mMaximumNumberOfCharacters( 50u ),
~Impl()
{
delete mFontDefaults;
+ delete mUnderlineDefaults;
+ delete mShadowDefaults;
+ delete mEmbossDefaults;
+ delete mOutlineDefaults;
delete mEventData;
}
}
}
+ /**
+ * @brief Helper to notify IMF manager with surrounding text & cursor changes.
+ */
+ void NotifyImfManager();
+
+ /**
+ * @brief Retrieve the current cursor position.
+ *
+ * @return The cursor position.
+ */
+ CharacterIndex GetLogicalCursorPosition() const;
+
+ /**
+ * @brief Retrieves the number of consecutive white spaces starting from the given @p index.
+ *
+ * @param[in] index The character index from where to count the number of consecutive white spaces.
+ *
+ * @return The number of consecutive white spaces.
+ */
+ Length GetNumberOfWhiteSpaces( CharacterIndex index ) const;
+
+ /**
+ * @brief Retrieve any text previously set starting from the given @p index.
+ *
+ * @param[in] index The character index from where to retrieve the text.
+ * @param[out] text A string of UTF-8 characters.
+ *
+ * @see Dali::Toolkit::Text::Controller::GetText()
+ */
+ void GetText( CharacterIndex index, std::string& text ) const;
+
bool IsClipboardEmpty()
{
bool result( mClipboard && mClipboard.NumberOfItems() );
void SetPopupButtons();
void ChangeState( EventData::State newState );
- LineIndex GetClosestLine( float y ) const;
-
- void FindSelectionIndices( float visualX, float visualY, CharacterIndex& startIndex, CharacterIndex& endIndex );
-
- /**
- * @brief Retrieves the cursor's logical position for a given touch point x,y
- *
- * @param[in] visualX The touch point x.
- * @param[in] visualY The touch point y.
- *
- * @return The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
- */
- CharacterIndex GetClosestCursorIndex( float visualX,
- float visualY );
/**
* @brief Calculates the cursor's position for a given character index in the logical order.
LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
VisualModelPtr mVisualModel; ///< Pointer to the visual model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
+ UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
+ ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
+ EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
+ OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
Clipboard mClipboard; ///< Handle to the system clipboard
LayoutEngine mLayoutEngine; ///< The layout engine.
Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
Vector4 mTextColor; ///< The regular text color
- Vector2 mAlignmentOffset; ///< Vertical and horizontal offset of the whole text inside the control due to alignment.
+ /**
+ * 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
+ * Typically this will have a negative value with scrolling occurs.
+ */
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.