From: Bowon Ryu Date: Fri, 21 May 2021 09:53:23 +0000 (+0900) Subject: Add InputMethodSettings property to TextEditor. X-Git-Tag: dali_2.0.29~2^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=f7e6a8dfa8b498ba261cb66b9842d50d9d2c0e2f;hp=7b0a5bf74a046c338390642c263610eef7164472 Add InputMethodSettings property to TextEditor. This property is provided in TextField. TextEditor also needs a property that controls the options of the input method. Change-Id: Idc0d8252180f547e84072981fb5ff9bd4bebf00b Signed-off-by: Bowon Ryu --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index fd0a18e..fa48c76 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -106,6 +106,7 @@ const char* const PROPERTY_NAME_MAX_LENGTH = "maxLengt const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale"; const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor"; const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup"; +const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings"; const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f ); const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color. @@ -513,6 +514,7 @@ int UtcDaliTextEditorGetPropertyP(void) DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_MAX_LENGTH ) == DevelTextEditor::Property::MAX_LENGTH ); DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_COLOR ) == DevelTextEditor::Property::GRAB_HANDLE_COLOR ); DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP ) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP ); + DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_METHOD_SETTINGS ) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS ); END_TEST; } @@ -935,6 +937,38 @@ int UtcDaliTextEditorSetPropertyP(void) editor.SetProperty( DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false ); DALI_TEST_EQUALS( editor.GetProperty( DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP ), false, TEST_LOCATION); + // Check the input method setting + Property::Map propertyMap; + InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER; + InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD; + InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO; + int inputVariation = 1; + propertyMap["PANEL_LAYOUT"] = panelLayout; + propertyMap["AUTO_CAPITALIZE"] = autoCapital; + propertyMap["BUTTON_ACTION"] = buttonAction; + propertyMap["VARIATION"] = inputVariation; + editor.SetProperty( DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap ); + + Property::Value value = editor.GetProperty( DevelTextEditor::Property::INPUT_METHOD_SETTINGS ); + Property::Map map; + DALI_TEST_CHECK( value.Get( map ) ); + + int layout = 0; + DALI_TEST_CHECK( map[ "PANEL_LAYOUT" ].Get( layout ) ); + DALI_TEST_EQUALS( static_cast(panelLayout), layout, TEST_LOCATION ); + + int capital = 0; + DALI_TEST_CHECK( map[ "AUTO_CAPITALIZE" ].Get( capital ) ); + DALI_TEST_EQUALS( static_cast(autoCapital), capital, TEST_LOCATION ); + + int action = 0; + DALI_TEST_CHECK( map[ "BUTTON_ACTION" ].Get( action ) ); + DALI_TEST_EQUALS( static_cast(buttonAction), action, TEST_LOCATION ); + + int variation = 0; + DALI_TEST_CHECK( map[ "VARIATION" ].Get( variation ) ); + DALI_TEST_EQUALS( inputVariation, variation, TEST_LOCATION ); + application.SendNotification(); application.Render(); diff --git a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h index 4012afa..665af7a 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h @@ -194,6 +194,32 @@ enum Type * @note The default value is true, which means the grab handle popup is enabled by default. */ ENABLE_GRAB_HANDLE_POPUP, + + /** + * @brief The settings to relating to the System's Input Method, Key and Value. + * @details Name "inputMethodSettings", type Property::MAP. + * + * @note VARIATION key can be changed depending on PANEL_LAYOUT. + * For example, when PANEL_LAYOUT key is InputMethod::PanelLayout::NORMAL, + * then VARIATION would be among NORMAL, WITH_FILENAME, and WITH_PERSON_NAME in Dali::InputMethod::NormalLayout. + * For more information, see Dali::InputMethod::Category. + * + * Example Usage: + * @code + * Property::Map propertyMap; + * InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER; + * InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD; + * InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO; + * int inputVariation = 1; + * propertyMap["PANEL_LAYOUT"] = panelLayout; + * propertyMap["AUTO_CAPITALIZE"] = autoCapital; + * propertyMap["BUTTON_ACTION"] = buttonAction; + * propertyMap["VARIATION"] = inputVariation; + * + * editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap); + * @endcode + */ + INPUT_METHOD_SETTINGS, }; } // namespace Property 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 48e0118..1c60091 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -148,6 +148,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", 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) @@ -784,6 +785,22 @@ void TextEditor::SetProperty(BaseObject* object, Property::Index index, const Pr 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 } @@ -1150,6 +1167,13 @@ Property::Value TextEditor::GetProperty(BaseObject* object, Property::Index inde value = impl.mController->IsGrabHandlePopupEnabled(); break; } + case Toolkit::DevelTextEditor::Property::INPUT_METHOD_SETTINGS: + { + Property::Map map; + impl.mInputMethodOptions.RetrieveProperty(map); + value = map; + break; + } } //switch } @@ -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); diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h index d0609b6..2d30b33 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h @@ -409,6 +409,7 @@ private: // Data 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;