X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl.h;h=fa502a70998f4ddfa899b0cf39f641301b648d34;hb=a7646628bf0d87a7f9e02d8f4db52dea881579c7;hp=9295d5fdfe081dc4e33ae9e0846e990baa2c10c0;hpb=09f35f81061ca470e79ac674024b9e587ff44e7f;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 9295d5f..fa502a7 100644 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -19,8 +19,8 @@ */ // EXTERNAL INCLUDES -#include -#include +#include +#include // INTERNAL INCLUDES #include @@ -42,8 +42,6 @@ struct Event // Used to queue input events until DoRelayout() enum Type { - KEYBOARD_FOCUS_GAIN_EVENT, - KEYBOARD_FOCUS_LOST_EVENT, CURSOR_KEY_EVENT, TAP_EVENT, PAN_EVENT, @@ -148,15 +146,15 @@ struct EventData bool mUpdateLeftSelectionPosition : 1; ///< True if the visual position of the left selection handle must be recalculated. bool mUpdateRightSelectionPosition : 1; ///< True if the visual position of the right selection handle must be recalculated. bool mScrollAfterUpdateCursorPosition : 1; ///< Whether to scroll after the cursor position is updated. + bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters. }; struct ModifyEvent { enum Type { - PLACEHOLDER_TEXT, ///< Show the placeholder text if necessary TEXT_REPLACED, ///< The entire text was replaced - TEXT_INSERTED, ///< Insert characters at the current cursor position + TEXT_INSERTED, ///< Insert characters at the current cursor position TEXT_DELETED ///< Characters were deleted }; @@ -234,6 +232,12 @@ struct Controller::Impl */ void QueueModifyEvent( ModifyEvent::Type type ) { + if( ModifyEvent::TEXT_REPLACED == type) + { + // Cancel previously queued inserts etc. + mModifyEvents.clear(); + } + ModifyEvent event; event.type = type; mModifyEvents.push_back( event ); @@ -263,17 +267,6 @@ struct Controller::Impl return ( mEventData && mEventData->mIsShowingPlaceholderText ); } - void ShowPlaceholderText() - { - if( IsPlaceholderAvailable() ) - { - mEventData->mIsShowingPlaceholderText = true; - - // Placeholder-text is dependent on focus state i.e. replace after event processing - QueueModifyEvent( ModifyEvent::PLACEHOLDER_TEXT ); - } - } - /** * @brief Called when placeholder-text is hidden */ @@ -288,7 +281,17 @@ struct Controller::Impl } } - void PreEditReset() + void ClearPreEditFlag() + { + if( mEventData ) + { + mEventData->mPreEditFlag = false; + mEventData->mPreEditStartPosition = 0; + mEventData->mPreEditLength = 0; + } + } + + void ResetImfManager() { // Reset incase we are in a pre-edit state. ImfManager imfManager = ImfManager::Get(); @@ -296,12 +299,9 @@ struct Controller::Impl { imfManager.Reset(); // Will trigger a commit message } - } - /** - * @brief Called when placeholder-text is shown - */ - void ReplaceTextWithPlaceholder(); + ClearPreEditFlag(); + } void UpdateModel( OperationsMask operationsRequired ); @@ -313,8 +313,6 @@ struct Controller::Impl */ void GetDefaultFonts( Dali::Vector& fonts, Length numberOfCharacters ); - void OnKeyboardFocus( bool hasFocus ); - void OnCursorKeyEvent( const Event& event ); void OnTapEvent( const Event& event ); @@ -397,10 +395,17 @@ struct Controller::Impl /** * @brief Scrolls the text to make the cursor visible. * - * This method is called after inserting, deleting or moving the cursor with the keypad. + * This method is called after inserting text or moving the cursor with the keypad. */ void ScrollToMakeCursorVisible(); + /** + * @brief Scrolls the text to make the cursor visible. + * + * This method is called after deleting text. + */ + void ScrollTextToMatchCursor(); + ControlInterface& mControlInterface; ///< Reference to the text controller. LogicalModelPtr mLogicalModel; ///< Pointer to the logical model. VisualModelPtr mVisualModel; ///< Pointer to the visual model.