From 9fe23ca526ea089073c143b0a6d34f37f5c2dd6f Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Thu, 2 Feb 2017 18:08:30 +0900 Subject: [PATCH] Modified ImfManager to include virtual keyboard APIs Signed-off-by: suhyung Eom Change-Id: I578063c3f2f9c282dda06903fe06825ff90946f4 --- adaptors/common/locale-utils.cpp | 204 ++++++++++----------- adaptors/common/locale-utils.h | 6 +- .../devel-api/adaptor-framework/imf-manager.cpp | 30 +++ adaptors/devel-api/adaptor-framework/imf-manager.h | 73 ++++++++ .../adaptor-framework/input-method-devel.h | 166 +++++++++++++++++ .../adaptor-framework/input-method-options.cpp | 166 +++++++++++++++++ .../adaptor-framework/input-method-options.h | 78 ++++++++ .../adaptor-framework/virtual-keyboard.cpp | 2 +- adaptors/devel-api/file.list | 3 + adaptors/ecore/common/ecore-virtual-keyboard.cpp | 25 ++- .../ecore/wayland/imf-manager-impl-ecore-wl.cpp | 177 +++++++++++++++++- adaptors/ecore/wayland/imf-manager-impl.h | 37 ++++ adaptors/integration-api/x11/imf-manager-impl.h | 36 ++++ .../wayland/input/text/imf/imf-manager-impl-wl.cpp | 18 +- adaptors/wayland/input/text/imf/imf-manager-impl.h | 36 ++++ adaptors/wayland/input/text/text-input-manager.cpp | 2 +- adaptors/wayland/input/text/text-input-manager.h | 2 +- adaptors/x11/imf-manager-impl-x.cpp | 66 +++++++ 18 files changed, 1008 insertions(+), 119 deletions(-) create mode 100644 adaptors/devel-api/adaptor-framework/input-method-devel.h create mode 100644 adaptors/devel-api/adaptor-framework/input-method-options.cpp create mode 100644 adaptors/devel-api/adaptor-framework/input-method-options.h mode change 100755 => 100644 adaptors/devel-api/file.list diff --git a/adaptors/common/locale-utils.cpp b/adaptors/common/locale-utils.cpp index 2389eeb..d14856b 100644 --- a/adaptors/common/locale-utils.cpp +++ b/adaptors/common/locale-utils.cpp @@ -30,10 +30,6 @@ namespace Adaptor namespace Locale { -using Dali::VirtualKeyboard::TextDirection; -using Dali::VirtualKeyboard::LeftToRight; -using Dali::VirtualKeyboard::RightToLeft; - namespace { @@ -41,115 +37,115 @@ struct LocaleDirection { const char * locale; const char * name; - TextDirection direction; + Dali::ImfManager::TextDirection direction; }; const LocaleDirection LOCALE_DIRECTION_LOOKUP_TABLE[] = { - { "af", "Afrikaans", LeftToRight }, - { "am", "Amharic", LeftToRight }, - { "ar", "Arabic", RightToLeft }, - { "as", "Assamese", LeftToRight }, - { "az", "Azeri", LeftToRight }, - { "be", "Belarusian", LeftToRight }, - { "bg", "Bulgarian", LeftToRight }, - { "bn", "Bengali", LeftToRight }, - { "bo", "Tibetan", LeftToRight }, - { "bs", "Bosnian", LeftToRight }, - { "ca", "Catalan", LeftToRight }, - { "cs", "Czech", LeftToRight }, - { "cy", "Welsh", LeftToRight }, - { "da", "Danish", LeftToRight }, - { "de", "German", LeftToRight }, - { "dv", "Divehi", RightToLeft }, - { "el", "Greek", LeftToRight }, - { "en", "English", LeftToRight }, - { "es", "Spanish", LeftToRight }, - { "et", "Estonian", LeftToRight }, - { "eu", "Basque", LeftToRight }, - { "fa", "Farsi", RightToLeft }, - { "fi", "Finnish", LeftToRight }, - { "fo", "Faroese", LeftToRight }, - { "fr", "French", LeftToRight }, - { "gd", "Gaelic", LeftToRight }, - { "gl", "Galician", LeftToRight }, - { "gn", "Guarani", LeftToRight }, - { "gu", "Gujarati", LeftToRight }, - { "he", "Hebrew", RightToLeft }, - { "hi", "Hindi", LeftToRight }, - { "hr", "Croatian", LeftToRight }, - { "hu", "Hungarian", LeftToRight }, - { "hy", "Armenian", LeftToRight }, - { "id", "Indonesian", LeftToRight }, - { "is", "Icelandic", LeftToRight }, - { "it", "Italian", LeftToRight }, - { "ja", "Japanese", LeftToRight }, - { "ka", "Georgian", LeftToRight }, - { "kk", "Kazakh", RightToLeft }, - { "km", "Khmer", LeftToRight }, - { "kn", "Kannada", LeftToRight }, - { "ko", "Korean", LeftToRight }, - { "ks", "Kashmiri", RightToLeft }, - { "la", "Latin", LeftToRight }, - { "lo", "Lao", LeftToRight }, - { "lt", "Lithuanian", LeftToRight }, - { "lv", "Latvian", LeftToRight }, - { "mi", "Maori", LeftToRight }, - { "mk", "FYRO Macedonia", LeftToRight }, - { "ml", "Malayalam", LeftToRight }, - { "mn", "Mongolian", LeftToRight }, - { "mr", "Marathi", LeftToRight }, - { "ms", "Malay", LeftToRight }, - { "mt", "Maltese", LeftToRight }, - { "my", "Burmese", LeftToRight }, - { "nb", "Norwegian: Bokml", LeftToRight }, - { "ne", "Nepali", LeftToRight }, - { "nl", "Dutch", LeftToRight }, - { "nn", "Norwegian: Nynorsk", LeftToRight }, - { "or", "Oriya", LeftToRight }, - { "pa", "Punjabi", LeftToRight }, - { "pl", "Polish", LeftToRight }, - { "pt", "Portuguese", LeftToRight }, - { "rm", "Raeto-Romance", LeftToRight }, - { "ro", "Romanian", LeftToRight }, - { "ru", "Russian", LeftToRight }, - { "sa", "Sanskrit", LeftToRight }, - { "sb", "Sorbian", LeftToRight }, - { "sd", "Sindhi", LeftToRight }, - { "si", "Sinhala", LeftToRight }, - { "sk", "Slovak", LeftToRight }, - { "sl", "Slovenian", LeftToRight }, - { "so", "Somali", LeftToRight }, - { "sq", "Albanian", LeftToRight }, - { "sr", "Serbian", LeftToRight }, - { "sv", "Swedish", LeftToRight }, - { "sw", "Swahili", LeftToRight }, - { "ta", "Tamil", LeftToRight }, - { "te", "Telugu", LeftToRight }, - { "tg", "Tajik", RightToLeft }, - { "th", "Thai", LeftToRight }, - { "tk", "Turkmen", LeftToRight }, - { "tn", "Setsuana", LeftToRight }, - { "tr", "Turkish", LeftToRight }, - { "ts", "Tsonga", LeftToRight }, - { "tt", "Tatar", LeftToRight }, - { "uk", "Ukrainian", LeftToRight }, - { "ur", "Urdu", RightToLeft }, - { "uz", "Uzbek", LeftToRight }, - { "vi", "Vietnamese", LeftToRight }, - { "xh", "Xhosa", LeftToRight }, - { "yi", "Yiddish", RightToLeft }, - { "zh", "Chinese", LeftToRight }, - { "zu", "Zulu", LeftToRight }, - - { NULL, NULL, LeftToRight } + { "af", "Afrikaans", Dali::ImfManager::LeftToRight }, + { "am", "Amharic", Dali::ImfManager::LeftToRight }, + { "ar", "Arabic", Dali::ImfManager::RightToLeft }, + { "as", "Assamese", Dali::ImfManager::LeftToRight }, + { "az", "Azeri", Dali::ImfManager::LeftToRight }, + { "be", "Belarusian", Dali::ImfManager::LeftToRight }, + { "bg", "Bulgarian", Dali::ImfManager::LeftToRight }, + { "bn", "Bengali", Dali::ImfManager::LeftToRight }, + { "bo", "Tibetan", Dali::ImfManager::LeftToRight }, + { "bs", "Bosnian", Dali::ImfManager::LeftToRight }, + { "ca", "Catalan", Dali::ImfManager::LeftToRight }, + { "cs", "Czech", Dali::ImfManager::LeftToRight }, + { "cy", "Welsh", Dali::ImfManager::LeftToRight }, + { "da", "Danish", Dali::ImfManager::LeftToRight }, + { "de", "German", Dali::ImfManager::LeftToRight }, + { "dv", "Divehi", Dali::ImfManager::RightToLeft }, + { "el", "Greek", Dali::ImfManager::LeftToRight }, + { "en", "English", Dali::ImfManager::LeftToRight }, + { "es", "Spanish", Dali::ImfManager::LeftToRight }, + { "et", "Estonian", Dali::ImfManager::LeftToRight }, + { "eu", "Basque", Dali::ImfManager::LeftToRight }, + { "fa", "Farsi", Dali::ImfManager::RightToLeft }, + { "fi", "Finnish", Dali::ImfManager::LeftToRight }, + { "fo", "Faroese", Dali::ImfManager::LeftToRight }, + { "fr", "French", Dali::ImfManager::LeftToRight }, + { "gd", "Gaelic", Dali::ImfManager::LeftToRight }, + { "gl", "Galician", Dali::ImfManager::LeftToRight }, + { "gn", "Guarani", Dali::ImfManager::LeftToRight }, + { "gu", "Gujarati", Dali::ImfManager::LeftToRight }, + { "he", "Hebrew", Dali::ImfManager::RightToLeft }, + { "hi", "Hindi", Dali::ImfManager::LeftToRight }, + { "hr", "Croatian", Dali::ImfManager::LeftToRight }, + { "hu", "Hungarian", Dali::ImfManager::LeftToRight }, + { "hy", "Armenian", Dali::ImfManager::LeftToRight }, + { "id", "Indonesian", Dali::ImfManager::LeftToRight }, + { "is", "Icelandic", Dali::ImfManager::LeftToRight }, + { "it", "Italian", Dali::ImfManager::LeftToRight }, + { "ja", "Japanese", Dali::ImfManager::LeftToRight }, + { "ka", "Georgian", Dali::ImfManager::LeftToRight }, + { "kk", "Kazakh", Dali::ImfManager::RightToLeft }, + { "km", "Khmer", Dali::ImfManager::LeftToRight }, + { "kn", "Kannada", Dali::ImfManager::LeftToRight }, + { "ko", "Korean", Dali::ImfManager::LeftToRight }, + { "ks", "Kashmiri", Dali::ImfManager::RightToLeft }, + { "la", "Latin", Dali::ImfManager::LeftToRight }, + { "lo", "Lao", Dali::ImfManager::LeftToRight }, + { "lt", "Lithuanian", Dali::ImfManager::LeftToRight }, + { "lv", "Latvian", Dali::ImfManager::LeftToRight }, + { "mi", "Maori", Dali::ImfManager::LeftToRight }, + { "mk", "FYRO Macedonia", Dali::ImfManager::LeftToRight }, + { "ml", "Malayalam", Dali::ImfManager::LeftToRight }, + { "mn", "Mongolian", Dali::ImfManager::LeftToRight }, + { "mr", "Marathi", Dali::ImfManager::LeftToRight }, + { "ms", "Malay", Dali::ImfManager::LeftToRight }, + { "mt", "Maltese", Dali::ImfManager::LeftToRight }, + { "my", "Burmese", Dali::ImfManager::LeftToRight }, + { "nb", "Norwegian: Bokml", Dali::ImfManager::LeftToRight }, + { "ne", "Nepali", Dali::ImfManager::LeftToRight }, + { "nl", "Dutch", Dali::ImfManager::LeftToRight }, + { "nn", "Norwegian: Nynorsk", Dali::ImfManager::LeftToRight }, + { "or", "Oriya", Dali::ImfManager::LeftToRight }, + { "pa", "Punjabi", Dali::ImfManager::LeftToRight }, + { "pl", "Polish", Dali::ImfManager::LeftToRight }, + { "pt", "Portuguese", Dali::ImfManager::LeftToRight }, + { "rm", "Raeto-Romance", Dali::ImfManager::LeftToRight }, + { "ro", "Romanian", Dali::ImfManager::LeftToRight }, + { "ru", "Russian", Dali::ImfManager::LeftToRight }, + { "sa", "Sanskrit", Dali::ImfManager::LeftToRight }, + { "sb", "Sorbian", Dali::ImfManager::LeftToRight }, + { "sd", "Sindhi", Dali::ImfManager::LeftToRight }, + { "si", "Sinhala", Dali::ImfManager::LeftToRight }, + { "sk", "Slovak", Dali::ImfManager::LeftToRight }, + { "sl", "Slovenian", Dali::ImfManager::LeftToRight }, + { "so", "Somali", Dali::ImfManager::LeftToRight }, + { "sq", "Albanian", Dali::ImfManager::LeftToRight }, + { "sr", "Serbian", Dali::ImfManager::LeftToRight }, + { "sv", "Swedish", Dali::ImfManager::LeftToRight }, + { "sw", "Swahili", Dali::ImfManager::LeftToRight }, + { "ta", "Tamil", Dali::ImfManager::LeftToRight }, + { "te", "Telugu", Dali::ImfManager::LeftToRight }, + { "tg", "Tajik", Dali::ImfManager::RightToLeft }, + { "th", "Thai", Dali::ImfManager::LeftToRight }, + { "tk", "Turkmen", Dali::ImfManager::LeftToRight }, + { "tn", "Setsuana", Dali::ImfManager::LeftToRight }, + { "tr", "Turkish", Dali::ImfManager::LeftToRight }, + { "ts", "Tsonga", Dali::ImfManager::LeftToRight }, + { "tt", "Tatar", Dali::ImfManager::LeftToRight }, + { "uk", "Ukrainian", Dali::ImfManager::LeftToRight }, + { "ur", "Urdu", Dali::ImfManager::RightToLeft }, + { "uz", "Uzbek", Dali::ImfManager::LeftToRight }, + { "vi", "Vietnamese", Dali::ImfManager::LeftToRight }, + { "xh", "Xhosa", Dali::ImfManager::LeftToRight }, + { "yi", "Yiddish", Dali::ImfManager::RightToLeft }, + { "zh", "Chinese", Dali::ImfManager::LeftToRight }, + { "zu", "Zulu", Dali::ImfManager::LeftToRight }, + + { NULL, NULL, Dali::ImfManager::LeftToRight } }; } // unnamed namespace -TextDirection GetTextDirection( std::string locale ) +Dali::ImfManager::TextDirection GetTextDirection( std::string locale ) { - TextDirection direction( LeftToRight ); + Dali::ImfManager::TextDirection direction( Dali::ImfManager::LeftToRight ); if ( !locale.empty() && locale.size() > 2 ) { diff --git a/adaptors/common/locale-utils.h b/adaptors/common/locale-utils.h index 0db57a9..b04182b 100644 --- a/adaptors/common/locale-utils.h +++ b/adaptors/common/locale-utils.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_LOCALE_UTILS_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { @@ -36,7 +36,7 @@ namespace Adaptor namespace Locale { -Dali::VirtualKeyboard::TextDirection GetTextDirection( std::string locale ); +Dali::ImfManager::TextDirection GetTextDirection( std::string locale ); } // namespace Locale diff --git a/adaptors/devel-api/adaptor-framework/imf-manager.cpp b/adaptors/devel-api/adaptor-framework/imf-manager.cpp index 4410609..33826c3 100644 --- a/adaptors/devel-api/adaptor-framework/imf-manager.cpp +++ b/adaptors/devel-api/adaptor-framework/imf-manager.cpp @@ -93,6 +93,21 @@ void ImfManager::NotifyTextInputMultiLine( bool multiLine ) Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyTextInputMultiLine( multiLine ); } +ImfManager::TextDirection ImfManager::GetTextDirection() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).GetTextDirection(); +} + +Rect ImfManager::GetInputMethodArea() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputMethodArea(); +} + +void ImfManager::ApplyOptions( const InputMethodOptions& options ) +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options ); +} + ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal() { return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal(); @@ -103,6 +118,21 @@ ImfManager::ImfEventSignalType& ImfManager::EventReceivedSignal() return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal(); } +ImfManager::StatusSignalType& ImfManager::StatusChangedSignal() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).StatusChangedSignal(); +} + +ImfManager::VoidSignalType& ImfManager::ResizedSignal() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).ResizedSignal(); +} + +ImfManager::VoidSignalType& ImfManager::LanguageChangedSignal() +{ + return Internal::Adaptor::ImfManager::GetImplementation(*this).LanguageChangedSignal(); +} + ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl) : BaseHandle(impl) { diff --git a/adaptors/devel-api/adaptor-framework/imf-manager.h b/adaptors/devel-api/adaptor-framework/imf-manager.h index 8123b9d..b3ead5c 100644 --- a/adaptors/devel-api/adaptor-framework/imf-manager.h +++ b/adaptors/devel-api/adaptor-framework/imf-manager.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include "input-method-options.h" namespace Dali { @@ -43,6 +44,15 @@ class DALI_IMPORT_API ImfManager : public BaseHandle public: /** + * @brief The direction of text. + */ + enum TextDirection + { + LeftToRight, + RightToLeft, + }; + + /** * @brief Events that are generated by the IMF. */ enum ImfEvent @@ -132,6 +142,8 @@ public: typedef Signal< void (ImfManager&) > ImfManagerSignalType; ///< Keyboard actived signal typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType; ///< keyboard events + typedef Signal< void () > VoidSignalType; + typedef Signal< void (bool) > StatusSignalType; public: @@ -218,6 +230,30 @@ public: */ void NotifyTextInputMultiLine( bool multiLine ); + /** + * @brief Returns text direction of the keyboard's current input language. + * @return The direction of the text. + */ + TextDirection GetTextDirection(); + + /** + * @brief Provides size and position of keyboard. + * + * Position is relative to whether keyboard is visible or not. + * If keyboard is not visible then position will be off the screen. + * If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get + * the values then taken down. So ideally GetInputMethodArea() should be called after Show(). + * @return rect which is keyboard panel x, y, width, height + */ + Dali::Rect GetInputMethodArea(); + + /** + * @brief Set one or more of the Input Method options + * @param[in] options The options to be applied + */ + void ApplyOptions( const InputMethodOptions& options ); + + public: // Signals @@ -236,6 +272,43 @@ public: */ ImfEventSignalType& EventReceivedSignal(); + /** + * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(bool keyboardShown); + * @endcode + * If the parameter keyboardShown is true, then the keyboard has just shown, if it is false, then it + * has just been hidden. + * @return The signal to connect to. + */ + StatusSignalType& StatusChangedSignal(); + + /** + * @brief Connect to this signal to be notified when the virtual keyboard is resized. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(); + * @endcode + * User can get changed size by using GetInputMethodArea() in the callback + * @return The signal to connect to. + */ + VoidSignalType& ResizedSignal(); + + /** + * @brief Connect to this signal to be notified when the virtual keyboard's language is changed. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(); + * @endcode + * User can get the text direction of the language by calling GetTextDirection() in the callback. + * @return The signal to connect to. + */ + VoidSignalType& LanguageChangedSignal(); + // Construction & Destruction /** diff --git a/adaptors/devel-api/adaptor-framework/input-method-devel.h b/adaptors/devel-api/adaptor-framework/input-method-devel.h new file mode 100644 index 0000000..5d0f455 --- /dev/null +++ b/adaptors/devel-api/adaptor-framework/input-method-devel.h @@ -0,0 +1,166 @@ +#ifndef __DALI_INPUT_MEHTOD_DEVEL_H__ +#define __DALI_INPUT_MEHTOD_DEVEL_H__ + +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ +/** + * @addtogroup dali_adaptor_framework + * @{ + */ +namespace InputMethod +{ + +/** + * @brief SetType that can be changed in the system Input Method + * + * Key types of map to change virtual keyboard settings in INPUT_METHOD_SETTINGS property + * + */ +namespace Category +{ + enum Type + { + PANEL_LAYOUT, ///< Set Keyboard layout + ACTION_BUTTON_TITLE, ///< Set Action button title + AUTO_CAPITALISE, ///< Set Auto capitalise of input + VARIATION, ///< Set variation + }; +} + +/** + * @brief Autocapitalization Types + * + */ +namespace AutoCapital +{ + enum Type + { + NONE, ///< No auto-capitalization when typing + WORD, ///< Autocapitalize each word typed + SENTENCE, ///< Autocapitalize the start of each sentence + ALLCHARACTER, ///< Autocapitalize all letters + }; +} + +/** + * @brief Input panel (virtual keyboard) layout types. + * + */ +namespace PanelLayout +{ + enum Type + { + NORMAL, ///< Default layout + NUMBER, ///< Number layout + EMAIL, ///< Email layout + URL, ///< URL layout + PHONENUMBER, ///< Phone Number layout + IP, ///< IP layout + MONTH, ///< Month layout + NUMBERONLY, ///< Number Only layout + HEX, ///< Hexadecimal layout + TERMINAL, ///< Command-line terminal layout including ESC, Alt, Ctrl key, so on (no auto-correct, no auto-capitalization) + PASSWORD, ///< Like normal, but no auto-correct, no auto-capitalization etc + DATETIME, ///< Date and time layout + EMOTICON, ///< Emoticon layout + }; +} + +/** + * @brief Specifies what the Input Method "action" button functionality is set to. + * + * The 'Action' button is traditionally the [RETURN] or [DONE] button. + * + */ +namespace ActionButtonTitle +{ + enum Type + { + DEFAULT, ///< Default action + DONE, ///< Done + GO, ///< Go action + JOIN, ///< Join action + LOGIN, ///< Login action + NEXT, ///< Next action + PREVIOUS, ///< Previous action + SEARCH, ///< Search action + SEND, ///< Send action + SIGNIN, ///< Sign in action + UNSPECIFIED, ///< Unspecified action + NONE ///< Nothing to do + }; +} + +/** + * @brief Available variation for Normal layout + * + * + */ +namespace NormalLayout +{ + enum Type + { + NORMAL, ///< The plain normal layout + WITH_FILENAME, ///< Filename layout. Symbols such as '/' should be disabled + WITH_PERSON_NAME ///< The name of a person + }; +} + +/** + * @brief Available variation for Number only layout + * + * + */ +namespace NumberOnlyLayout +{ + enum Type + { + NORMAL, ///< The plain normal number layout + WITH_SIGNED, ///< The number layout to allow a positive or negative sign at the start + WITH_DECIMAL, ///< The number layout to allow decimal point to provide fractional value + WITH_SIGNED_AND_DECIMAL ///< The number layout to allow decimal point and negative sign + }; +} + +/** + * @brief Available variation for Password layout + * + * + */ +namespace PasswordLayout +{ + enum Type + { + NORMAL, ///< The normal password layout + WITH_NUMBERONLY ///< The password layout to allow only number + }; +} + +} // namespace InputMethod + +/** + * @} + */ +} // namespace Dali + +#endif // __DALI_INPUT_MEHTOD_DEVEL_H__ diff --git a/adaptors/devel-api/adaptor-framework/input-method-options.cpp b/adaptors/devel-api/adaptor-framework/input-method-options.cpp new file mode 100644 index 0000000..b2d0b00 --- /dev/null +++ b/adaptors/devel-api/adaptor-framework/input-method-options.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include + +using namespace Dali::InputMethod; +using namespace Dali::InputMethod::Category; + +namespace Dali +{ + +#define TOKEN_STRING(x) #x + +struct InputMethodOptions::Impl +{ + Impl() + { + mPanelLayout = PanelLayout::NORMAL; + mAutoCapital = AutoCapital::SENTENCE; + mActionButton = ActionButtonTitle::DEFAULT; + mVariation = NormalLayout::NORMAL; + } + + PanelLayout::Type mPanelLayout; + AutoCapital::Type mAutoCapital; + ActionButtonTitle::Type mActionButton; + int mVariation:4; +}; + +InputMethodOptions::InputMethodOptions() +{ + mImpl = new Impl( ); +} + +bool InputMethodOptions::IsPassword() +{ + return (mImpl->mPanelLayout == Dali::InputMethod::PanelLayout::PASSWORD); +} + +void InputMethodOptions::ApplyProperty( const Property::Map& settings ) +{ + for ( unsigned int i = 0, count = settings.Count(); i < count; ++i ) + { + Property::Key key = settings.GetKeyAt( i ); + if( key.type == Property::Key::INDEX ) + { + continue; + } + + Property::Value item = settings.GetValue(i); + + if( key == TOKEN_STRING( PANEL_LAYOUT ) ) + { + if( item.GetType() == Property::INTEGER ) + { + int value = item.Get< int >(); + mImpl->mPanelLayout = static_cast(value); + } + } + else if ( key == TOKEN_STRING( AUTO_CAPITALISE ) ) + { + if ( item.GetType() == Property::INTEGER ) + { + int value = item.Get< int >(); + mImpl->mAutoCapital = static_cast(value); + } + } + else if ( key == TOKEN_STRING( ACTION_BUTTON ) ) + { + if ( item.GetType() == Property::INTEGER ) + { + int value = item.Get< int >(); + mImpl->mActionButton = static_cast(value); + } + } + else if( key == TOKEN_STRING( VARIATION ) ) + { + if( item.GetType() == Property::INTEGER ) + { + int value = item.Get< int >(); + mImpl->mVariation = value; + } + } + else + { + } + } +} + +void InputMethodOptions::RetrieveProperty( Property::Map& settings ) +{ + settings[TOKEN_STRING( PANEL_LAYOUT )] = mImpl->mPanelLayout; + settings[TOKEN_STRING( AUTO_CAPITALISE )] = mImpl->mAutoCapital; + settings[TOKEN_STRING( ACTION_BUTTON )] = mImpl->mActionButton; + settings[TOKEN_STRING( VARIATION )] = mImpl->mVariation; +} + +bool InputMethodOptions::CompareAndSet( InputMethod::Category::Type type, const InputMethodOptions& options, int& index) +{ + bool updated = false; + + switch (type) + { + case PANEL_LAYOUT: + { + if ( options.mImpl->mPanelLayout != mImpl->mPanelLayout ) + { + mImpl->mPanelLayout = options.mImpl->mPanelLayout; + index = static_cast(mImpl->mPanelLayout); + updated = true; + } + break; + } + case AUTO_CAPITALISE: + { + if ( options.mImpl->mAutoCapital != mImpl->mAutoCapital ) + { + mImpl->mAutoCapital = options.mImpl->mAutoCapital; + index = static_cast(mImpl->mAutoCapital); + updated = true; + } + break; + } + case ACTION_BUTTON_TITLE: + { + if ( options.mImpl->mActionButton != mImpl->mActionButton ) + { + mImpl->mActionButton = options.mImpl->mActionButton; + index = static_cast(mImpl->mActionButton); + updated = true; + } + break; + } + case VARIATION: + { + if ( options.mImpl->mVariation != mImpl->mVariation ) + { + mImpl->mVariation = options.mImpl->mVariation; + index = static_cast(mImpl->mVariation); + updated = true; + } + break; + } + } + return updated; +} + +} // namespace Dali diff --git a/adaptors/devel-api/adaptor-framework/input-method-options.h b/adaptors/devel-api/adaptor-framework/input-method-options.h new file mode 100644 index 0000000..b2e98e2 --- /dev/null +++ b/adaptors/devel-api/adaptor-framework/input-method-options.h @@ -0,0 +1,78 @@ +#ifndef __DALI_VIRTUAL_KEYBOARD_OPTIONS_H__ +#define __DALI_VIRTUAL_KEYBOARD_OPTIONS_H__ + +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "input-method-devel.h" + +namespace Dali +{ + +/** + * Class to handle the Input Method options + */ +class DALI_IMPORT_API InputMethodOptions +{ +public: + + /** + * Constructor + */ + InputMethodOptions(); /// Default InputMethodOptions options + + /** + * @brief Returns whether panel layout type is password or not + * @return true if panel layout type is password, false otherwise. + */ + bool IsPassword(); + + /** + * @brief Apply property map to attribute class, this class will keep the virtualKeyboard settings. + * @param[in] settings The property map to be applied + */ + void ApplyProperty( const Property::Map& settings ); + + /** + * @brief Retrieve property map from current option + * @param[out] settings The converted property map + */ + void RetrieveProperty( Property::Map& settings ); + +public: // Intended for internal use + /** + * @brief Set option respectively + * @param[in] type The type of source option will be updated + * @param[in] options The source option to be applied + * @param[out] index The updated index after applying source option + * @return true if the value of this option is updated by source option + */ + DALI_INTERNAL bool CompareAndSet( InputMethod::Category::Type type, const InputMethodOptions& options, int& index ); + +private: + + struct Impl; + Impl* mImpl; +}; + +} // namespace Dali + +#endif // __DALI_VIRTUAL_KEYBOARD_OPTIONS_H__ diff --git a/adaptors/devel-api/adaptor-framework/virtual-keyboard.cpp b/adaptors/devel-api/adaptor-framework/virtual-keyboard.cpp index 50fa03e..f79d442 100644 --- a/adaptors/devel-api/adaptor-framework/virtual-keyboard.cpp +++ b/adaptors/devel-api/adaptor-framework/virtual-keyboard.cpp @@ -52,7 +52,7 @@ void SetReturnKeyType( const InputMethod::ActionButton type ) Internal::Adaptor::VirtualKeyboard::SetReturnKeyType( type ); } -InputMethod::ActionButton GetReturnKeyType() +InputMethod::ActionButton GetReturnKeyType() { return Internal::Adaptor::VirtualKeyboard::GetReturnKeyType(); } diff --git a/adaptors/devel-api/file.list b/adaptors/devel-api/file.list old mode 100755 new mode 100644 index b1eb120..d86aca8 --- a/adaptors/devel-api/file.list +++ b/adaptors/devel-api/file.list @@ -15,6 +15,7 @@ devel_api_src_files = \ $(adaptor_devel_api_dir)/adaptor-framework/image-loading.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/gif-loading.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/imf-manager.cpp \ + $(adaptor_devel_api_dir)/adaptor-framework/input-method-options.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/orientation.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/performance-logger.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/physical-keyboard.cpp \ @@ -47,6 +48,8 @@ devel_api_adaptor_framework_header_files = \ $(adaptor_devel_api_dir)/adaptor-framework/image-loading.h \ $(adaptor_devel_api_dir)/adaptor-framework/gif-loading.h \ $(adaptor_devel_api_dir)/adaptor-framework/imf-manager.h \ + $(adaptor_devel_api_dir)/adaptor-framework/input-method-devel.h \ + $(adaptor_devel_api_dir)/adaptor-framework/input-method-options.h \ $(adaptor_devel_api_dir)/adaptor-framework/lifecycle-controller.h \ $(adaptor_devel_api_dir)/adaptor-framework/orientation.h \ $(adaptor_devel_api_dir)/adaptor-framework/performance-logger.h \ diff --git a/adaptors/ecore/common/ecore-virtual-keyboard.cpp b/adaptors/ecore/common/ecore-virtual-keyboard.cpp index ffb603b..dfb5649 100644 --- a/adaptors/ecore/common/ecore-virtual-keyboard.cpp +++ b/adaptors/ecore/common/ecore-virtual-keyboard.cpp @@ -133,6 +133,8 @@ void DisconnectCallbacks( Ecore_IMF_Context *imfContext ) void Show() { + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Show() is deprecated and will be removed from next release. Use ImfManager.Activate() instead.\n" ); + Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) to show the keyboard if( imfManager ) @@ -148,6 +150,8 @@ void Show() void Hide() { + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Hide() is deprecated and will be removed from next release. Use ImfManager.Deactivate() instead.\n" ); + if( ImfManager::IsAvailable() /* We do not want to create an ImfManager instance*/ ) { Dali::ImfManager imfManager = ImfManager::Get(); @@ -162,6 +166,8 @@ void Hide() bool IsVisible() { + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsVisible() is deprecated and will be removed from next release.\n" ); + if( ImfManager::IsAvailable() /* We do not want to create an ImfManager instance */ ) { DALI_LOG_INFO( gLogFilter, Debug::General, "IMF IsVisible\n" ); @@ -250,6 +256,8 @@ Rect GetSizeAndPosition() { int xPos, yPos, width, height; + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetSizeAndPosition() is deprecated and will be removed from next release. Use ImfManager.GetInputMethodArea() instead.\n" ); + width = height = xPos = yPos = 0; Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) as we may need to do some size related setup in the application @@ -273,17 +281,26 @@ Rect GetSizeAndPosition() Dali::VirtualKeyboard::StatusSignalType& StatusChangedSignal() { - return gKeyboardStatusSignal; + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: StatusChangedSignal() is deprecated and will be removed from next release. Use ImfManager.StatusChangedSignal() instead.\n" ); + + Dali::ImfManager imfManager = ImfManager::Get(); + return imfManager.StatusChangedSignal(); } Dali::VirtualKeyboard::VoidSignalType& ResizedSignal() { - return gKeyboardResizeSignal; + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal() is deprecated and will be removed from next release. Use ImfManager.ResizedSignal() instead.\n" ); + + Dali::ImfManager imfManager = ImfManager::Get(); + return imfManager.ResizedSignal(); } Dali::VirtualKeyboard::VoidSignalType& LanguageChangedSignal() { - return gKeyboardLanguageChangedSignal; + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: LanguageChangedSignal() is deprecated and will be removed from next release. Use ImfManager.LanguageChangedSignal() instead.\n" ); + + Dali::ImfManager imfManager = ImfManager::Get(); + return imfManager.LanguageChangedSignal(); } Dali::VirtualKeyboard::TextDirection GetTextDirection() @@ -305,7 +322,7 @@ Dali::VirtualKeyboard::TextDirection GetTextDirection() if ( locale ) { - direction = Locale::GetTextDirection( std::string( locale ) ); + direction = (Dali::VirtualKeyboard::TextDirection)Locale::GetTextDirection( std::string( locale ) ); free( locale ); } } diff --git a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp index e88e30a..8879894 100644 --- a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp @@ -24,12 +24,53 @@ #include // INTERNAL INCLUDES +#include #include +#include #include #include #include -#include -#include "ecore-virtual-keyboard.h" + +#define TOKEN_STRING(x) #x + +Ecore_IMF_Input_Panel_Layout panelLayoutMap[] = +{ + ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, + ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, + ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, + ECORE_IMF_INPUT_PANEL_LAYOUT_URL, + ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, + ECORE_IMF_INPUT_PANEL_LAYOUT_IP, + ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, + ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, + ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, + ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, + ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD, + ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME, + ECORE_IMF_INPUT_PANEL_LAYOUT_EMOTICON, + ECORE_IMF_INPUT_PANEL_LAYOUT_VOICE +}; + +Ecore_IMF_Autocapital_Type autoCapitalMap[] = +{ + ECORE_IMF_AUTOCAPITAL_TYPE_NONE, + ECORE_IMF_AUTOCAPITAL_TYPE_WORD, + ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, + ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER, +}; + +Ecore_IMF_Input_Panel_Return_Key_Type returnKeyTypeMap[] = +{ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND, + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN +}; namespace Dali { @@ -103,6 +144,58 @@ Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char } } +void InputPanelStateChangeCallback( void* data, Ecore_IMF_Context* context, int value ) +{ + if (!data) + { + return; + } + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + switch (value) + { + case ECORE_IMF_INPUT_PANEL_STATE_SHOW: + { + imfManager->StatusChangedSignal().Emit( true ); + break; + } + + case ECORE_IMF_INPUT_PANEL_STATE_HIDE: + { + imfManager->StatusChangedSignal().Emit( false ); + break; + } + + case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW: + default: + { + // Do nothing + break; + } + } +} + +void InputPanelLanguageChangeCallback( void* data, Ecore_IMF_Context* context, int value ) +{ + if (!data) + { + return; + } + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + // Emit the signal that the language has changed + imfManager->LanguageChangedSignal().Emit(); +} + +void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context, int value ) +{ + if (!data) + { + return; + } + ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data ); + // Emit signal that the keyboard is resized + imfManager->ResizedSignal().Emit(); +} + /** * Called when an IMF delete surrounding event is received. * Here we tell the application that it should delete a certain range. @@ -192,12 +285,10 @@ ImfManager::ImfManager( Ecore_Wl_Window *ecoreWlwin ) CreateContext( ecoreWlwin ); ConnectCallbacks(); - VirtualKeyboard::ConnectCallbacks( mIMFContext ); } ImfManager::~ImfManager() { - VirtualKeyboard::DisconnectCallbacks( mIMFContext ); DisconnectCallbacks(); DeleteContext(); @@ -254,6 +345,10 @@ void ImfManager::ConnectCallbacks() ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit, this ); ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this ); + ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback, this ); + ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback, this ); + ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback, this ); + ecore_imf_context_retrieve_surrounding_callback_set( mIMFContext, ImfRetrieveSurrounding, this); } } @@ -268,6 +363,10 @@ void ImfManager::DisconnectCallbacks() ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit ); ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding ); + ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback ); + ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback ); + ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback ); + // We do not need to unset the retrieve surrounding callback. } } @@ -524,6 +623,76 @@ void ImfManager::NotifyTextInputMultiLine( bool multiLine ) (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE))); } +Dali::ImfManager::TextDirection ImfManager::GetTextDirection() +{ + Dali::ImfManager::TextDirection direction ( Dali::ImfManager::LeftToRight ); + + if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManager */ ) + { + if ( mIMFContext ) + { + char* locale( NULL ); + ecore_imf_context_input_panel_language_locale_get( mIMFContext, &locale ); + + if ( locale ) + { + direction = Locale::GetTextDirection( std::string( locale ) ); + free( locale ); + } + } + } + return direction; +} + +Rect ImfManager::GetInputMethodArea() +{ + int xPos, yPos, width, height; + + width = height = xPos = yPos = 0; + + if( mIMFContext ) + { + ecore_imf_context_input_panel_geometry_get( mIMFContext, &xPos, &yPos, &width, &height ); + } + else + { + DALI_LOG_WARNING("VKB Unable to get IMF Context so GetSize unavailable\n"); + // return 0 as real size unknown. + } + + return Rect(xPos,yPos,width,height); +} + +void ImfManager::ApplyOptions( const InputMethodOptions& options ) +{ + using namespace Dali::InputMethod::Category; + + int index; + + if (mIMFContext == NULL) + { + DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n"); + return; + } + + if ( mOptions.CompareAndSet(PANEL_LAYOUT, options, index) ) + { + ecore_imf_context_input_panel_layout_set( mIMFContext, panelLayoutMap[index] ); + } + if ( mOptions.CompareAndSet(AUTO_CAPITALISE, options, index) ) + { + ecore_imf_context_autocapital_type_set( mIMFContext, autoCapitalMap[index] ); + } + if ( mOptions.CompareAndSet(ACTION_BUTTON_TITLE, options, index) ) + { + ecore_imf_context_input_panel_return_key_type_set( mIMFContext, returnKeyTypeMap[index] ); + } + if ( mOptions.CompareAndSet(VARIATION, options, index) ) + { + ecore_imf_context_input_panel_layout_variation_set( mIMFContext, index ); + } +} + } // Adaptor } // Internal diff --git a/adaptors/ecore/wayland/imf-manager-impl.h b/adaptors/ecore/wayland/imf-manager-impl.h index bd74fa0..24de4ce 100644 --- a/adaptors/ecore/wayland/imf-manager-impl.h +++ b/adaptors/ecore/wayland/imf-manager-impl.h @@ -46,6 +46,8 @@ class DALI_IMPORT_API ImfManager : public Dali::BaseObject public: typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType; typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType; + typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType; + typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType; public: @@ -156,6 +158,21 @@ public: */ void NotifyTextInputMultiLine( bool multiLine ); + /** + * @copydoc Dali::ImfManager::GetTextDirection() + */ + Dali::ImfManager::TextDirection GetTextDirection(); + + /** + * @copydoc Dali::ImfManager::GetInputMethodArea() + */ + Dali::Rect GetInputMethodArea(); + + /** + * @copydoc Dali::ImfManager::ApplyOptions() + */ + void ApplyOptions( const InputMethodOptions& options ); + public: // Signals /** @@ -168,6 +185,22 @@ public: // Signals */ ImfEventSignalType& EventReceivedSignal() { return mEventSignal; } + /** + * @copydoc Dali::ImfManager::StatusChangedSignal() + */ + ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; } + + /** + * @copydoc Dali::ImfManager::ResizedSignal() + */ + ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; } + + /** + * @copydoc Dali::ImfManager::LanguageChangedSignal() + */ + ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; } + + protected: /** @@ -202,9 +235,13 @@ private: bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected. std::vector mKeyEvents; ///< Stores key events to be sent from idle call-back. + InputMethodOptions mOptions; ImfManagerSignalType mActivatedSignal; ImfEventSignalType mEventSignal; + ImfStatusSignalType mKeyboardStatusSignal; + ImfVoidSignalType mKeyboardResizeSignal; + ImfVoidSignalType mKeyboardLanguageChangedSignal; public: diff --git a/adaptors/integration-api/x11/imf-manager-impl.h b/adaptors/integration-api/x11/imf-manager-impl.h index ea7fe87..94e7ecd 100644 --- a/adaptors/integration-api/x11/imf-manager-impl.h +++ b/adaptors/integration-api/x11/imf-manager-impl.h @@ -43,6 +43,8 @@ class DALI_IMPORT_API ImfManager : public Dali::BaseObject public: typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType; typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType; + typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType; + typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType; public: @@ -159,6 +161,21 @@ public: */ void NotifyTextInputMultiLine( bool multiLine ); + /** + * @copydoc Dali::ImfManager::GetTextDirection() + */ + Dali::ImfManager::TextDirection GetTextDirection(); + + /** + * @copydoc Dali::ImfManager::GetInputMethodArea() + */ + Dali::Rect GetInputMethodArea(); + + /** + * @copydoc Dali::ImfManager::ApplyOptions() + */ + void ApplyOptions( const InputMethodOptions& options ); + public: // Signals /** @@ -171,6 +188,21 @@ public: // Signals */ ImfEventSignalType& EventReceivedSignal() { return mEventSignal; } + /** + * @copydoc Dali::ImfManager::StatusChangedSignal() + */ + ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; } + + /** + * @copydoc Dali::ImfManager::ResizedSignal() + */ + ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; } + + /** + * @copydoc Dali::ImfManager::LanguageChangedSignal() + */ + ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; } + protected: /** @@ -202,9 +234,13 @@ private: bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained. bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected. + InputMethodOptions mOptions; ImfManagerSignalType mActivatedSignal; ImfEventSignalType mEventSignal; + ImfStatusSignalType mKeyboardStatusSignal; + ImfVoidSignalType mKeyboardResizeSignal; + ImfVoidSignalType mKeyboardLanguageChangedSignal; public: diff --git a/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp b/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp index 612a522..ab6b600 100644 --- a/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp +++ b/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -307,6 +307,22 @@ void ImfManager::NotifyTextInputMultiLine( bool multiLine ) { } +Dali::Rect< int > ImfManager::GetInputMethodArea() +{ + TextInputManager::SeatInfo& info = mTextInputManager.GetLastActiveSeat(); + return info.mInputPanelDimensions; +} + +void ImfManager::ApplyOptions(const InputMethodOptions& options) +{ +} + +Dali::ImfManager::TextDirection ImfManager::GetTextDirection() +{ + TextInputManager::SeatInfo& info = mTextInputManager.GetLastActiveSeat(); + return (Dali::ImfManager::TextDirection)info.mTextDirection; +} + } // Adaptor } // Internal diff --git a/adaptors/wayland/input/text/imf/imf-manager-impl.h b/adaptors/wayland/input/text/imf/imf-manager-impl.h index 1af41bc..726060b 100644 --- a/adaptors/wayland/input/text/imf/imf-manager-impl.h +++ b/adaptors/wayland/input/text/imf/imf-manager-impl.h @@ -55,6 +55,8 @@ class ImfManager : public Dali::BaseObject, public ConnectionTracker public: typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType; typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType; + typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType; + typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType; public: @@ -153,6 +155,21 @@ public: */ void NotifyTextInputMultiLine( bool multiLine ); + /** + * @copydoc Dali::ImfManager::GetTextDirection() + */ + Dali::ImfManager::TextDirection GetTextDirection(); + + /** + * @copydoc Dali::ImfManager::GetInputMethodArea() + */ + Dali::Rect GetInputMethodArea(); + + /** + * @copydoc Dali::ImfManager::ApplyOptions() + */ + void ApplyOptions( const InputMethodOptions& options ); + public: // Signals /** @@ -166,6 +183,22 @@ public: // Signals ImfEventSignalType& EventReceivedSignal() { return mEventSignal; } /** + * @copydoc Dali::ImfManager::StatusChangedSignal() + */ + ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; } + + /** + * @copydoc Dali::ImfManager::ResizedSignal() + */ + ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; } + + /** + * @copydoc Dali::ImfManager::LanguageChangedSignal() + */ + ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; } + + + /** * @brief Called when an IMF Pre-Edit change event is received. * We are still predicting what the user is typing. The latest string is what the IMF module thinks * the user wants to type. @@ -208,6 +241,9 @@ private: ImfManagerSignalType mActivatedSignal; ImfEventSignalType mEventSignal; + ImfStatusSignalType mKeyboardStatusSignal; + ImfVoidSignalType mKeyboardResizeSignal; + ImfVoidSignalType mKeyboardLanguageChangedSignal; // Undefined ImfManager( const ImfManager& ); diff --git a/adaptors/wayland/input/text/text-input-manager.cpp b/adaptors/wayland/input/text/text-input-manager.cpp index 5144aea..e6b31e9 100644 --- a/adaptors/wayland/input/text/text-input-manager.cpp +++ b/adaptors/wayland/input/text/text-input-manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/adaptors/wayland/input/text/text-input-manager.h b/adaptors/wayland/input/text/text-input-manager.h index 7033471..893ae94 100644 --- a/adaptors/wayland/input/text/text-input-manager.h +++ b/adaptors/wayland/input/text/text-input-manager.h @@ -2,7 +2,7 @@ #define __DALI_WAYLAND_TEXT_INPUT_MANAGER_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/adaptors/x11/imf-manager-impl-x.cpp b/adaptors/x11/imf-manager-impl-x.cpp index ff67cb3..3a2f913 100644 --- a/adaptors/x11/imf-manager-impl-x.cpp +++ b/adaptors/x11/imf-manager-impl-x.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "ecore-virtual-keyboard.h" @@ -520,6 +521,71 @@ void ImfManager::NotifyTextInputMultiLine( bool multiLine ) { } +Dali::ImfManager::TextDirection ImfManager::GetTextDirection() +{ + Dali::ImfManager::TextDirection direction ( Dali::ImfManager::LeftToRight ); + + if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManager */ ) + { + if ( mIMFContext ) + { + char* locale( NULL ); + ecore_imf_context_input_panel_language_locale_get( mIMFContext, &locale ); + + if ( locale ) + { + direction = Locale::GetTextDirection( std::string( locale ) ); + free( locale ); + } + } + } + return direction; +} + +Rect ImfManager::GetInputMethodArea() +{ + int xPos, yPos, width, height; + + width = height = xPos = yPos = 0; + + if( mIMFContext ) + { + ecore_imf_context_input_panel_geometry_get( mIMFContext, &xPos, &yPos, &width, &height ); + } + else + { + DALI_LOG_WARNING("VKB Unable to get IMF Context so GetSize unavailable\n"); + } + + return Rect(xPos,yPos,width,height); +} + +void ImfManager::ApplyOptions( const InputMethodOptions& options ) +{ + using namespace Dali::InputMethod::Category; + + int index; + + if (mIMFContext == NULL) + { + DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n"); + return; + } + + if ( mOptions.CompareAndSet(PANEL_LAYOUT, options, index) ) + { + } + if ( mOptions.CompareAndSet(AUTO_CAPITALISE, options, index) ) + { + } + if ( mOptions.CompareAndSet(ACTION_BUTTON_TITLE, options, index) ) + { + } + if ( mOptions.CompareAndSet(VARIATION, options, index) ) + { + } +} + } // Adaptor } // Internal -- 2.7.4