- mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
- }
-
- mUpdateCursorPosition = false;
- mDecoratorUpdated = true;
- }
-
- LogicalModelPtr mLogicalModel;
- VisualModelPtr mVisualModel;
- DecoratorPtr mDecorator;
- FontDefaults* mFontDefaults;
- TextAbstraction::FontClient& mFontClient;
- std::string mPlaceholderText;
-
- /**
- * This is used to delay handling events until after the model has been updated.
- * The number of updates to the model is minimized to improve performance.
- */
- vector<Event> mEventQueue; ///< The queue of touch events etc.
-
- State mState; ///< Selection mode, edit mode etc.
-
- CharacterIndex mPrimaryCursorPosition; ///< Index into logical model for primary cursor
- CharacterIndex mSecondaryCursorPosition; ///< Index into logical model for secondary cursor
-
- /**
- * 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.
-
- bool mDecoratorUpdated : 1; ///< True if the decorator was updated during event processing
- bool mCursorBlinkEnabled : 1; ///< True if cursor should blink when active
- bool mGrabHandleEnabled : 1; ///< True if grab handle is enabled
- bool mGrabHandlePopupEnabled : 1; ///< True if the grab handle popu-up should be shown
- bool mSelectionEnabled : 1; ///< True if selection handles, highlight etc. are enabled
- bool mHorizontalScrollingEnabled : 1; ///< True if horizontal scrolling is enabled
- bool mVerticalScrollingEnabled : 1; ///< True if vertical scrolling is enabled
- bool mUpdateCursorPosition : 1; ///< True if the visual position of the cursor must be recalculated
-};
-
-struct Controller::Impl
-{
- Impl( ControlInterface& controlInterface )
- : mControlInterface( controlInterface ),
- mLogicalModel(),
- mVisualModel(),
- mFontDefaults( NULL ),
- mTextInput( NULL ),
- mFontClient(),
- mView(),
- mLayoutEngine(),
- mModifyEvents(),
- mControlSize(),
- mAlignmentOffset(),
- mOperationsPending( NO_OPERATION ),
- mRecalculateNaturalSize( true )
- {
- mLogicalModel = LogicalModel::New();
- mVisualModel = VisualModel::New();
-
- mFontClient = TextAbstraction::FontClient::Get();
-
- mView.SetVisualModel( mVisualModel );
-
- // Set the text properties to default
- mVisualModel->SetTextColor( Color::WHITE );
- mVisualModel->SetShadowOffset( Vector2::ZERO );
- mVisualModel->SetShadowColor( Vector4::ZERO );
- mVisualModel->SetUnderlineEnabled( false );
- mVisualModel->SetUnderlineHeight( 0.0f );
- }
-
- ~Impl()
- {
- delete mTextInput;
- }
-
- ControlInterface& mControlInterface; ///< Reference to the text controller.
- 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.
- Controller::TextInput* mTextInput; ///< Avoid allocating everything for text input until EnableTextInput().
- TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
- View mView; ///< The view interface to the rendering back-end.
- LayoutEngine mLayoutEngine; ///< The layout engine.
- std::vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
- Size mControlSize; ///< The size of the control.
- Vector2 mAlignmentOffset; ///< Vertical and horizontal offset of the whole text inside the control due to alignment.
- OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
- bool mRecalculateNaturalSize:1; ///< Whether the natural size needs to be recalculated.
-};