NimfEngine 3 NIMF Library
NimfEngine

## Functions

gboolean | nimf_engine_filter_event ()
void | nimf_engine_reset ()
void | nimf_engine_focus_in ()
void | nimf_engine_focus_out ()
void | nimf_engine_set_surrounding ()
gboolean | nimf_engine_get_surrounding ()
void | nimf_engine_status_changed ()
void | nimf_engine_set_method ()
void | nimf_engine_emit_preedit_start ()
void | nimf_engine_emit_preedit_changed ()
void | nimf_engine_emit_preedit_end ()
void | nimf_engine_emit_commit ()
gboolean | nimf_engine_emit_retrieve_surrounding ()
gboolean | nimf_engine_emit_delete_surrounding ()
void | nimf_engine_emit_beep ()
const gchar * | nimf_engine_get_id ()
const gchar * | nimf_engine_get_icon_name ()
NimfCandidatable * | nimf_engine_get_candidatable ()

## Types and Values

struct | NimfEngineClass

## Object Hierarchy

        GObject
        ╰── NimfEngine

## Description

## Functions

### nimf_engine_filter_event ()

    gboolean
    nimf_engine_filter_event (NimfEngine *engine,
                              NimfServiceIC *ic,
                              NimfEvent *event);

Let the language engine handle the event.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |
event | a NimfEvent |

#### Returns

`TRUE` if the language engine consumed the event.

nimf_engine_filter_event

### nimf_engine_reset ()

    void
    nimf_engine_reset (NimfEngine *engine,
                       NimfServiceIC *ic);

Resets the engine .

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_reset

### nimf_engine_focus_in ()

    void
    nimf_engine_focus_in (NimfEngine *engine,
                          NimfServiceIC *ic);

Notifies the language engine that the caller has gained focus.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_focus_in

### nimf_engine_focus_out ()

    void
    nimf_engine_focus_out (NimfEngine *engine,
                           NimfServiceIC *ic);

Notifies the language engine that the caller has lost focus.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_focus_out

### nimf_engine_set_surrounding ()

    void
    nimf_engine_set_surrounding (NimfEngine *engine,
                                 const char *text,
                                 gint len,
                                 gint cursor_index);

Sets surrounding text in engine . This function is expected to be called in response to `nimf_engine_get_surrounding()`.

#### Parameters

engine | a NimfEngine |
text | surrounding text |
len | the byte length of text |
cursor_index | the character index of the cursor within text . |

nimf_engine_set_surrounding

### nimf_engine_get_surrounding ()

    gboolean
    nimf_engine_get_surrounding (NimfEngine *engine,
                                 NimfServiceIC *ic,
                                 gchar **text,
                                 gint *cursor_index);

This function internally calls `nimf_engine_emit_retrieve_surrounding()`. Gets surrounding text from the caller of `nimf_im_set_surrounding()`, if available.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |
text | location to store surrounding text. | [out][transfer full]
cursor_index | location to store cursor index. | [out][transfer full]

#### Returns

`TRUE` if surrounding text is available

nimf_engine_get_surrounding

### nimf_engine_status_changed ()

    void
    nimf_engine_status_changed (NimfEngine *engine);

Notifies that the status of the engine has changed.

#### Parameters

engine | a NimfEngine |

nimf_engine_status_changed

### nimf_engine_set_method ()

    void
    nimf_engine_set_method (NimfEngine *engine,
                            const gchar *method_id);

The engine may provide multiple input methods. Sets an input method by method_id

#### Parameters

engine | a NimfEngine |
method_id | method id |

nimf_engine_set_method

### nimf_engine_emit_preedit_start ()

    void
    nimf_engine_emit_preedit_start (NimfEngine *engine,
                                    NimfServiceIC *ic);

Emits the “preedit-start” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_emit_preedit_start

### nimf_engine_emit_preedit_changed ()

    void
    nimf_engine_emit_preedit_changed (NimfEngine *engine,
                                      NimfServiceIC *ic,
                                      const gchar *preedit_string,
                                      NimfPreeditAttr **attrs,
                                      gint cursor_pos);

Emits the “preedit-changed” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |
preedit_string | preedit string |
attrs | NimfPreeditAttr array |
cursor_pos | cursor position within preedit_string |

nimf_engine_emit_preedit_changed

### nimf_engine_emit_preedit_end ()

    void
    nimf_engine_emit_preedit_end (NimfEngine *engine,
                                  NimfServiceIC *ic);

Emits the “preedit-end” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_emit_preedit_end

### nimf_engine_emit_commit ()

    void
    nimf_engine_emit_commit (NimfEngine *engine,
                             NimfServiceIC *ic,
                             gchar const *text);

Emits the “commit” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |
text | text to commit |

nimf_engine_emit_commit

### nimf_engine_emit_retrieve_surrounding ()

    gboolean
    nimf_engine_emit_retrieve_surrounding (NimfEngine *engine,
                                           NimfServiceIC *ic);

Emits the “retrieve-surrounding” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_emit_retrieve_surrounding

### nimf_engine_emit_delete_surrounding ()

    gboolean
    nimf_engine_emit_delete_surrounding (NimfEngine *engine,
                                         NimfServiceIC *ic,
                                         gint offset,
                                         gint n_chars);

Emits the “delete-surrounding” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |
offset | the character offset from the cursor position of the text to be deleted. A negative value indicates a position before the cursor. |
n_chars | the number of characters to be deleted |

nimf_engine_emit_delete_surrounding

### nimf_engine_emit_beep ()

    void
    nimf_engine_emit_beep (NimfEngine *engine,
                           NimfServiceIC *ic);

Emits the “beep” signal.

#### Parameters

engine | a NimfEngine |
ic | a NimfServiceIC associated with engine |

nimf_engine_emit_beep

### nimf_engine_get_id ()

    const gchar *
    nimf_engine_get_id (NimfEngine *engine);

#### Parameters

engine | NimfEngine |

#### Returns

engine id.

[transfer none]

nimf_engine_get_id

### nimf_engine_get_icon_name ()

    const gchar *
    nimf_engine_get_icon_name (NimfEngine *engine);

#### Parameters

engine | NimfEngine |

#### Returns

icon name.

[transfer none]

nimf_engine_get_icon_name

### nimf_engine_get_candidatable ()

    NimfCandidatable *
    nimf_engine_get_candidatable (NimfEngine *engine);

#### Parameters

engine | NimfEngine |

#### Returns

a NimfCandidatable.

[transfer none]

nimf_engine_get_candidatable

## Types and Values

### struct NimfEngineClass

    struct NimfEngineClass {
      /* Virtual functions */
      gboolean (* filter_event)       (NimfEngine          *engine,
                                       NimfServiceIC       *ic,
                                       NimfEvent           *event);
      void     (* reset)              (NimfEngine          *engine,
                                       NimfServiceIC       *ic);
      void     (* focus_in)           (NimfEngine          *engine,
                                       NimfServiceIC       *ic);
      void     (* focus_out)          (NimfEngine          *engine,
                                       NimfServiceIC       *ic);
      void     (* set_method)         (NimfEngine          *engine,
                                       const gchar         *method_id);
      /* candidate */
      gboolean (* candidate_page_up)   (NimfEngine         *engine,
                                        NimfServiceIC      *ic);
      gboolean (* candidate_page_down) (NimfEngine         *engine,
                                        NimfServiceIC      *ic);
      void     (* candidate_clicked)   (NimfEngine         *engine,
                                        NimfServiceIC      *ic,
                                        gchar              *text,
                                        gint                index);
      void     (* candidate_scrolled)  (NimfEngine         *engine,
                                        NimfServiceIC      *ic,
                                        gdouble             value);
      /* info */
      const gchar * (* get_id)        (NimfEngine          *engine);
      const gchar * (* get_icon_name) (NimfEngine          *engine);
    };

#### Members

filter_event () | If the language engine consumes the event, returns `TRUE`. |
reset () | Resets the language engine. |
focus_in () | Called via `nimf_im_focus_in()` when the caller has gained focus. |
focus_out () | Called via `nimf_im_focus_out()` when the caller has lost focus. |
set_method () | Sets the method in the language engine. |
candidate_page_up () | handler when candidate page up |
candidate_page_down () | handler when candidate page down |
candidate_clicked () | handler when candidate clicked |
candidate_scrolled () | handler when candidate scrolled |
get_id () | Gets the language engine id. |
get_icon_name () | Gets the language engine name. |

NimfEngineClass