From: Jihoon Kim <jihoon48.kim@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 2 Jun 2011 07:56:58 +0000 (07:56 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 2 Jun 2011 07:56:58 +0000 (07:56 +0000)
Subject: [E-devel] [PATCH] Add some APIs for supporting virtual
keyboard in Ecore_IMF

For supporting virtual keyboard, I'd like to add some APIs. The detail
description of each API is included in the patch file as doxygen format.

In the attached patch, the reason why we add the subprefix 'input_panel_'
related to virtual keyboard is that input method can be soft keyboard or voice
input or image captured by camera.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@59894 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_imf/Ecore_IMF.h
src/lib/ecore_imf/ecore_imf_context.c
src/lib/ecore_imf/ecore_imf_private.h

index 161c9f8..4266d53 100644 (file)
@@ -128,6 +128,25 @@ typedef enum
    ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER
 } Ecore_IMF_Autocapital_Type;
 
+typedef enum
+{
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL,          /**< Default layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER,          /**< Number layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL,           /**< Email layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_URL,             /**< URL layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER,     /**< Phone Number layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_IP,              /**< IP layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH,           /**< Month layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY,      /**< Number Only layout */
+   ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID
+} Ecore_IMF_Input_Panel_Layout;
+
+typedef enum
+{
+   ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC,    /**< Automatic */
+   ECORE_IMF_INPUT_PANEL_LANG_ALPHABET      /**< Alphabet */
+} Ecore_IMF_Input_Panel_Lang;
+
 struct _Ecore_IMF_Event_Preedit_Start
 {
    Ecore_IMF_Context *ctx;
@@ -305,6 +324,12 @@ struct _Ecore_IMF_Context_Class
    void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
    void (*prediction_allow_set)(Ecore_IMF_Context *ctx, Eina_Bool prediction);
    void (*autocapital_type_set)(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
+   void (*control_panel_show)   (Ecore_IMF_Context *ctx);
+   void (*control_panel_hide)   (Ecore_IMF_Context *ctx);
+   void (*input_panel_layout_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
+   Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx);
+   void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
+   Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
 };
 
 struct _Ecore_IMF_Context_Info
@@ -363,6 +388,16 @@ EAPI Eina_Bool                     ecore_imf_context_prediction_allow_get(Ecore_
 EAPI void                          ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
 EAPI Ecore_IMF_Autocapital_Type    ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx);
 
+EAPI void                          ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx);
+EAPI void                          ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx);
+
+EAPI void                          ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx);
+EAPI void                          ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx);
+EAPI void                          ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
+EAPI Ecore_IMF_Input_Panel_Layout  ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx);
+EAPI void                          ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
+EAPI Ecore_IMF_Input_Panel_Lang    ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
+
 /* The following entry points must be exported by each input method module
  */
 
index 50b6a87..0fe7f3d 100644 (file)
@@ -986,3 +986,90 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse
    ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING,
                    ev, _ecore_imf_event_free_delete_surrounding, NULL);
 }
+
+/**
+ * Ask the Input Method Context to show the control panel of using Input Method.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @since 1.1.0
+ */
+EAPI void
+ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_control_panel_show");
+        return;
+     }
+
+   if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx);
+}
+
+/**
+ * Ask the Input Method Context to hide the control panel of using Input Method.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @since 1.1.0
+ */
+EAPI void
+ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_control_panel_hide");
+        return;
+     }
+
+   if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx);
+}
+
+/**
+ * Set the language of the input panel.
+ * This API can be used when you want to show the English keyboard.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param lang the language to be set to the input panel.
+ * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @since 1.1.0
+ */
+EAPI void
+ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_input_panel_language_set");
+        return;
+     }
+
+   if (ctx->klass->input_panel_language_set) ctx->klass->input_panel_language_set(ctx, lang);
+   ctx->input_panel_lang = lang;
+}
+
+/**
+ * Get the language of the input panel.
+ *
+ * See @ref ecore_imf_context_input_panel_language_set for more details.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @return Ecore_IMF_Input_Panel_Lang
+ * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @since 1.1.0
+ */
+EAPI Ecore_IMF_Input_Panel_Lang
+ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx)
+{
+   if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+     {
+        ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+                         "ecore_imf_context_input_panel_language_get");
+        return ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC;
+     }
+
+   return ctx->input_panel_lang;
+}
+
index 74f4836..4255ec6 100644 (file)
@@ -48,6 +48,8 @@ struct _Ecore_IMF_Context
    Eina_Bool                    (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
    void                          *retrieve_surrounding_data;
    Ecore_IMF_Autocapital_Type     autocapital_type;
+   Ecore_IMF_Input_Panel_Layout   input_panel_layout;
+   Ecore_IMF_Input_Panel_Lang     input_panel_lang;
    Eina_Bool                      allow_prediction : 1;
 };