static bool gSelectionChangedCallbackCalled;
static uint32_t oldSelectionStart;
static uint32_t oldSelectionEnd;
+static bool gSelectionClearedCallbackCalled;
static bool gAnchorClickedCallBackCalled;
static bool gAnchorClickedCallBackNotCalled;
static bool gTextChangedCallBackCalled;
bool* mCallbackFlag;
};
+static void TestSelectionClearedCallback(TextEditor control)
+{
+ tet_infoline(" TestSelectionClearedCallback");
+
+ gSelectionClearedCallbackCalled = true;
+}
+
static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
{
tet_infoline(" TestSelectionChangedCallback");
END_TEST;
}
+int utcDaliTextEditorSelectionClearedSignal(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorSelectionClearedSignal");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ application.GetScene().Add( editor );
+
+ // connect to the selection changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextEditor::SelectionClearedSignal(editor).Connect(&TestSelectionClearedCallback);
+ bool selectionClearedSignal = false;
+ editor.ConnectSignal( testTracker, "selectionCleared", CallbackFunctor(&selectionClearedSignal) );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text & Select some text in the right of the current cursor position
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // remove selection
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Move to second line of the text & select.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ //remove selection
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text & select.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // replace C with selected text
+ application.ProcessEvent( GenerateKey( "c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DevelTextEditor::SelectText( editor ,1, 3 );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ editor.SetProperty( DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ DevelTextEditor::SelectText( editor ,1, 3 );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // select none
+ DevelTextEditor::SelectNone(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ END_TEST;
+}
+
int utcDaliTextEditorSelectionChangedSignal(void)
{
ToolkitTestApplication application;
static bool gSelectionChangedCallbackCalled;
static uint32_t oldSelectionStart;
static uint32_t oldSelectionEnd;
+static bool gSelectionClearedCallbackCalled;
static bool gAnchorClickedCallBackCalled;
static bool gAnchorClickedCallBackNotCalled;
static bool gTextChangedCallBackCalled;
bool* mCallbackFlag;
};
+static void TestSelectionClearedCallback(TextField control)
+{
+ tet_infoline(" TestSelectionClearedCallback");
+
+ gSelectionClearedCallbackCalled = true;
+}
+
static void TestSelectionChangedCallback(TextField control, uint32_t oldStart, uint32_t oldEnd)
{
tet_infoline(" TestSelectionChangedCallback");
END_TEST;
}
+int utcDaliTextFieldSelectionClearedSignal(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldSelectionClearedSignal");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ application.GetScene().Add( field );
+
+ // connect to the selection changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextField::SelectionClearedSignal(field).Connect(&TestSelectionClearedCallback);
+ bool selectionClearedSignal = false;
+ field.ConnectSignal( testTracker, "selectionCleared", CallbackFunctor(&selectionClearedSignal) );
+
+ field.SetProperty( TextField::Property::TEXT, "Hello\nworld\nHello world" );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text & Select some text in the right of the current cursor position
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // remove selection
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Move to second line of the text & select.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ //remove selection
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text & select.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // replace D with selected text
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DevelTextField::SelectText( field ,1, 3 );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( DevelTextField::Property::PRIMARY_CURSOR_POSITION, 3);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ gSelectionClearedCallbackCalled = false;
+
+ DevelTextField::SelectText( field ,1, 3 );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // select none
+ DevelTextField::SelectNone(field);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
+
+ END_TEST;
+}
+
int utcDaliTextFieldSelectionChangedSignal(void)
{
ToolkitTestApplication application;
return GetImpl(textEditor).SelectionChangedSignal();
}
+SelectionClearedSignalType& SelectionClearedSignal(TextEditor textEditor)
+{
+ return GetImpl(textEditor).SelectionClearedSignal();
+}
+
void SelectWholeText(TextEditor textEditor)
{
GetImpl(textEditor).SelectWholeText();
DALI_TOOLKIT_API SelectionChangedSignalType& SelectionChangedSignal(TextEditor textEditor);
/**
+ * @brief selection cleared signal type.
+ */
+using SelectionClearedSignalType = Signal<void(TextEditor)>;
+
+/**
+ * @brief This signal is emitted when the selection has been cleared.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( TextEditor textEditor);
+ * @endcode
+ * @param[in] textEditor The instance of TextEditor.
+ * @return The signal to connect to
+ */
+DALI_TOOLKIT_API SelectionClearedSignalType& SelectionClearedSignal(TextEditor textEditor);
+
+/**
* @brief Select the whole text of TextEditor.
*
* @param[in] textEditor The instance of TextEditor.
return GetImpl(textField).SelectionChangedSignal();
}
+SelectionClearedSignalType& SelectionClearedSignal(TextField textField)
+{
+ return GetImpl(textField).SelectionClearedSignal();
+}
+
void SelectWholeText(TextField textField)
{
GetImpl(textField).SelectWholeText();
DALI_TOOLKIT_API SelectionChangedSignalType& SelectionChangedSignal(TextField textField);
/**
+ * @brief selection cleared signal type.
+ */
+using SelectionClearedSignalType = Signal<void(TextField)>;
+
+/**
+ * @brief This signal is emitted when the selection has been cleared.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( TextField textField);
+ * @endcode
+ * @param[in] textField The instance of TextField.
+ * @return The signal to connect to
+ */
+DALI_TOOLKIT_API SelectionClearedSignalType& SelectionClearedSignal(TextField textField);
+
+/**
* @brief Select the whole text of TextField.
*
* @param[in] textField The instance of TextField.
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputFiltered", SIGNAL_INPUT_FILTERED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "cursorPositionChanged", SIGNAL_CURSOR_POSITION_CHANGED)
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionChanged", SIGNAL_SELECTION_CHANGED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionCleared", SIGNAL_SELECTION_CLEARED )
DALI_TYPE_REGISTRATION_END()
// clang-format on
return mSelectionChangedSignal;
}
+DevelTextEditor::SelectionClearedSignalType& TextEditor::SelectionClearedSignal()
+{
+ return mSelectionClearedSignal;
+}
+
Text::ControllerPtr TextEditor::GetTextController()
{
return mController;
editorImpl.SelectionChangedSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_SELECTION_CLEARED))
+ {
+ if(editor)
+ {
+ Internal::TextEditor& editorImpl(GetImpl(editor));
+ editorImpl.SelectionClearedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
EmitSelectionChangedSignal();
}
+ if(mSelectionCleared)
+ {
+ EmitSelectionClearedSignal();
+ }
+
// The text-editor emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
mSelectionChanged = false;
}
+void TextEditor::EmitSelectionClearedSignal()
+{
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mSelectionClearedSignal.Emit(handle);
+ mSelectionCleared = false;
+}
+
void TextEditor::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd)
{
if(((oldStart != newStart) || (oldEnd != newEnd)) && !mSelectionChanged)
{
+ if(newStart == newEnd)
+ {
+ mSelectionCleared = true;
+ }
+
mSelectionChanged = true;
mOldSelectionStart = oldStart;
mOldSelectionEnd = oldEnd;
mScrollStarted(false),
mTextChanged(false),
mCursorPositionChanged(false),
- mSelectionChanged(false)
+ mSelectionChanged(false),
+ mSelectionCleared(false)
{
}
DevelTextEditor::SelectionChangedSignalType& SelectionChangedSignal();
/**
+ * @copydoc Dali::Toollkit::TextEditor::SelectionClearedSignal()
+ */
+ DevelTextEditor::SelectionClearedSignalType& SelectionClearedSignal();
+
+ /**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
* @param[in] tracker Used to disconnect the signal.
void EmitSelectionChangedSignal();
/**
+ * @brief Emits SelectionCleared signal.
+ */
+ void EmitSelectionClearedSignal();
+
+ /**
* @brief set RenderActor's position with new scrollPosition
*
* Apply updated scroll position or start scroll animation if VerticalScrollAnimation is enabled
Toolkit::DevelTextEditor::InputFilteredSignalType mInputFilteredSignal;
Toolkit::DevelTextEditor::CursorPositionChangedSignalType mCursorPositionChangedSignal;
Toolkit::DevelTextEditor::SelectionChangedSignalType mSelectionChangedSignal;
+ Toolkit::DevelTextEditor::SelectionClearedSignalType mSelectionClearedSignal;
InputMethodContext mInputMethodContext;
Text::ControllerPtr mController;
bool mTextChanged : 1; ///< If true, emits TextChangedSignal in next OnRelayout().
bool mCursorPositionChanged : 1; ///< If true, emits CursorPositionChangedSignal at the end of OnRelayout().
bool mSelectionChanged : 1; ///< If true, emits SelectionChangedSignal at the end of OnRelayout().
+ bool mSelectionCleared : 1; ///< If true, emits SelectionClearedSignal at the end of OnRelayout().
//args for cursor PositionChanged event
unsigned int mOldPosition;
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "inputFiltered", SIGNAL_INPUT_FILTERED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "cursorPositionChanged", SIGNAL_CURSOR_POSITION_CHANGED)
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "selectionChanged", SIGNAL_SELECTION_CHANGED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "selectionCleared", SIGNAL_SELECTION_CLEARED )
DALI_TYPE_REGISTRATION_END()
// clang-format on
fieldImpl.SelectionChangedSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_SELECTION_CLEARED))
+ {
+ if(field)
+ {
+ Internal::TextField& fieldImpl(GetImpl(field));
+ fieldImpl.SelectionClearedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
return mSelectionChangedSignal;
}
+DevelTextField::SelectionClearedSignalType& TextField::SelectionClearedSignal()
+{
+ return mSelectionClearedSignal;
+}
+
void TextField::OnInitialize()
{
Actor self = Self();
EmitSelectionChangedSignal();
}
+ if(mSelectionCleared)
+ {
+ EmitSelectionClearedSignal();
+ }
+
// The text-field emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
mSelectionChanged = false;
}
+void TextField::EmitSelectionClearedSignal()
+{
+ Dali::Toolkit::TextField handle(GetOwner());
+ mSelectionClearedSignal.Emit(handle);
+ mSelectionCleared = false;
+}
+
void TextField::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd)
{
if(((oldStart != newStart) || (oldEnd != newEnd)) && !mSelectionChanged)
{
+ if(newStart == newEnd)
+ {
+ mSelectionCleared = true;
+ }
+
mSelectionChanged = true;
mOldSelectionStart = oldStart;
mOldSelectionEnd = oldEnd;
mHasBeenStaged(false),
mTextChanged(false),
mCursorPositionChanged(false),
- mSelectionChanged(false)
+ mSelectionChanged(false),
+ mSelectionCleared(false)
{
}
*/
DevelTextField::SelectionChangedSignalType& SelectionChangedSignal();
+ /**
+ * @copydoc TextField::SelectionClearedSignal()
+ */
+ DevelTextField::SelectionClearedSignalType& SelectionClearedSignal();
+
private: // From Control
/**
* @copydoc Control::OnInitialize()
void EmitSelectionChangedSignal();
/**
+ * @brief Emits SelectionCleared signal.
+ */
+ void EmitSelectionClearedSignal();
+
+ /**
* @brief Callback function for when the layout is changed.
* @param[in] actor The actor whose layoutDirection is changed.
* @param[in] type The layoutDirection.
Toolkit::DevelTextField::InputFilteredSignalType mInputFilteredSignal;
Toolkit::DevelTextField::CursorPositionChangedSignalType mCursorPositionChangedSignal;
Toolkit::DevelTextField::SelectionChangedSignalType mSelectionChangedSignal;
+ Toolkit::DevelTextField::SelectionClearedSignalType mSelectionClearedSignal;
InputMethodContext mInputMethodContext;
Text::ControllerPtr mController;
bool mTextChanged : 1; ///< If true, emits TextChangedSignal in next OnRelayout().
bool mCursorPositionChanged : 1; ///< If true, emits CursorPositionChangedSignal at the end of OnRelayout().
bool mSelectionChanged : 1; ///< If true, emits SelectionChangedSignal at the end of OnRelayout().
+ bool mSelectionCleared : 1; ///< If true, emits SelectionClearedSignal at the end of OnRelayout().
//args for cursor position changed event
unsigned int mOldPosition;
ModelPtr& model = impl.mModel;
LogicalModelPtr& logicalModel = model->mLogicalModel;
VisualModelPtr& visualModel = model->mVisualModel;
+ uint32_t oldSelStart = eventData.mLeftSelectionPosition;
+ uint32_t oldSelEnd = eventData.mRightSelectionPosition;
CharacterIndex& primaryCursorPosition = eventData.mPrimaryCursorPosition;
CharacterIndex previousPrimaryCursorPosition = primaryCursorPosition;
// Update selection position after moving the cursor
eventData.mLeftSelectionPosition = primaryCursorPosition;
eventData.mRightSelectionPosition = primaryCursorPosition;
+
+ if(impl.mSelectableControlInterface != nullptr && eventData.mDecorator->IsHighlightVisible())
+ {
+ impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition);
+ }
}
if(isShiftModifier && impl.IsShowingRealText() && eventData.mShiftSelectionFlag)
int cursorPositionDelta = primaryCursorPosition - previousPrimaryCursorPosition;
if(cursorPositionDelta > 0 || eventData.mRightSelectionPosition > 0u) // Check the boundary
{
- uint32_t oldStart = eventData.mLeftSelectionPosition;
- uint32_t oldEnd = eventData.mRightSelectionPosition;
-
eventData.mRightSelectionPosition += cursorPositionDelta;
if(impl.mSelectableControlInterface != nullptr)
{
- impl.mSelectableControlInterface->SelectionChanged(oldStart, oldEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition);
+ impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition);
}
}
selecting = true;
if(impl.IsShowingRealText())
{
// Convert from control's coords to text's coords.
- const float xPosition = event.p2.mFloat - model->mScrollPosition.x;
- const float yPosition = event.p3.mFloat - model->mScrollPosition.y;
+ const float xPosition = event.p2.mFloat - model->mScrollPosition.x;
+ const float yPosition = event.p3.mFloat - model->mScrollPosition.y;
+ uint32_t oldSelStart = eventData.mLeftSelectionPosition;
+ uint32_t oldSelEnd = eventData.mRightSelectionPosition;
// Keep the tap 'x' position. Used to move the cursor.
eventData.mCursorHookPositionX = xPosition;
CharacterHitTest::TAP,
matchedCharacter);
+ if(impl.mSelectableControlInterface != nullptr && eventData.mDecorator->IsHighlightVisible())
+ {
+ impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mPrimaryCursorPosition, eventData.mPrimaryCursorPosition);
+ }
+
// When the cursor position is changing, delay cursor blinking
eventData.mDecorator->DelayCursorBlink();
}
if(EventData::SELECTING == impl.mEventData->mState)
{
std::string removedString;
+ uint32_t oldSelStart = impl.mEventData->mLeftSelectionPosition;
+ uint32_t oldSelEnd = impl.mEventData->mRightSelectionPosition;
+
impl.RetrieveSelection(removedString, true);
if(!removedString.empty())
RemoveTextAnchor(controller, cursorOffset, numberOfCharacters, previousCursorIndex);
}
+
+ if(impl.mSelectableControlInterface != nullptr)
+ {
+ impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, impl.mEventData->mPrimaryCursorPosition, impl.mEventData->mPrimaryCursorPosition);
+ }
}
}