Editing Documentation/Maemo 5 Developer Guide/Using Generic Platform Components/Extending Hildon Input Methods

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.

Warning: This page is 60 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
Maemo platform is intended to be used on embedded devices. It is a quite straightforward request that one might want to have different input methods from the ones available by default, or just simply want a different layout for the virtual keyboard. For this reason, [[Open development/Maemo roadmap/Diablo|Maemo 4.1]] introduces a way to enable writing custom plug-ins for Hildon Input Method.
+
=  Extending Hildon Input Methods =
 +
 
 +
== Overview ==
 +
 
 +
Maemo platform is intended to be used on embedded devices. It is a quite straightforward request that one might want to have different input methods from the ones available by default, or just simply want a different layout for the virtual keyboard. For this reason, maemo 4.1 introduces a way to enable writing custom plug-ins for Hildon Input Method.
This section describes writing a simple plug-in for Hildon Input Method. This example plug-in is going to implement a very basic virtual keyboard.
This section describes writing a simple plug-in for Hildon Input Method. This example plug-in is going to implement a very basic virtual keyboard.
Line 7: Line 11:
<div align="CENTER">[[Image:HIM-ui.png|Image HIM-ui]]</div>
<div align="CENTER">[[Image:HIM-ui.png|Image HIM-ui]]</div>
-
Technically, the plug-in is an almost-standard GTK+ widget (with additional steps to support dynamic loading). The widget of the plug-in will be placed in the Plug-in area.
+
Technically, the plug-in is an almost standard GTK widget (with additional steps to support dynamic loading). The widget of the plug-in will be placed in the Plug-in area.
The illustration below shows the data flow of a user's input:
The illustration below shows the data flow of a user's input:
Line 30: Line 34:
* hildon-input-method/hildon-im-plugin.h
* hildon-input-method/hildon-im-plugin.h
-
<source lang="c">
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>enable<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">,</font></span> gboolean init<span><font color="#990000">);</font></span>
-
void (*enable) (HildonIMPlugin *plugin, gboolean init);
+
</tt>
-
</source>
+
'''enable''' is called whenever the plug-in becomes available to the user. '''init''' holds TRUE whenever this is the initialization time. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt><span>''<span><font color="#9A1900">/* Called when the plugin is available to the user */</font></span>''</span>
-
<code>enable</code> is called whenever the plug-in becomes available to the user. '''init''' holds TRUE whenever this is the initialization time. hildon-input-method-plugins-example/src/him-vkb-example.c
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
 
+
<span>'''<span><font color="#000000">enable</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">,</font></span> gboolean init<span><font color="#990000">)</font></span>
-
<source lang="c">
+
<span><font color="#FF0000">{</font></span>
-
/* Called when the plugin is available to the user */
+
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
static void
+
  HimExampleVKB <span><font color="#990000"><nowiki>*</nowiki></font></span>vkb<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
enable (HildonIMPlugin *plugin, gboolean init)
+
  vkb <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">);</font></span>
-
{
+
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span>vkb<span><font color="#990000">);</font></span>
-
  HimExampleVKBPrivate *priv;
+
  <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>init <span><font color="#990000"><nowiki>==</nowiki></font></span> TRUE<span><font color="#990000">)</font></span>
-
  HimExampleVKB *vkb;
+
  <span><font color="#FF0000">{</font></span>
-
  vkb = HIMEXAMPLE_VKB (plugin);
+
    <span>'''<span><font color="#000000">hildon_im_ui_button_set_toggle</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (vkb);
+
      HILDON_IM_BUTTON_MODE_A<span><font color="#990000">,</font></span> TRUE<span><font color="#990000">);</font></span>
-
  if (init == TRUE)
+
    <span>'''<span><font color="#000000">hildon_im_ui_button_set_toggle</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
-
  {
+
      HILDON_IM_BUTTON_MODE_B<span><font color="#990000">,</font></span> TRUE<span><font color="#990000">);</font></span>
-
    hildon_im_ui_button_set_toggle (priv->ui,
+
    <span>'''<span><font color="#000000">hildon_im_ui_button_set_label</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
-
      HILDON_IM_BUTTON_MODE_A, TRUE);
+
      HILDON_IM_BUTTON_MODE_A<span><font color="#990000">,</font></span> <span><font color="#FF0000">"ABC"</font></span><span><font color="#990000">);</font></span>
-
    hildon_im_ui_button_set_toggle (priv->ui,
+
    <span>'''<span><font color="#000000">hildon_im_ui_button_set_label</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
-
      HILDON_IM_BUTTON_MODE_B, TRUE);
+
      HILDON_IM_BUTTON_MODE_B<span><font color="#990000">,</font></span> <span><font color="#FF0000">"Shift"</font></span><span><font color="#990000">);</font></span>
-
    hildon_im_ui_button_set_label (priv->ui,
+
  <span><font color="#FF0000">}</font></span>
-
      HILDON_IM_BUTTON_MODE_A, "ABC");
+
  <span>'''<span><font color="#000000">hildon_im_ui_send_communication_message</font></span>'''</span><span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span> HILDON_IM_CONTEXT_DIRECT_MODE<span><font color="#990000">);</font></span>
-
    hildon_im_ui_button_set_label (priv->ui,
+
<span><font color="#FF0000">}</font></span></tt>
-
      HILDON_IM_BUTTON_MODE_B, "Shift");
+
* hildon-input-method/hildon-im-plugin.h
-
  }
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>disable<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
  hildon_im_ui_send_communication_message(priv->ui, HILDON_IM_CONTEXT_DIRECT_MODE);
+
</tt>
-
}
+
'''disable''' is called whenever the plug-in becomes unavailable to the user (e.g. when the main UI is closed). hildon-input-method-plugins-example/src/him-vkb-example.c
-
</source>
+
<tt><span>''<span><font color="#9A1900">/* Called when the plugin is disabled */</font></span>''</span>
-
 
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
<code>disable</code> is called whenever the plug-in becomes unavailable to the user (e.g. when the main UI is closed). hildon-input-method-plugins-example/src/him-vkb-example.c
+
<span>'''<span><font color="#000000">disable</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
-
 
+
<span><font color="#FF0000">{</font></span>
-
<source lang="c">
+
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
-
/* Called when the plugin is disabled */
+
<span><font color="#FF0000">}</font></span></tt>
-
static void
+
-
disable(HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>settings_changed</code> is called whenever the HIM main UI receives a notification from GConf about Hildon Input Method settings being changed. The affected settings are all settings residing in <code>/apps/osso/inputmethod</code> path. <code>key</code> and <code>value</code> hold the GConf key and its value respectively. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the standard input method settings
+
-
  has been changed */
+
-
static void
+
-
settings_changed (HildonIMPlugin *plugin,
+
-
    const gchar *key, const GConfValue *value)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>input_mode_changed</code> is called whenever the input mode is changed. Input mode is changed to what has been specified by the client widget. The input mode puts constraints to the plug-in to limit whether input shall be accepted or ignored. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when input mode changed */
+
-
static void
+
-
input_mode_changed (HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>clear</code> is called whenever the HIM main UI requests the plug-in to clear or refresh its user interface. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the plugin is requested to 'clear'/refresh its UI */
+
-
static void
+
-
clear(HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>client_widget_changed</code> is called whenever the client widget is changed from one to another. For instance, the case could be that the user taps on another text entry. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the client widget changed */
+
-
static void
+
-
client_widget_changed (HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>save_data</code> is called whenever the HIM main UI is requested to save its (and the plug-in's) data. Usually it is called when the main UI is requested to quit. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the plugin is requested to save its data */
+
-
static void
+
-
save_data(HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
-
<code>mode_a</code> is called whenever the ''Mode A'' (Caps Lock in virtual keyboard plug-in) is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the MODE_A button is pressed */
+
-
static void
+
-
mode_a(HildonIMPlugin *plugin)
+
-
{
+
-
  HimExampleVKBPrivate *priv;
+
-
  HimExampleVKB *vkb;
+
-
  vkb = HIMEXAMPLE_VKB (plugin);
+
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (vkb);
+
-
  if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_B)) {
+
-
    hildon_im_ui_button_set_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_B, FALSE);
+
-
    if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_A)) {
+
-
      priv->case_mode = CASE_UPPER;
+
-
    } else {
+
-
      priv->case_mode = CASE_LOWER;
+
-
    }
+
-
  } else {
+
-
    if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_A)) {
+
-
      priv->case_mode = CASE_UPPER;
+
-
    } else {
+
-
      priv->case_mode = CASE_LOWER;
+
-
    }
+
-
  }
+
-
  update_layout (vkb);
+
-
}
+
-
</source>
+
-
 
+
-
<code>mode_b</code> is called whenever the ''Mode B'' (Shift in virtual keyboard plug-in) is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
+
-
 
+
-
<source lang="c">
+
-
/* Called when the MODE_B button is pressed */
+
-
static void
+
-
mode_b(HildonIMPlugin *plugin)
+
-
{
+
-
  HimExampleVKBPrivate *priv;
+
-
  HimExampleVKB *vkb;
+
-
  vkb = HIMEXAMPLE_VKB (plugin);
+
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (vkb);
+
-
  if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_B)) {
+
-
    if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_A)) {
+
-
      priv->case_mode = CASE_LOWER;
+
-
    } else {
+
-
      priv->case_mode = CASE_UPPER;
+
-
    }
+
-
  } else {
+
-
    if (hildon_im_ui_button_get_active (priv->ui,
+
-
        HILDON_IM_BUTTON_MODE_A)) {
+
-
      priv->case_mode = CASE_UPPER;
+
-
    } else {
+
-
      priv->case_mode = CASE_LOWER;
+
-
    }
+
-
  }
+
-
  update_layout (vkb);
+
-
}
+
-
</source>
+
-
 
+
* hildon-input-method/hildon-im-plugin.h
* hildon-input-method/hildon-im-plugin.h
-
<source lang="c">
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>settings_changed<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">,</font></span>
-
void (*backspace) (HildonIMPlugin *plugin);
+
                          <span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>key<span><font color="#990000">,</font></span>
-
</source>
+
                          <span>'''<span><font color="#0000FF">const</font></span>'''</span> GConfValue <span><font color="#990000"><nowiki>*</nowiki></font></span>value<span><font color="#990000">);</font></span>
-
 
+
</tt>
-
<code>backspace</code> is called whenever the virtual backspace key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
+
'''settings_changed''' is called whenever the HIM main UI receives a notification from GConf about Hildon Input Method settings being changed. The affected settings are all settings residing in '''/apps/osso/inputmethod''' path. '''key''' and '''value''' hold the GConf key and its value respectively. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt><span>''<span><font color="#9A1900">/* Called when the standard input method settings </font></span>''</span>
-
<source lang="c">
+
<span>''<span><font color="#9A1900">  has been changed */</font></span>''</span>
-
/* Called when the backspace button is pressed */
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
static void
+
<span>'''<span><font color="#000000">settings_changed</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">,</font></span>
-
backspace (HildonIMPlugin *plugin)
+
    <span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>key<span><font color="#990000">,</font></span> <span>'''<span><font color="#0000FF">const</font></span>'''</span> GConfValue <span><font color="#990000"><nowiki>*</nowiki></font></span>value<span><font color="#990000">)</font></span>
-
{
+
<span><font color="#FF0000">{</font></span>
-
  HimExampleVKBPrivate *priv;
+
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (HIMEXAMPLE_VKB (plugin));
+
<span><font color="#FF0000">}</font></span></tt>
-
  hildon_im_ui_send_communication_message (priv->ui,
+
* hildon-input-method/hildon-im-plugin.h
-
      HILDON_IM_CONTEXT_HANDLE_BACKSPACE);
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>input_mode_changed<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
}
+
</tt>
-
</source>
+
'''input_mode_changed''' is called whenever the input mode is changed. Input mode is changed to what has been specified by the client widget. The input mode puts constraints to the plug-in to limit whether input shall be accepted or ignored. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt><span>''<span><font color="#9A1900">/* Called when input mode changed */</font></span>''</span>
-
<code>enter</code> is called whenever the virtual enter key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
 
+
<span>'''<span><font color="#000000">input_mode_changed</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
-
<source lang="c">
+
<span><font color="#FF0000">{</font></span>
-
/* Called when the enter button is pressed */
+
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
-
static void
+
<span><font color="#FF0000">}</font></span>
-
enter (HildonIMPlugin *plugin)
+
</tt>
-
{
+
* hildon-input-method/hildon-im-plugin.h
-
  HimExampleVKBPrivate *priv;
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>clear<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (HIMEXAMPLE_VKB (plugin));
+
</tt>
-
  hildon_im_ui_send_communication_message (priv->ui,
+
'''clear''' is called whenever the HIM main UI requests the plug-in to clear or refresh its user interface. hildon-input-method-plugins-example/src/him-vkb-example.c
-
      HILDON_IM_CONTEXT_HANDLE_ENTER);
+
<tt><span>''<span><font color="#9A1900">/* Called when the plugin is requested to 'clear'/refresh its UI */</font></span>''</span>
-
}
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
</source>
+
<span>'''<span><font color="#000000">clear</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
-
 
+
<span><font color="#FF0000">{</font></span>
 +
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
 +
<span><font color="#FF0000">}</font></span></tt>
 +
* hildon-input-method/hildon-im-plugin.h
 +
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>client_widget_changed<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
 +
</tt>
 +
'''client_widget_changed''' is called whenever the client widget is changed from one to another. For instance, the case could be that the user taps on another text entry. hildon-input-method-plugins-example/src/him-vkb-example.c
 +
<tt><span>''<span><font color="#9A1900">/* Called when the client widget changed */</font></span>''</span>
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">client_widget_changed</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
 +
<span><font color="#FF0000">}</font></span></tt>
 +
* hildon-input-method/hildon-im-plugin.h
 +
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>save_data<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
 +
</tt>
 +
'''save_data''' is called whenever the HIM main UI is requested to save its (and the plug-in's) data. Usually it is called when the main UI is requested to quit. hildon-input-method-plugins-example/src/him-vkb-example.c
 +
<tt><span>''<span><font color="#9A1900">/* Called when the plugin is requested to save its data */</font></span>''</span>
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">save_data</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
 +
<span><font color="#FF0000">}</font></span></tt>
 +
* hildon-input-method/hildon-im-plugin.h
 +
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>mode_a<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
 +
</tt>
 +
'''mode_a''' is called whenever the ''Mode A'' (Caps Lock in virtual keyboard plug-in) is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
 +
<tt><span>''<span><font color="#9A1900">/* Called when the MODE_A button is pressed */</font></span>''</span>
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">mode_a</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  HimExampleVKB <span><font color="#990000"><nowiki>*</nowiki></font></span>vkb<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  vkb <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">);</font></span>
 +
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span>vkb<span><font color="#990000">);</font></span>
 +
  <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_B<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
    <span>'''<span><font color="#000000">hildon_im_ui_button_set_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_B<span><font color="#990000">,</font></span> FALSE<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_A<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_UPPER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_LOWER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
  <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_A<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_UPPER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_LOWER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
  <span><font color="#FF0000">}</font></span>
 +
  <span>'''<span><font color="#000000">update_layout</font></span>'''</span> <span><font color="#990000">(</font></span>vkb<span><font color="#990000">);</font></span>
 +
<span><font color="#FF0000">}</font></span></tt>
 +
* hildon-input-method/hildon-im-plugin.h
 +
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>mode_b<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
 +
</tt>
 +
'''mode_b''' is called whenever the ''Mode B'' (Shift in virtual keyboard plug-in) is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
 +
<tt><span>''<span><font color="#9A1900">/* Called when the MODE_B button is pressed */</font></span>''</span>
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">mode_b</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  HimExampleVKB <span><font color="#990000"><nowiki>*</nowiki></font></span>vkb<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  vkb <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">);</font></span>
 +
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span>vkb<span><font color="#990000">);</font></span>
 +
  <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_B<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_A<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_LOWER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_UPPER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
  <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
        HILDON_IM_BUTTON_MODE_A<span><font color="#990000">))</font></span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_UPPER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span><font color="#FF0000">{</font></span>
 +
      priv<span><font color="#990000">-&gt;</font></span>case_mode <span><font color="#990000"><nowiki>=</nowiki></font></span> CASE_LOWER<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
  <span><font color="#FF0000">}</font></span>
 +
  <span>'''<span><font color="#000000">update_layout</font></span>'''</span> <span><font color="#990000">(</font></span>vkb<span><font color="#990000">);</font></span>
 +
<span><font color="#FF0000">}</font></span></tt>
 +
* hildon-input-method/hildon-im-plugin.h
 +
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>backspace<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
 +
</tt>
 +
'''backspace''' is called whenever the virtual backspace key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
 +
<tt><span>''<span><font color="#9A1900">/* Called when the backspace button is pressed */</font></span>''</span>
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">backspace</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">));</font></span>
 +
  <span>'''<span><font color="#000000">hildon_im_ui_send_communication_message</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
      HILDON_IM_CONTEXT_HANDLE_BACKSPACE<span><font color="#990000">);</font></span>
 +
<span><font color="#FF0000">}</font></span></tt>
* hildon-input-method/hildon-im-plugin.h
* hildon-input-method/hildon-im-plugin.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>enter<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
<source lang="c">
+
</tt>
-
void (*tab) (HildonIMPlugin *plugin);
+
'''enter''' is called whenever the virtual enter key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
-
</source>
+
<tt><span>''<span><font color="#9A1900">/* Called when the enter button is pressed */</font></span>''</span>
-
 
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
<code>tab</code> is called whenever the virtual tab key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
+
<span>'''<span><font color="#000000">enter</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
-
 
+
<span><font color="#FF0000">{</font></span>
-
<source lang="c">
+
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
/* Called when the tab button is pressed */
+
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">));</font></span>
-
static void
+
  <span>'''<span><font color="#000000">hildon_im_ui_send_communication_message</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
-
tab (HildonIMPlugin *plugin)
+
      HILDON_IM_CONTEXT_HANDLE_ENTER<span><font color="#990000">);</font></span>
-
{
+
<span><font color="#FF0000">}</font></span></tt>
-
  HimExampleVKBPrivate *priv;
+
* hildon-input-method/hildon-im-plugin.h
-
  priv = HIMEXAMPLE_VKB_GET_PRIVATE (HIMEXAMPLE_VKB (plugin));
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>tab<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
  hildon_im_ui_send_communication_message (priv->ui,
+
</tt>
-
      HILDON_IM_CONTEXT_HANDLE_TAB);
+
'''tab''' is called whenever the virtual tab key is pressed. hildon-input-method-plugins-example/src/him-vkb-example.c
-
}
+
<tt><span>''<span><font color="#9A1900">/* Called when the tab button is pressed */</font></span>''</span>
-
</source>
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
 +
<span>'''<span><font color="#000000">tab</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
  HimExampleVKBPrivate <span><font color="#990000"><nowiki>*</nowiki></font></span>priv<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
  priv <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">HIMEXAMPLE_VKB_GET_PRIVATE</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">HIMEXAMPLE_VKB</font></span>'''</span> <span><font color="#990000">(</font></span>plugin<span><font color="#990000">));</font></span>
 +
  <span>'''<span><font color="#000000">hildon_im_ui_send_communication_message</font></span>'''</span> <span><font color="#990000">(</font></span>priv<span><font color="#990000">-&gt;</font></span>ui<span><font color="#990000">,</font></span>
 +
      HILDON_IM_CONTEXT_HANDLE_TAB<span><font color="#990000">);</font></span>
 +
<span><font color="#FF0000">}</font></span></tt>
Couple of functions related to changing language:
Couple of functions related to changing language:
* hildon-input-method/hildon-im-plugin.h
* hildon-input-method/hildon-im-plugin.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>language<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">);</font></span>
-
<source lang="c">
+
</tt>
-
void (*language) (HildonIMPlugin *plugin);
+
'''language''' is called whenever a new language is selected from the HIM main UI menu. hildon-input-method-plugins-example/src/him-vkb-example.c
-
</source>
+
<tt><span>''<span><font color="#9A1900">/* Called when the language has been changed */</font></span>''</span>
-
 
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
<code>language</code> is called whenever a new language is selected from the HIM main UI menu. hildon-input-method-plugins-example/src/him-vkb-example.c
+
<span>'''<span><font color="#000000">language</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">)</font></span>
-
 
+
<span><font color="#FF0000">{</font></span>
-
<source lang="c">
+
  <span>''<span><font color="#9A1900">/* not implemented */</font></span>''</span>
-
/* Called when the language has been changed */
+
<span><font color="#FF0000">}</font></span></tt>
-
static void
+
-
language (HildonIMPlugin *plugin)
+
-
{
+
-
  /* not implemented */
+
-
}
+
-
</source>
+
-
 
+
* hildon-input-method/hildon-im-plugin.h
* hildon-input-method/hildon-im-plugin.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span><font color="#990000">(*</font></span>language_settings_changed<span><font color="#990000">)</font></span> <span><font color="#990000">(</font></span>HildonIMPlugin <span><font color="#990000"><nowiki>*</nowiki></font></span>plugin<span><font color="#990000">,</font></span> gint index<span><font color="#990000">);</font></span>
-
<source lang="c">
+
</tt>
-
void (*language_settings_changed) (HildonIMPlugin *plugin, gint index);
+
'''language_settings_changed''' is called whenever the language settings for the specified language index have been changed.
-
</source>
+
-
 
+
-
<code>language_settings_changed</code> is called whenever the language settings for the specified language index have been changed.
+
=== Plug-in Loading ===
=== Plug-in Loading ===
Line 276: Line 246:
A nature of a plug-in is that it can be dynamically loaded. In this case also, the HIM plug-in is loaded whenever the user selects it, so in order to support the dynamic loading, the plug-in has to provide the following three specific functions for Hildon Input Method plug-in system:
A nature of a plug-in is that it can be dynamically loaded. In this case also, the HIM plug-in is loaded whenever the user selects it, so in order to support the dynamic loading, the plug-in has to provide the following three specific functions for Hildon Input Method plug-in system:
-
==== module_init ====
+
*  <tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">module_init</font></span>'''</span> <span><font color="#990000">(</font></span>GTypeModule <span><font color="#990000"><nowiki>*</nowiki></font></span>module<span><font color="#990000">);</font></span>
-
 
+
</tt>
-
<source lang="c">
+
This function initializes the plug-in as a module, meaning the type of GTypeInfo needs to be registered, and the interface and instance information (GInterfaceInfo) need to be added to the module. hildon-input-method-plugins-example/src/him-vkb-example.c
-
void module_init (GTypeModule *module);
+
<tt><span><font color="#009900">void</font></span>
-
</source>
+
<span>'''<span><font color="#000000">module_init</font></span>'''</span><span><font color="#990000">(</font></span>GTypeModule <span><font color="#990000"><nowiki>*</nowiki></font></span>module<span><font color="#990000">)</font></span>
-
 
+
<span><font color="#FF0000">{</font></span>
-
This function initializes the plug-in as a module, meaning the type of <code>GTypeInfo</code> needs to be registered, and the interface and instance information (<code>GInterfaceInfo</code>) need to be added to the module. hildon-input-method-plugins-example/src/him-vkb-example.c
+
  <span>'''<span><font color="#0000FF">static</font></span>'''</span> <span>'''<span><font color="#0000FF">const</font></span>'''</span> GTypeInfo type_info <span><font color="#990000"><nowiki>=</nowiki></font></span> <span><font color="#FF0000">{</font></span>
-
 
+
    <span>'''<span><font color="#0000FF">sizeof</font></span>'''</span><span><font color="#990000">(</font></span>HimExampleVKBClass<span><font color="#990000">),</font></span>
-
<source lang="c">
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* base_init */</font></span>''</span>
-
void
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* base_finalize */</font></span>''</span>
-
module_init(GTypeModule *module)
+
    <span><font color="#990000">(</font></span>GClassInitFunc<span><font color="#990000">)</font></span> himExample_vkb_class_init<span><font color="#990000">,</font></span>
-
{
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* class_finalize */</font></span>''</span>
-
  static const GTypeInfo type_info = {
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* class_data */</font></span>''</span>
-
    sizeof(HimExampleVKBClass),
+
    <span>'''<span><font color="#0000FF">sizeof</font></span>'''</span><span><font color="#990000">(</font></span>HimExampleVKB<span><font color="#990000">),</font></span>
-
    NULL, /* base_init */
+
    <span><font color="#993399">0</font></span><span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* n_preallocs */</font></span>''</span>
-
    NULL, /* base_finalize */
+
    <span><font color="#990000">(</font></span>GInstanceInitFunc<span><font color="#990000">)</font></span> himExample_vkb_init<span><font color="#990000">,</font></span>
-
    (GClassInitFunc) himExample_vkb_class_init,
+
  <span><font color="#FF0000">}</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
-
    NULL, /* class_finalize */
+
  <span>'''<span><font color="#0000FF">static</font></span>'''</span> <span>'''<span><font color="#0000FF">const</font></span>'''</span> GInterfaceInfo plugin_info <span><font color="#990000"><nowiki>=</nowiki></font></span> <span><font color="#FF0000">{</font></span>
-
    NULL, /* class_data */
+
    <span><font color="#990000">(</font></span>GInterfaceInitFunc<span><font color="#990000">)</font></span> himExample_vkb_iface_init<span><font color="#990000">,</font></span>
-
    sizeof(HimExampleVKB),
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* interface_finalize */</font></span>''</span>
-
    0, /* n_preallocs */
+
    NULL<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* interface_data */</font></span>''</span>
-
    (GInstanceInitFunc) himExample_vkb_init,
+
  <span><font color="#FF0000">}</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  };
+
  himExample_vkb_type <span><font color="#990000"><nowiki>=</nowiki></font></span>
-
  static const GInterfaceInfo plugin_info = {
+
          <span>'''<span><font color="#000000">g_type_module_register_type</font></span>'''</span><span><font color="#990000">(</font></span>module<span><font color="#990000">,</font></span>
-
    (GInterfaceInitFunc) himExample_vkb_iface_init,
+
                                      GTK_TYPE_WIDGET<span><font color="#990000">,</font></span> <span><font color="#FF0000">"HimExampleVKB"</font></span><span><font color="#990000">,</font></span>
-
    NULL, /* interface_finalize */
+
                                      <span><font color="#990000">&amp;</font></span>type_info<span><font color="#990000">,</font></span>
-
    NULL, /* interface_data */
+
                                      <span><font color="#993399">0</font></span><span><font color="#990000">);</font></span>
-
  };
+
  <span>'''<span><font color="#000000">g_type_module_add_interface</font></span>'''</span><span><font color="#990000">(</font></span>module<span><font color="#990000">,</font></span>
-
  himExample_vkb_type =
+
                              HIMEXAMPLE_VKB_TYPE<span><font color="#990000">,</font></span>
-
          g_type_module_register_type(module,
+
                              HILDON_IM_TYPE_PLUGIN<span><font color="#990000">,</font></span>
-
                                      GTK_TYPE_WIDGET, "HimExampleVKB",
+
                              <span><font color="#990000">&amp;</font></span>plugin_info<span><font color="#990000">);</font></span>
-
                                      &type_info,
+
<span><font color="#FF0000">}</font></span></tt>
-
                                      0);
+
The '''himExample_vkb_iface_init''' function should register the custom interface functions in '''HildonIMPluginIface'''<nowiki>: </nowiki>hildon-input-method-plugins-example/src/him-vkb-example.c
-
  g_type_module_add_interface(module,
+
<tt><span>''<span><font color="#9A1900">/* Standard GTK stuff */</font></span>''</span>
-
                              HIMEXAMPLE_VKB_TYPE,
+
<span>'''<span><font color="#0000FF">static</font></span>'''</span> <span><font color="#009900">void</font></span>
-
                              HILDON_IM_TYPE_PLUGIN,
+
<span>'''<span><font color="#000000">himExample_vkb_iface_init</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMPluginIface <span><font color="#990000"><nowiki>*</nowiki></font></span>iface<span><font color="#990000">)</font></span>
-
                              &plugin_info);
+
<span><font color="#FF0000">{</font></span>
-
}
+
  iface<span><font color="#990000">-&gt;</font></span>enable <span><font color="#990000"><nowiki>=</nowiki></font></span> enable<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
</source>
+
  iface<span><font color="#990000">-&gt;</font></span>disable <span><font color="#990000"><nowiki>=</nowiki></font></span> disable<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
 
+
  iface<span><font color="#990000">-&gt;</font></span>enter <span><font color="#990000"><nowiki>=</nowiki></font></span> enter<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
The <code>himExample_vkb_iface_init</code> function should register the custom interface functions in <code>HildonIMPluginIface</code>: hildon-input-method-plugins-example/src/him-vkb-example.c
+
  iface<span><font color="#990000">-&gt;</font></span>tab <span><font color="#990000"><nowiki>=</nowiki></font></span> tab<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
 
+
  iface<span><font color="#990000">-&gt;</font></span>backspace <span><font color="#990000"><nowiki>=</nowiki></font></span> backspace<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
<source lang="c">
+
  iface<span><font color="#990000">-&gt;</font></span>clear <span><font color="#990000"><nowiki>=</nowiki></font></span> clear<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
/* Standard GTK stuff */
+
  iface<span><font color="#990000">-&gt;</font></span>input_mode_changed <span><font color="#990000"><nowiki>=</nowiki></font></span> input_mode_changed<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
static void
+
  iface<span><font color="#990000">-&gt;</font></span>client_widget_changed <span><font color="#990000"><nowiki>=</nowiki></font></span> client_widget_changed<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
himExample_vkb_iface_init (HildonIMPluginIface *iface)
+
  iface<span><font color="#990000">-&gt;</font></span>save_data <span><font color="#990000"><nowiki>=</nowiki></font></span> save_data<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
{
+
  iface<span><font color="#990000">-&gt;</font></span>language <span><font color="#990000"><nowiki>=</nowiki></font></span> language<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->enable = enable;
+
  iface<span><font color="#990000">-&gt;</font></span>mode_a <span><font color="#990000"><nowiki>=</nowiki></font></span> mode_a<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->disable = disable;
+
  iface<span><font color="#990000">-&gt;</font></span>mode_b <span><font color="#990000"><nowiki>=</nowiki></font></span> mode_b<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->enter = enter;
+
  iface<span><font color="#990000">-&gt;</font></span>language_settings_changed <span><font color="#990000"><nowiki>=</nowiki></font></span> language_settings_changed<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->tab = tab;
+
  iface<span><font color="#990000">-&gt;</font></span>settings_changed <span><font color="#990000"><nowiki>=</nowiki></font></span> settings_changed<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->backspace = backspace;
+
  <span>'''<span><font color="#0000FF">return</font></span>'''</span><span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  iface->clear = clear;
+
<span><font color="#FF0000">}</font></span></tt>
-
  iface->input_mode_changed = input_mode_changed;
+
*  <tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">module_exit</font></span>'''</span> <span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">);</font></span>
-
  iface->client_widget_changed = client_widget_changed;
+
</tt>
-
  iface->save_data = save_data;
+
-
  iface->language = language;
+
-
  iface->mode_a = mode_a;
+
-
  iface->mode_b = mode_b;
+
-
  iface->language_settings_changed = language_settings_changed;
+
-
  iface->settings_changed = settings_changed;
+
-
  return;
+
-
}
+
-
</source>
+
-
 
+
This function defines actions when the module is unloaded from the memory. hildon-input-method-plugins-example/src/him-vkb-example.c
This function defines actions when the module is unloaded from the memory. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt><span><font color="#009900">void</font></span>
-
<source lang="c">
+
<span>'''<span><font color="#000000">module_exit</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">)</font></span>
-
void
+
<span><font color="#FF0000">{</font></span>
-
module_exit(void)
+
  <span>''<span><font color="#9A1900">/* empty */</font></span>''</span>
-
{
+
<span><font color="#FF0000">}</font></span></tt>
-
  /* empty */
+
*  <tt>HildonIMPlugin<span><font color="#990000"><nowiki>*</nowiki></font></span> <span>'''<span><font color="#000000">module_create</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>ui<span><font color="#990000">);</font></span>
-
}
+
</tt>
-
</source>
+
-
 
+
-
<source lang="c">
+
-
HildonIMPlugin* module_create (HildonIMUI *ui);
+
-
</source>
+
-
 
+
This function creates and returns the plug-in widget to the main UI. hildon-input-method-plugins-example/src/him-vkb-example.c
This function creates and returns the plug-in widget to the main UI. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt>HildonIMPlugin<span><font color="#990000"><nowiki>*</nowiki></font></span>
-
<source lang="c">
+
<span>'''<span><font color="#000000">module_create</font></span>'''</span> <span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">)</font></span>
-
HildonIMPlugin*
+
<span><font color="#FF0000">{</font></span>
-
module_create (HildonIMUI *keyboard)
+
  <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span>'''<span><font color="#000000">HILDON_IM_PLUGIN</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">himExample_vkb_new</font></span>'''</span> <span><font color="#990000">(</font></span>keyboard<span><font color="#990000">));</font></span>
-
{
+
<span><font color="#FF0000">}</font></span></tt>
-
  return HILDON_IM_PLUGIN (himExample_vkb_new (keyboard));
+
-
}
+
-
</source>
+
=== Plug-in Info ===
=== Plug-in Info ===
Line 369: Line 320:
Some basic information of the plug-in needs to be provided to the HIM plug-in system, so it can keep up with the kinds of plug-ins that are available in the system. This is performed with two specific functions:
Some basic information of the plug-in needs to be provided to the HIM plug-in system, so it can keep up with the kinds of plug-ins that are available in the system. This is performed with two specific functions:
-
<source lang="c">
+
<tt><span>'''<span><font color="#0000FF">const</font></span>'''</span> HildonIMPluginInfo<span><font color="#990000"><nowiki>*</nowiki></font></span> <span>'''<span><font color="#000000">hildon_im_plugin_get_info</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">);</font></span>
-
HildonIMPlugin* module_create (HildonIMUI *ui);
+
</tt>
-
</source>
+
The function creates '''HildonIMPluginInfo''' struct for providing the required information. hildon-input-method-plugins-example/src/him-vkb-example.c
-
 
+
<tt><span>''<span><font color="#9A1900">/* Input Method plugin information.</font></span>''</span>
-
The function creates <code>HildonIMPluginInfo</code> struct for providing the required information. hildon-input-method-plugins-example/src/him-vkb-example.c
+
  <span>''<span><font color="#9A1900"> * This structure tells the main UI about this plugin */</font></span>''</span>
-
 
+
<span>'''<span><font color="#0000FF">const</font></span>'''</span> HildonIMPluginInfo <span><font color="#990000"><nowiki>*</nowiki></font></span>
-
<source lang="c">
+
<span>'''<span><font color="#000000">hildon_im_plugin_get_info</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">)</font></span>
-
/* Input Method plugin information.
+
<span><font color="#FF0000">{</font></span>
-
  * This structure tells the main UI about this plugin */
+
  <span>'''<span><font color="#0000FF">static</font></span>'''</span> <span>'''<span><font color="#0000FF">const</font></span>'''</span> HildonIMPluginInfo info <span><font color="#990000"><nowiki>=</nowiki></font></span>
-
const HildonIMPluginInfo *
+
  <span><font color="#FF0000">{</font></span>
-
hildon_im_plugin_get_info(void)
+
    <span><font color="#FF0000">"HIM VKB Example"</font></span><span><font color="#990000">,</font></span>                 <span>''<span><font color="#9A1900">/* description */</font></span>''</span>
-
{
+
    <span><font color="#FF0000">"himExample_vkb"</font></span><span><font color="#990000">,</font></span>                   <span>''<span><font color="#9A1900">/* name */</font></span>''</span>
-
  static const HildonIMPluginInfo info =
+
    <span><font color="#FF0000">"Keyboard (EXAMPLE)"</font></span><span><font color="#990000">,</font></span>               <span>''<span><font color="#9A1900">/* menu title */</font></span>''</span>
-
  {
+
    NULL<span><font color="#990000">,</font></span>                               <span>''<span><font color="#9A1900">/* gettext domain */</font></span>''</span>
-
    "HIM VKB Example",                  /* description */
+
    TRUE<span><font color="#990000">,</font></span>                               <span>''<span><font color="#9A1900">/* visible in menu */</font></span>''</span>
-
    "himExample_vkb",                  /* name */
+
    FALSE<span><font color="#990000">,</font></span>                             <span>''<span><font color="#9A1900">/* cached */</font></span>''</span>
-
    "Keyboard (EXAMPLE)",              /* menu title */
+
    HILDON_IM_TYPE_DEFAULT<span><font color="#990000">,</font></span>             <span>''<span><font color="#9A1900">/* UI type */</font></span>''</span>
-
    NULL,                              /* gettext domain */
+
    HILDON_IM_GROUP_LATIN<span><font color="#990000">,</font></span>             <span>''<span><font color="#9A1900">/* group */</font></span>''</span>
-
    TRUE,                              /* visible in menu */
+
    HILDON_IM_DEFAULT_PLUGIN_PRIORITY<span><font color="#990000">,</font></span> <span>''<span><font color="#9A1900">/* priority */</font></span>''</span>
-
    FALSE,                              /* cached */
+
    NULL<span><font color="#990000">,</font></span>                               <span>''<span><font color="#9A1900">/* special character plugin */</font></span>''</span>
-
    HILDON_IM_TYPE_DEFAULT,            /* UI type */
+
    <span><font color="#FF0000">""</font></span><span><font color="#990000">,</font></span>                                 <span>''<span><font color="#9A1900">/* help page */</font></span>''</span>
-
    HILDON_IM_GROUP_LATIN,              /* group */
+
    FALSE<span><font color="#990000">,</font></span>                             <span>''<span><font color="#9A1900">/* disable common UI buttons */</font></span>''</span>
-
    HILDON_IM_DEFAULT_PLUGIN_PRIORITY,  /* priority */
+
    HILDON_IM_DEFAULT_HEIGHT<span><font color="#990000">,</font></span>           <span>''<span><font color="#9A1900">/* plugin height */</font></span>''</span>
-
    NULL,                              /* special character plugin */
+
    HILDON_IM_TRIGGER_STYLUS            <span>''<span><font color="#9A1900">/* trigger */</font></span>''</span>
-
    "",                                /* help page */
+
  <span><font color="#FF0000">}</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
-
    FALSE,                              /* disable common UI buttons */
+
  <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span><font color="#990000">&amp;</font></span>info<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
    HILDON_IM_DEFAULT_HEIGHT,          /* plugin height */
+
<span><font color="#FF0000">}</font></span></tt>
-
    HILDON_IM_TRIGGER_STYLUS            /* trigger */
+
*  <tt>gchar<span><font color="#990000"><nowiki>**</nowiki></font></span> <span>'''<span><font color="#000000">hildon_im_plugin_get_available_languages</font></span>'''</span> <span><font color="#990000">(</font></span>gboolean <span><font color="#990000"><nowiki>*</nowiki></font></span>free<span><font color="#990000">);</font></span>
-
  };
+
</tt>
-
  return &info;
+
The function returns a NULL terminated array of string, containing language codes supported by the plug-in. Set '''free''' to '''TRUE''' if HIM main UI should free the returned value when no longer used. hildon-input-method-plugins-example/src/him-vkb-example.c
-
}
+
<tt><span>''<span><font color="#9A1900">/*</font></span>''</span>
-
</source>
+
  <span>''<span><font color="#9A1900"> * This function returns the list of available languages supported</font></span>''</span>
-
 
+
  <span>''<span><font color="#9A1900"> * by the plugin.</font></span>''</span>
-
The function returns a <code>NULL</code> terminated array of string, containing language codes supported by the plug-in. Set <code>free</code> to <code>TRUE</code> if HIM main UI should free the returned value when no longer used. hildon-input-method-plugins-example/src/him-vkb-example.c
+
  <span>''<span><font color="#9A1900"> * */</font></span>''</span>
-
 
+
gchar <span><font color="#990000"><nowiki>**</nowiki></font></span>
-
<source lang="c">
+
<span>'''<span><font color="#000000">hildon_im_plugin_get_available_languages</font></span>'''</span> <span><font color="#990000">(</font></span>gboolean <span><font color="#990000"><nowiki>*</nowiki></font></span>free<span><font color="#990000">)</font></span>
-
/*
+
<span><font color="#FF0000">{</font></span>
-
  * This function returns the list of available languages supported
+
  <span>'''<span><font color="#0000FF">static</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>list<span><font color="#990000">[]</font></span> <span><font color="#990000"><nowiki>=</nowiki></font></span> <span><font color="#FF0000">{</font></span> <span><font color="#FF0000">"en_GB"</font></span><span><font color="#990000">,</font></span> NULL <span><font color="#FF0000">}</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  * by the plugin.
+
  <span><font color="#990000"><nowiki>*</nowiki></font></span>free <span><font color="#990000"><nowiki>=</nowiki></font></span> FALSE<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
  * */
+
  <span>'''<span><font color="#0000FF">return</font></span>'''</span> list<span><font color="#990000"><nowiki>;</nowiki></font></span>
-
gchar **
+
<span><font color="#FF0000">}</font></span></tt>
-
hildon_im_plugin_get_available_languages (gboolean *free)
+
-
{
+
-
  static gchar *list[] = { "en_GB", NULL };
+
-
  *free = FALSE;
+
-
  return list;
+
-
}
+
-
</source>
+
==  Interaction with main user interface ==
==  Interaction with main user interface ==
-
As mentioned above, the plug-in is placed inside the HIM main UI. This section deals with interacting with it. This is mainly done by calling its functions, as defined in <code>hildon-im-ui.h</code>.
+
As mentioned above, the plug-in is placed inside the HIM main UI. This section deals with interacting with it. This is mainly done by calling its functions, as defined in '''hildon-im-ui.h'''.
=== Handling Input ===
=== Handling Input ===
Line 426: Line 370:
hildon-input-method/hildon-im-ui.h
hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_send_utf8</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>main_ui<span><font color="#990000">,</font></span> <span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>text<span><font color="#990000">);</font></span></tt>
-
void hildon_im_ui_send_utf8(HildonIMUI *main_ui, const gchar *text);
+
-
</source>
+
The plug-in can request the main UI to commit a UTF-8 encoded text by calling this function. hildon-input-method/hildon-im-ui.h
The plug-in can request the main UI to commit a UTF-8 encoded text by calling this function. hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_send_communication_message</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>main_ui<span><font color="#990000">,</font></span> gint message<span><font color="#990000">);</font></span></tt>
-
void hildon_im_ui_send_communication_message(HildonIMUI *main_ui, gint message);
+
-
</source>
+
The plug-in can use this function to tell the main UI that '''Enter''', '''Backspace''', or '''Tab''' virtual buttons are pressed. Simply call this function and pass one of the constants below as the '''message''' argument:
The plug-in can use this function to tell the main UI that '''Enter''', '''Backspace''', or '''Tab''' virtual buttons are pressed. Simply call this function and pass one of the constants below as the '''message''' argument:
Line 446: Line 386:
hildon-input-method/hildon-im-ui.h
hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_set_visible</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>ui<span><font color="#990000">,</font></span> gboolean visible<span><font color="#990000">);</font></span></tt>
-
void hildon_im_ui_set_visible(HildonIMUI *ui, gboolean visible);
+
-
</source>
+
The plug-in can request the main UI to set it's visibility by calling this function. hildon-input-method/hildon-im-ui.h
The plug-in can request the main UI to set it's visibility by calling this function. hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt>gboolean <span>'''<span><font color="#000000">hildon_im_ui_get_visibility</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>main_ui<span><font color="#990000">);</font></span></tt>
-
gboolean hildon_im_ui_get_visibility(HildonIMUI *main_ui);
+
-
</source>
+
By calling this function, the plug-in can get the visibility status of the main UI.
By calling this function, the plug-in can get the visibility status of the main UI.
Line 462: Line 398:
The following two state reader functions could be very handy in case the plug-in receives a state change notification (e.g. language change), because this way all the state information does not need to be saved. hildon-input-method/hildon-im-ui.h
The following two state reader functions could be very handy in case the plug-in receives a state change notification (e.g. language change), because this way all the state information does not need to be saved. hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt>HildonIMCommand <span>'''<span><font color="#000000">hildon_im_ui_get_autocase_mode</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>main_ui<span><font color="#990000">);</font></span></tt>
-
HildonIMCommand hildon_im_ui_get_autocase_mode(HildonIMUI *main_ui);
+
-
</source>
+
The function returns the auto-capitalization mode of the current client widget. hildon-input-method/hildon-im-ui.h
The function returns the auto-capitalization mode of the current client widget. hildon-input-method/hildon-im-ui.h
-
<source lang="c">
+
<tt><span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span> <span>'''<span><font color="#000000">hildon_im_ui_get_active_language</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>main_ui<span><font color="#990000">);</font></span></tt>
-
const gchar * hildon_im_ui_get_active_language(HildonIMUI *main_ui);
+
-
</source>
+
The function returns the current language code.
The function returns the current language code.
Line 481: Line 413:
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_label</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                    HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_label(HildonIMUI *keyboard,
+
                                    <span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>label<span><font color="#990000">);</font></span>
-
                                  HildonIMButton button,
+
</tt>
-
                                  const gchar *label);
+
-
</source>
+
-
 
+
With this function, the plug-in can set the label of a button.
With this function, the plug-in can set the label of a button.
-
Possible values of <code>HildonIMButton</code> (see '''hildon-im-ui.h'''):
+
Possible values of '''HildonIMButton''' (see '''hildon-im-ui.h'''):
** <code>HILDON_IM_BUTTON_TAB</code>
** <code>HILDON_IM_BUTTON_TAB</code>
** <code>HILDON_IM_BUTTON_MODE_A</code>
** <code>HILDON_IM_BUTTON_MODE_A</code>
Line 499: Line 428:
** <code>BUTTON_CLOSE</code>
** <code>BUTTON_CLOSE</code>
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_id</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>self<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_id(HildonIMUI *self,
+
                                <span>'''<span><font color="#0000FF">const</font></span>'''</span> gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>id<span><font color="#990000">);</font></span>
-
                                HildonIMButton button,
+
</tt>
-
                                const gchar *id);
+
-
</source>
+
-
 
+
This function sets a name to a particular button.
This function sets a name to a particular button.
Line 511: Line 437:
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_active</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                    HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_active(HildonIMUI *keyboard,
+
                                    gboolean active<span><font color="#990000">);</font></span>
-
                                    HildonIMButton button,
+
</tt>
-
                                    gboolean active);
+
-
</source>
+
-
 
+
This function sets the active state of a particular button.
This function sets the active state of a particular button.
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt>gboolean <span>'''<span><font color="#000000">hildon_im_ui_button_get_active</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                        HildonIMButton button<span><font color="#990000">);</font></span>
-
gboolean hildon_im_ui_button_get_active(HildonIMUI *keyboard,
+
</tt>
-
                                        HildonIMButton button);
+
-
</source>
+
-
 
+
This function returns the active state of a particular button.
This function returns the active state of a particular button.
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_toggle</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                    HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_toggle(HildonIMUI *keyboard,
+
                                    gboolean toggle<span><font color="#990000">);</font></span>
-
                                    HildonIMButton button,
+
</tt>
-
                                    gboolean toggle);
+
-
</source>
+
-
 
+
The plug-in can set the toggle state of a particular button with this function.
The plug-in can set the toggle state of a particular button with this function.
Line 540: Line 457:
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_menu</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                  HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_menu(HildonIMUI *keyboard,
+
                                  GtkWidget <span><font color="#990000"><nowiki>*</nowiki></font></span>menu<span><font color="#990000">);</font></span>
-
                                  HildonIMButton button,
+
</tt>
-
                                  GtkWidget *menu);
+
With this function, the plug-in can attach a menu - which is a GtkWidget - to a particular button.
-
</source>
+
-
 
+
-
With this function, the plug-in can attach a menu - which is a <code>GtkWidget</code> - to a particular button.
+
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_sensitive</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                        HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_sensitive(HildonIMUI *keyboard,
+
                                        gboolean sensitive<span><font color="#990000">);</font></span>
-
                                      HildonIMButton button,
+
</tt>
-
                                      gboolean sensitive);
+
-
</source>
+
-
 
+
All the buttons defined on the HIM main UI may not be needed, or the functionality of a button may be wished to be switched off in some states. In this case, the sensitivity of a particular button can be set by calling this function.
All the buttons defined on the HIM main UI may not be needed, or the functionality of a button may be wished to be switched off in some states. In this case, the sensitivity of a particular button can be set by calling this function.
* hildon-input-method/hildon-im-ui.h
* hildon-input-method/hildon-im-ui.h
-
 
+
<tt><span><font color="#009900">void</font></span> <span>'''<span><font color="#000000">hildon_im_ui_button_set_repeat</font></span>'''</span><span><font color="#990000">(</font></span>HildonIMUI <span><font color="#990000"><nowiki>*</nowiki></font></span>keyboard<span><font color="#990000">,</font></span>
-
<source lang="c">
+
                                    HildonIMButton button<span><font color="#990000">,</font></span>
-
void hildon_im_ui_button_set_repeat(HildonIMUI *keyboard,
+
                                    gboolean repeat<span><font color="#990000">);</font></span>
-
                                    HildonIMButton button,
+
</tt>
-
                                    gboolean repeat);
+
-
</source>
+
-
 
+
This function controls whether a particular button will repeat when pressed for a long time.
This function controls whether a particular button will repeat when pressed for a long time.
Line 571: Line 479:
At least the following headers shall be included in the plug-in:
At least the following headers shall be included in the plug-in:
-
<source lang="c">
+
<tt><span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;hildon-im-plugin.h&gt;</font></span>
-
#include <hildon-im-plugin.h>
+
<span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;hildon-im-ui.h&gt;</font></span></tt>
-
#include <hildon-im-ui.h>
+
-
</source>
+
-
[http://maemo.org/packages/view/hildon-input-method-framework-dev/ hildon-input-method-framework-dev] and [http://maemo.org/packages/view/libhildon-im-ui-dev/ libhildon-im-ui-dev] packages.
+
'''hildon-input-method-framework-dev''' and '''libhildon-im-ui-dev''' packages.
== Language codes ==
== Language codes ==
Line 597: Line 503:
  ti_ET tl_PH tr_TR tt_RU uk_UA ur_PK uz_UZ vi_VN wa_BE yi_US  
  ti_ET tl_PH tr_TR tt_RU uk_UA ur_PK uz_UZ vi_VN wa_BE yi_US  
  zh_CN zh_HK zh_SG zh_TW
  zh_CN zh_HK zh_SG zh_TW
-
 
-
[[Category:Development]]
 
-
[[Category:Documentation]]
 
-
[[Category:Fremantle]]
 

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)