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
// Forward input events to controller
EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS));
GetTapGestureDetector().SetMaximumTapsRequired(2);
+ GetTapGestureDetector().ReceiveAllTapEvents(true);
self.TouchedSignal().Connect(this, &TextEditor::OnTouched);
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),
+ mOldPosition(0u),
+ mOldSelectionStart(0u),
+ mOldSelectionEnd(0u)
{
}