#include <locale-utils.h>
#include <imf-manager-impl.h>
-
namespace Dali
{
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_VIRTUAL_KEYBOARD");
#endif
+#define TOKEN_STRING(x) #x
+
//forward declarations
void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context, int value );
void InputPanelLanguageChangeCallback( void* data, Ecore_IMF_Context* context, int value );
Dali::VirtualKeyboard::VoidSignalType gKeyboardResizeSignal;
Dali::VirtualKeyboard::VoidSignalType gKeyboardLanguageChangedSignal;
-Dali::VirtualKeyboard::ReturnKeyType gReturnKeyType = Dali::VirtualKeyboard::DEFAULT; // the currently used return key type.
-
void InputPanelStateChangeCallback( void* data, Ecore_IMF_Context* context, int value )
{
switch (value)
return false;
}
-void SetReturnKeyType( Dali::VirtualKeyboard::ReturnKeyType type )
+void ApplySettings( const Property::Map& settingsMap )
{
- Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when setting values
- Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
+ using namespace InputMethod; // Allows exclusion of namespace in TOKEN_STRING.
- if( imfContext )
+ for ( unsigned int i = 0, count = settingsMap.Count(); i < count; ++i )
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "VKB Retrun key type is changed[%d]\n", type );
-
- gReturnKeyType = type;
- ecore_imf_context_input_panel_return_key_type_set( imfContext, static_cast<Ecore_IMF_Input_Panel_Return_Key_Type>( type ) );
- }
-}
+ std::string key = settingsMap.GetKey( i );
+ Property::Value item = settingsMap.GetValue(i);
-Dali::VirtualKeyboard::ReturnKeyType GetReturnKeyType()
-{
- return gReturnKeyType;
+ if ( key == TOKEN_STRING( ACTION_BUTTON ) )
+ {
+ if ( item.GetType() == Property::INTEGER )
+ {
+ int value = item.Get< int >();
+ VirtualKeyboard::SetReturnKeyType( static_cast<InputMethod::ActionButton>(value) );
+ }
+ }
+ else
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Provided Settings Key not supported\n" );
+ }
+ }
}
void EnablePrediction(const bool enable)
bool IsVisible();
/**
+ * @copydoc Dali::VirtualKeyboard::ApplySettings()
+ */
+void ApplySettings( const Property::Map& settingsMap );
+
+/**
* @copydoc Dali::VirtualKeyboard::SetReturnKeyType()
*/
-void SetReturnKeyType( Dali::VirtualKeyboard::ReturnKeyType type );
+void SetReturnKeyType( const Dali::InputMethod::ActionButton type );
/**
* @copydoc Dali::VirtualKeyboard::GetReturnKeyType()
*/
-Dali::VirtualKeyboard::ReturnKeyType GetReturnKeyType();
+Dali::InputMethod::ActionButton GetReturnKeyType();
/**
* @copydoc Dali::VirtualKeyboard::EnablePrediction()
return Internal::Adaptor::VirtualKeyboard::IsVisible();
}
-void SetReturnKeyType( ReturnKeyType type )
+void ApplySettings( const Property::Map& settingsMap )
+{
+ Internal::Adaptor::VirtualKeyboard::ApplySettings( settingsMap );
+}
+
+void SetReturnKeyType( const InputMethod::ActionButton type )
{
Internal::Adaptor::VirtualKeyboard::SetReturnKeyType( type );
}
-ReturnKeyType GetReturnKeyType()
+InputMethod::ActionButton GetReturnKeyType()
{
return Internal::Adaptor::VirtualKeyboard::GetReturnKeyType();
}
// EXTERNAL INCLUDES
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/math/rect.h>
+// INTERNAL INCLUDES
+#ifdef DALI_ADAPTOR_COMPILATION // full path doesn't exist until adaptor is installed so we have to use relative
+// @todo Make dali-adaptor code folder structure mirror the folder structure installed to dali-env
+#include "input-method.h"
+#else
+#include <dali/public-api/adaptor-framework/input-method.h>
+#endif
+
namespace Dali
{
DALI_IMPORT_API bool IsVisible();
/**
+ * @brief Set one or more of the Input Method Settings
+ * @param[in] settingsMap Map of Settings to be applied.
+ */
+DALI_IMPORT_API void ApplySettings( const Property::Map& settingsMap );
+
+/**
* @brief Set the specific return key into the virtual keyboard.
* @param[in] type the kind of return key types.
*/
-DALI_IMPORT_API void SetReturnKeyType( ReturnKeyType type );
+DALI_IMPORT_API void SetReturnKeyType( const InputMethod::ActionButton type );
/**
* @brief Retrieve the current return key type.
* @return the type of retun key.
*/
-DALI_IMPORT_API ReturnKeyType GetReturnKeyType();
+DALI_IMPORT_API InputMethod::ActionButton GetReturnKeyType();
/**
* @brief Enable/disable prediction (predictive text).
namespace VirtualKeyboard
{
+Dali::InputMethod::ActionButton gActionButtonFunction = Dali::InputMethod::ACTION_DEFAULT;
+
void RotateTo(int angle)
{
}
+void SetReturnKeyType( const InputMethod::ActionButton type )
+{
+}
+
+Dali::InputMethod::ActionButton GetReturnKeyType()
+{
+ return gActionButtonFunction;
+}
+
} // namespace VirtualKeyboard
} // namespace Adaptor
namespace VirtualKeyboard
{
+Dali::InputMethod::ActionButton gActionButtonFunction = Dali::InputMethod::ACTION_DEFAULT;
+
+Ecore_IMF_Input_Panel_Return_Key_Type actionButtonMapping(Dali::InputMethod::ActionButton actionButton )
+{
+ switch( actionButton )
+ {
+ case InputMethod::ACTION_DEFAULT: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ case InputMethod::ACTION_DONE: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
+ case InputMethod::ACTION_GO: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO;
+ case InputMethod::ACTION_JOIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN;
+ case InputMethod::ACTION_LOGIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN;
+ case InputMethod::ACTION_NEXT: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
+ case InputMethod::ACTION_PREVIOUS: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ case InputMethod::ACTION_SEARCH: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;
+ case InputMethod::ACTION_SEND: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND;
+ case InputMethod::ACTION_SIGNIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ case InputMethod::ACTION_UNSPECIFIED: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ case InputMethod::ACTION_NONE: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ default: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
+ }
+}
+
void RotateTo(int angle)
{
// Get focus window used by Keyboard and rotate it
}
}
+void SetReturnKeyType( const InputMethod::ActionButton type )
+{
+ Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when setting values
+ Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
+
+ if( imfContext )
+ {
+ gActionButtonFunction = type;
+ ecore_imf_context_input_panel_return_key_type_set( imfContext, actionButtonMapping( type ) );
+ }
+}
+
+Dali::InputMethod::ActionButton GetReturnKeyType()
+{
+ return gActionButtonFunction;
+}
+
} // namespace VirtualKeyboard
} // namespace Adaptor