X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-editor-impl.cpp;h=77cd93d9921db0d4389582924dfe36c1a75dfcaf;hp=823606449c5909042a247cfc66a8912057bdd551;hb=183bdd4e867d8daad0b91a1ea717cc28a53bf28d;hpb=d75bd90eefea3cac2142fb8dba0aedf1bcbdc86f diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 8236064..77cd93d 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -160,6 +160,7 @@ DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "anchorClicked", SIGNAL_AN 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 @@ -1329,6 +1330,11 @@ DevelTextEditor::SelectionChangedSignalType& TextEditor::SelectionChangedSignal( return mSelectionChangedSignal; } +DevelTextEditor::SelectionClearedSignalType& TextEditor::SelectionClearedSignal() +{ + return mSelectionClearedSignal; +} + Text::ControllerPtr TextEditor::GetTextController() { return mController; @@ -1389,6 +1395,14 @@ bool TextEditor::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* 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 @@ -1631,6 +1645,11 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) 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. @@ -2010,10 +2029,22 @@ void TextEditor::EmitSelectionChangedSignal() 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; @@ -2307,7 +2338,8 @@ TextEditor::TextEditor() mScrollStarted(false), mTextChanged(false), mCursorPositionChanged(false), - mSelectionChanged(false) + mSelectionChanged(false), + mSelectionCleared(false) { }