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-field-impl.cpp;h=12e915ba12a6b9230d79c706591acd084f25cd3c;hp=c6fd205cecc7032beee401bb006ed345f1b1bbf4;hb=ca9703cadb3d41264c9b39f2a594f5171f606dbd;hpb=0f19aa986501f6b51de786a08b1fcfda00b849d8 diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index c6fd205..12e915b 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -147,6 +147,7 @@ DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "anchorClicked", SIGNAL_ANC 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 @@ -1301,6 +1302,14 @@ bool TextField::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* 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 @@ -1345,6 +1354,11 @@ DevelTextField::SelectionChangedSignalType& TextField::SelectionChangedSignal() return mSelectionChangedSignal; } +DevelTextField::SelectionClearedSignalType& TextField::SelectionClearedSignal() +{ + return mSelectionClearedSignal; +} + void TextField::OnInitialize() { Actor self = Self(); @@ -1387,6 +1401,7 @@ void TextField::OnInitialize() // Forward input events to controller EnableGestureDetection(static_cast(GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS)); GetTapGestureDetector().SetMaximumTapsRequired(2); + GetTapGestureDetector().ReceiveAllTapEvents(true); self.TouchedSignal().Connect(this, &TextField::OnTouched); @@ -1551,6 +1566,11 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) 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. @@ -1947,10 +1967,22 @@ void TextField::EmitSelectionChangedSignal() 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; @@ -2103,7 +2135,8 @@ TextField::TextField() mHasBeenStaged(false), mTextChanged(false), mCursorPositionChanged(false), - mSelectionChanged(false) + mSelectionChanged(false), + mSelectionCleared(false) { }