X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-event-handler.cpp;h=a84747b6d777fbe1208fe55a714244dae255c3ab;hp=c17c8205b31532c27eef4768dc4fd002d85c0c24;hb=2a7fa48bf8e3808822c354420b2cf273e9a493bd;hpb=950447e00422e94e22ce64a69a13ebf1235b12c6 diff --git a/dali-toolkit/internal/text/text-controller-event-handler.cpp b/dali-toolkit/internal/text/text-controller-event-handler.cpp index c17c820..a84747b 100644 --- a/dali-toolkit/internal/text/text-controller-event-handler.cpp +++ b/dali-toolkit/internal/text/text-controller-event-handler.cpp @@ -81,6 +81,13 @@ void Controller::EventHandler::KeyboardFocusLostEvent(Controller& controller) { if(EventData::INTERRUPTED != controller.mImpl->mEventData->mState) { + // Init selection position + if(controller.mImpl->mEventData->mState == EventData::SELECTING) + { + controller.mImpl->mEventData->mLeftSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; + controller.mImpl->mEventData->mRightSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; + } + controller.mImpl->ChangeState(EventData::INACTIVE); if(!controller.mImpl->IsShowingRealText()) @@ -247,12 +254,36 @@ bool Controller::EventHandler::KeyEvent(Controller& controller, const Dali::KeyE DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", &controller, keyString.c_str()); if(!controller.IsEditable()) return false; - if(!keyString.empty()) + std::string refinedKey = keyString; + if(controller.mImpl->mInputFilter != NULL && !refinedKey.empty()) + { + bool accepted = false; + bool rejected = false; + accepted = controller.mImpl->mInputFilter->Contains(Toolkit::InputFilter::Property::ACCEPTED, keyString); + rejected = controller.mImpl->mInputFilter->Contains(Toolkit::InputFilter::Property::REJECTED, keyString); + + if(!accepted) + { + // The filtered key is set to empty. + refinedKey = ""; + // Signal emits when the character to be inserted is filtered by the accepted filter. + controller.mImpl->mEditableControlInterface->InputFiltered(Toolkit::InputFilter::Property::ACCEPTED); + } + if(rejected) + { + // The filtered key is set to empty. + refinedKey = ""; + // Signal emits when the character to be inserted is filtered by the rejected filter. + controller.mImpl->mEditableControlInterface->InputFiltered(Toolkit::InputFilter::Property::REJECTED); + } + } + + if(!refinedKey.empty()) { // InputMethodContext is no longer handling key-events controller.mImpl->ClearPreEditFlag(); - controller.InsertText(keyString, COMMIT); + controller.InsertText(refinedKey, COMMIT); textChanged = true;