From: Seoyeon Kim Date: Tue, 1 Jun 2021 09:35:42 +0000 (+0000) Subject: Merge "[AT-SPI] Add SetTextContents, InsertText and DeleteText" into devel/master X-Git-Tag: dali_2.0.29~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=ec503e92aa01bc67f8ea118cf14aa3b1ed9d390e;hp=-c Merge "[AT-SPI] Add SetTextContents, InsertText and DeleteText" into devel/master --- ec503e92aa01bc67f8ea118cf14aa3b1ed9d390e diff --combined dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 1c60091,be18ec5..9b9e7d9 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@@ -148,7 -148,6 +148,7 @@@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolki DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputMethodSettings", MAP, INPUT_METHOD_SETTINGS ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED) @@@ -785,22 -784,6 +785,22 @@@ void TextEditor::SetProperty(BaseObject impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled); break; } + case Toolkit::DevelTextEditor::Property::INPUT_METHOD_SETTINGS: + { + const Property::Map* map = value.GetMap(); + if(map) + { + impl.mInputMethodOptions.ApplyProperty(*map); + } + impl.mController->SetInputModePassword(impl.mInputMethodOptions.IsPassword()); + + Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl(); + if(control == textEditor) + { + impl.mInputMethodContext.ApplyOptions(impl.mInputMethodOptions); + } + break; + } } // switch } // texteditor } @@@ -1167,13 -1150,6 +1167,13 @@@ Property::Value TextEditor::GetProperty value = impl.mController->IsGrabHandlePopupEnabled(); break; } + case Toolkit::DevelTextEditor::Property::INPUT_METHOD_SETTINGS: + { + Property::Map map; + impl.mInputMethodOptions.RetrieveProperty(map); + value = map; + break; + } } //switch } @@@ -1593,7 -1569,6 +1593,7 @@@ void TextEditor::OnKeyInputFocusGained( if(mInputMethodContext && IsEditable()) { // All input panel properties, such as layout, return key type, and input hint, should be set before input panel activates (or shows). + mInputMethodContext.ApplyOptions(mInputMethodOptions); mInputMethodContext.NotifyTextInputMultiLine(true); mInputMethodContext.StatusChangedSignal().Connect(this, &TextEditor::KeyboardStatusChanged); @@@ -2286,7 -2261,22 +2286,22 @@@ bool TextEditor::AccessibleImpl::CutTex Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition)); slf.SetProperty(Toolkit::TextEditor::Property::TEXT, - txt.substr(0, startPosition) + txt.substr(endPosition - startPosition, txt.size())); + txt.substr(0, startPosition) + txt.substr(endPosition)); + + return true; + } + + bool TextEditor::AccessibleImpl::DeleteText(size_t startPosition, + size_t endPosition) + { + if(endPosition <= startPosition) + return false; + + auto slf = Toolkit::TextEditor::DownCast(Self()); + auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get(); + + slf.SetProperty(Toolkit::TextEditor::Property::TEXT, + txt.substr(0, startPosition) + txt.substr(endPosition)); return true; } @@@ -2308,6 -2298,26 +2323,26 @@@ Dali::Accessibility::States TextEditor: return states; } + bool TextEditor::AccessibleImpl::InsertText(size_t startPosition, + std::string text) + { + auto slf = Toolkit::TextEditor::DownCast(Self()); + auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get(); + + txt.insert(startPosition, text); + + slf.SetProperty(Toolkit::TextEditor::Property::TEXT, std::move(txt)); + + return true; + } + + bool TextEditor::AccessibleImpl::SetTextContents(std::string newContents) + { + auto slf = Toolkit::TextEditor::DownCast(Self()); + slf.SetProperty(Toolkit::TextEditor::Property::TEXT, std::move(newContents)); + return true; + } + } // namespace Internal } // namespace Toolkit diff --combined dali-toolkit/internal/controls/text-controls/text-editor-impl.h index 2d30b33,eb3bae4..9a06ea5 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h @@@ -409,7 -409,6 +409,7 @@@ private: // Dat Dali::Animation mAnimation; ///< Scroll indicator Show/Hide Animation. Dali::TimePeriod mAnimationPeriod; std::vector mClippingDecorationActors; ///< Decoration actors which need clipping. + Dali::InputMethodOptions mInputMethodOptions; Actor mRenderableActor; Actor mActiveLayer; @@@ -443,6 -442,9 +443,9 @@@ bool CopyText(size_t startPosition, size_t endPosition) override; bool CutText(size_t startPosition, size_t endPosition) override; Accessibility::States CalculateStates() override; + bool InsertText(size_t startPosition, std::string text) override; + bool SetTextContents(std::string newContents) override; + bool DeleteText(size_t startPosition, size_t endPosition) override; }; };