DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "anchorClicked", SIGNAL_ANCHOR_CLICKED )
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_TYPE_REGISTRATION_END()
// clang-format on
return mInputFilteredSignal;
}
+DevelTextEditor::SelectionChangedSignalType& TextEditor::SelectionChangedSignal()
+{
+ return mSelectionChangedSignal;
+}
+
Text::ControllerPtr TextEditor::GetTextController()
{
return mController;
editorImpl.InputFilteredSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_SELECTION_CHANGED))
+ {
+ if(editor)
+ {
+ Internal::TextEditor& editorImpl(GetImpl(editor));
+ editorImpl.SelectionChangedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
EmitCursorPositionChangedSignal();
}
+ if(mSelectionChanged)
+ {
+ EmitSelectionChangedSignal();
+ }
+
// 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.
mInputFilteredSignal.Emit(handle, type);
}
+void TextEditor::EmitSelectionChangedSignal()
+{
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mSelectionChangedSignal.Emit(handle, mOldSelectionStart, mOldSelectionEnd);
+ mSelectionChanged = false;
+}
+
+void TextEditor::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd)
+{
+ if(((oldStart != newStart) || (oldEnd != newEnd)) && !mSelectionChanged)
+ {
+ mSelectionChanged = true;
+ mOldSelectionStart = oldStart;
+ mOldSelectionEnd = oldEnd;
+
+ if(mOldSelectionStart > mOldSelectionEnd)
+ {
+ //swap
+ uint32_t temp = mOldSelectionStart;
+ mOldSelectionStart = mOldSelectionEnd;
+ mOldSelectionEnd = temp;
+ }
+ }
+}
+
void TextEditor::AddDecoration(Actor& actor, bool needsClipping)
{
if(actor)
mScrollBarEnabled(false),
mScrollStarted(false),
mTextChanged(false),
- mCursorPositionChanged(false)
+ mCursorPositionChanged(false),
+ mSelectionChanged(false)
{
}