org.gnome.gtk

## Class InputMethod

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.InputMethod

- Direct Known Subclasses:
    MulticontextInputMethod, SimpleInputMethod

      public abstract class InputMethod
      extends Object

  Complex input handling.

  In GTK, these are `GtkIMContext` objects. This class and its concrete subclasses are presented here according to the Java naming conventions.

  Since:
    4.0.14
  Author:
    Andrew Cowie

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `InputMethod.Commit` Signal emitted when the input method completes its composition.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(InputMethod.Commit handler)` Hookup a `InputMethod.Commit` handler.
    `boolean` | `filterKeypress(EventKey event)` Find out whether the input method has handled a keystroke, or whether it needs to be further handled or propegated.
    `void` | `setUsePreedit(boolean setting)` How hould the InputMethod provide feedback to the user?

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### connect

          public void connect(InputMethod.Commit handler)

      Hookup a `InputMethod.Commit` handler.
      Since:
        4.0.14

    - #### filterKeypress

          public boolean filterKeypress(EventKey event)

      Find out whether the input method has handled a keystroke, or whether it needs to be further handled or propegated.

      This is for use in `Widget.KeyPressEvent` and `Widget.KeyReleaseEvent` handlers when hooking up an input method to a Widget, where the code will look something like:

           drawing.connect(new Widget.KeyPressEvent() {
               public boolean onKeyPressEvent(Widget source, EventKey event) {
                   if (input.filterKeypress(event)) {
                       return true;
                   }

                   // or carry on with your logic,
                   if (doSomething()) {
                       return true;
                   }

                   // otherwise progegate the keystroke up to the default handler
                   return false;
               }
           });

      You need to do call this for both key presses and releases (at least, for the default input method to work right, anyway).
      Since:
        4.0.14

    - #### setUsePreedit

          public void setUsePreedit(boolean setting)

      How hould the InputMethod provide feedback to the user? The default is `true`, which is to ask the Widget to display in-line, communicating the preedit string via the signal handlers. Otherwise, the InputMethod can attempt to use some alternative (internal) means.
      Since:
        4.0.14