/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return false;
}
+void Controller::SetNoTextDoubleTapAction( NoTextTap::Action action )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mDoubleTapAction = action;
+ }
+}
+
+Controller::NoTextTap::Action Controller::GetNoTextDoubleTapAction() const
+{
+ NoTextTap::Action action = NoTextTap::NO_ACTION;
+
+ if( NULL != mImpl->mEventData )
+ {
+ action = mImpl->mEventData->mDoubleTapAction;
+ }
+
+ return action;
+}
+
+void Controller::SetNoTextLongPressAction( NoTextTap::Action action )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mLongPressAction = action;
+ }
+}
+
+Controller::NoTextTap::Action Controller::GetNoTextLongPressAction() const
+{
+ NoTextTap::Action action = NoTextTap::NO_ACTION;
+
+ if( NULL != mImpl->mEventData )
+ {
+ action = mImpl->mEventData->mLongPressAction;
+ }
+
+ return action;
+}
+
// public : Queries & retrieves.
Layout::Engine& Controller::GetLayoutEngine()
if( mImpl->mEventData->mSelectionEnabled &&
mImpl->IsShowingRealText() )
{
- SelectEvent( x, y, false );
+ relayoutNeeded = true;
+ mImpl->mEventData->mIsLeftHandleSelected = true;
+ mImpl->mEventData->mIsRightHandleSelected = true;
}
}
+
// Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
if( relayoutNeeded )
{
if( ( state == Gesture::Started ) &&
( NULL != mImpl->mEventData ) )
{
- if( !mImpl->IsShowingRealText() )
+ // The 1st long-press on inactive text-field is treated as tap
+ if( EventData::INACTIVE == mImpl->mEventData->mState )
+ {
+ mImpl->ChangeState( EventData::EDITING );
+
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = 1;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+
+ mImpl->RequestRelayout();
+ }
+ else if( !mImpl->IsShowingRealText() )
{
Event event( Event::LONG_PRESS_EVENT );
event.p1.mInt = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
mImpl->mEventData->mEventQueue.push_back( event );
mImpl->RequestRelayout();
}
- else
+ else if( !mImpl->IsClipboardVisible() )
{
- // The 1st long-press on inactive text-field is treated as tap
- if( EventData::INACTIVE == mImpl->mEventData->mState )
- {
- mImpl->ChangeState( EventData::EDITING );
-
- Event event( Event::TAP_EVENT );
- event.p1.mUint = 1;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ // Reset the imf manager to commit the pre-edit before selecting the text.
+ mImpl->ResetImfManager();
- mImpl->RequestRelayout();
- }
- else
- {
- // Reset the imf manger to commit the pre-edit before selecting the text.
- mImpl->ResetImfManager();
+ Event event( Event::LONG_PRESS_EVENT );
+ event.p1.mInt = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ mImpl->RequestRelayout();
- SelectEvent( x, y, false );
- }
+ mImpl->mEventData->mIsLeftHandleSelected = true;
+ mImpl->mEventData->mIsRightHandleSelected = true;
}
}
}
void Controller::InsertText( const std::string& text, Controller::InsertType type )
{
- bool removedPrevious( false );
- bool maxLengthReached( false );
+ bool removedPrevious = false;
+ bool removedSelected = false;
+ bool maxLengthReached = false;
DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
// TODO: At the moment the underline runs are only for pre-edit.
mImpl->mModel->mVisualModel->mUnderlineRuns.Clear();
- // Keep the current number of characters.
- const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
-
// Remove the previous IMF pre-edit.
if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
{
else
{
// Remove the previous Selection.
- removedPrevious = RemoveSelectedText();
+ removedSelected = RemoveSelectedText();
+
}
Vector<Character> utf32Characters;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Inserted %d characters, new size %d new cursor %d\n", maxSizeOfNewText, mImpl->mModel->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition );
}
- const Length numberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
-
if( ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) &&
mImpl->IsPlaceholderAvailable() )
{
mImpl->ClearPreEditFlag();
}
else if( removedPrevious ||
+ removedSelected ||
( 0 != utf32Characters.Count() ) )
{
// Queue an inserted event
mImpl->QueueModifyEvent( ModifyEvent::TEXT_INSERTED );
mImpl->mEventData->mUpdateCursorPosition = true;
- if( numberOfCharacters < currentNumberOfCharacters )
+ if( removedSelected )
{
mImpl->mEventData->mScrollAfterDelete = true;
}
}
mImpl->mEventData->mCheckScrollAmount = true;
+ mImpl->mEventData->mIsLeftHandleSelected = true;
+ mImpl->mEventData->mIsRightHandleSelected = true;
mImpl->RequestRelayout();
}
}