IBusLookupTable

## IBusLookupTable IBusLookupTable — Candidate word/phrase lookup table. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    struct              IBusLookupTable;
    struct              IBusLookupTableClass;
    IBusLookupTable *   ibus_lookup_table_new               (guint page_size,
                                                             guint cursor_pos,
                                                             gboolean cursor_visible,
                                                             gboolean round);
    void                ibus_lookup_table_append_candidate  (IBusLookupTable *table,
                                                             IBusText *text);
    guint               ibus_lookup_table_get_number_of_candidates
                                                            (IBusLookupTable *table);
    IBusText *          ibus_lookup_table_get_candidate     (IBusLookupTable *table,
                                                             guint index);
    void                ibus_lookup_table_append_label      (IBusLookupTable *table,
                                                             IBusText *text);
    void                ibus_lookup_table_set_label         (IBusLookupTable *table,
                                                             guint index,
                                                             IBusText *text);
    IBusText *          ibus_lookup_table_get_label         (IBusLookupTable *table,
                                                             guint index);
    void                ibus_lookup_table_set_cursor_pos    (IBusLookupTable *table,
                                                             guint cursor_pos);
    guint               ibus_lookup_table_get_cursor_pos    (IBusLookupTable *table);
    void                ibus_lookup_table_set_cursor_visible
                                                            (IBusLookupTable *table,
                                                             gboolean visible);
    gboolean            ibus_lookup_table_is_cursor_visible (IBusLookupTable *table);
    guint               ibus_lookup_table_get_cursor_in_page
                                                            (IBusLookupTable *table);
    void                ibus_lookup_table_set_page_size     (IBusLookupTable *table,
                                                             guint page_size);
    guint               ibus_lookup_table_get_page_size     (IBusLookupTable *table);
    void                ibus_lookup_table_set_round         (IBusLookupTable *table,
                                                             gboolean round);
    gboolean            ibus_lookup_table_is_round          (IBusLookupTable *table);
    void                ibus_lookup_table_set_orientation   (IBusLookupTable *table,
                                                             gint orientation);
    gint                ibus_lookup_table_get_orientation   (IBusLookupTable *table);
    void                ibus_lookup_table_clear             (IBusLookupTable *table);
    gboolean            ibus_lookup_table_page_up           (IBusLookupTable *table);
    gboolean            ibus_lookup_table_page_down         (IBusLookupTable *table);
    gboolean            ibus_lookup_table_cursor_up         (IBusLookupTable *table);
    gboolean            ibus_lookup_table_cursor_down       (IBusLookupTable *table);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusSerializable
                         +----IBusLookupTable

## Description

An IBusLookuptable stores the candidate words or phrases for users to choose from.

Use `ibus_engine_update_lookup_table()`, `ibus_engine_show_lookup_table()`, and `ibus_engine_hide_lookup_table()` to update, show and hide the lookup table.

## Details

### struct IBusLookupTable

    struct IBusLookupTable {
        guint page_size;
        guint cursor_pos;
        gboolean cursor_visible;
        gboolean round;
        gint orientation;

        GArray *candidates;
        GArray *labels;
    };

An IBusLookuptable stores the candidate words or phrases for users to choose from. Note that some input methods allow you to select candidate by pressing non-numeric keys such as "asdfghjkl;". Developers of these input methods should change the labels with `ibus_lookup_table_append_label()`.

guint `page_size`; | number of candidate shown per page.
guint `cursor_pos`; | position index of cursor.
gboolean `cursor_visible`; | whether the cursor is visible.
gboolean `round`; | TRUE for lookup table wrap around.
gint `orientation`; | orientation of the table.
GArray *`candidates`; | Candidate words/phrases.
GArray *`labels`; | Candidate labels which identify individual candidates in the same page. Default is 1, 2, 3, 4 ...

### struct IBusLookupTableClass

    struct IBusLookupTableClass {
        IBusSerializableClass parent;
    };

### ibus_lookup_table_new ()

    IBusLookupTable *   ibus_lookup_table_new               (guint page_size,
                                                             guint cursor_pos,
                                                             gboolean cursor_visible,
                                                             gboolean round);

New a IBusLookupTable.

`page_size` : | number of candidate shown per page, the max value is 16.
`cursor_pos` : | position index of cursor.
`cursor_visible` : | whether the cursor is visible.
`round` : | TRUE for lookup table wrap around.
Returns : | A newly allocated IBusLookupTable.

### ibus_lookup_table_append_candidate ()

    void                ibus_lookup_table_append_candidate  (IBusLookupTable *table,
                                                             IBusText *text);

Append a candidate word/phrase to IBusLookupTable, and increase reference.

`table` : | An IBusLookupTable.
`text` : | candidate word/phrase to be appended (in IBusText format).

### ibus_lookup_table_get_number_of_candidates ()

    guint               ibus_lookup_table_get_number_of_candidates
                                                            (IBusLookupTable *table);

Return the number of candidate in the table.

`table` : | An IBusLookupTable.
Returns : | The number of candidates in the table

### ibus_lookup_table_get_candidate ()

    IBusText *          ibus_lookup_table_get_candidate     (IBusLookupTable *table,
                                                             guint index);

Return IBusText at the given index. Borrowed reference.

`table` : | An IBusLookupTable.
`index` : | Index in the Lookup table.
Returns : | IBusText at the given index; NULL if no such IBusText. [transfer none]

### ibus_lookup_table_append_label ()

    void                ibus_lookup_table_append_label      (IBusLookupTable *table,
                                                             IBusText *text);

Append a candidate word/phrase to IBusLookupTable, and increase reference. This function is needed if the input method select candidate with non-numeric keys such as "asdfghjkl;".

`table` : | An IBusLookupTable.
`text` : | A candidate label to be appended (in IBusText format).

### ibus_lookup_table_set_label ()

    void                ibus_lookup_table_set_label         (IBusLookupTable *table,
                                                             guint index,
                                                             IBusText *text);

Append a candidate word/phrase to IBusLookupTable, and increase reference. This function is needed if the input method select candidate with non-numeric keys such as "asdfghjkl;".

`table` : | An IBusLookupTable.
`index` : | Intex in the Lookup table.
`text` : | A candidate label to be appended (in IBusText format).

### ibus_lookup_table_get_label ()

    IBusText *          ibus_lookup_table_get_label         (IBusLookupTable *table,
                                                             guint index);

Return IBusText at the given index. Borrowed reference.

`table` : | An IBusLookupTable.
`index` : | Index in the Lookup table.
Returns : | IBusText at the given index; NULL if no such IBusText. [transfer none]

### ibus_lookup_table_set_cursor_pos ()

    void                ibus_lookup_table_set_cursor_pos    (IBusLookupTable *table,
                                                             guint cursor_pos);

Set the cursor position of IBusLookupTable.

`table` : | An IBusLookupTable.
`cursor_pos` : | The position of cursor.

### ibus_lookup_table_get_cursor_pos ()

    guint               ibus_lookup_table_get_cursor_pos    (IBusLookupTable *table);

Get the cursor position of IBusLookupTable.

`table` : | An IBusLookupTable.
Returns : | The position of cursor.

### ibus_lookup_table_set_cursor_visible ()

    void                ibus_lookup_table_set_cursor_visible
                                                            (IBusLookupTable *table,
                                                             gboolean visible);

Set whether to make the cursor of an IBusLookupTable visible or not.

`table` : | An IBusLookupTable.
`visible` : | Whether to make the cursor of `table` visible.

### ibus_lookup_table_is_cursor_visible ()

    gboolean            ibus_lookup_table_is_cursor_visible (IBusLookupTable *table);

Returns whether the cursor of an IBusLookupTable is visible.

`table` : | An IBusLookupTable.
Returns : | Whether the cursor of `table` is visible.

### ibus_lookup_table_get_cursor_in_page ()

    guint               ibus_lookup_table_get_cursor_in_page
                                                            (IBusLookupTable *table);

Get the cursor position in current page of IBusLookupTable.

`table` : | An IBusLookupTable.
Returns : | The position of cursor in current page.

### ibus_lookup_table_set_page_size ()

    void                ibus_lookup_table_set_page_size     (IBusLookupTable *table,
                                                             guint page_size);

Set the number of candidate shown per page.

`table` : | An IBusLookupTable.
`page_size` : | number of candidate shown per page.

### ibus_lookup_table_get_page_size ()

    guint               ibus_lookup_table_get_page_size     (IBusLookupTable *table);

Get the number of candidate shown per page.

`table` : | An IBusLookupTable.
Returns : | Page size, i.e., number of candidate shown per page.

### ibus_lookup_table_set_round ()

    void                ibus_lookup_table_set_round         (IBusLookupTable *table,
                                                             gboolean round);

Set whether to make the IBusLookupTable round or not.

`table` : | An IBusLookupTable.
`round` : | Whether to make `table` round.

### ibus_lookup_table_is_round ()

    gboolean            ibus_lookup_table_is_round          (IBusLookupTable *table);

Returns whether the IBusLookupTable is round.

`table` : | An IBusLookupTable.
Returns : | Whether the `table` is round.

### ibus_lookup_table_set_orientation ()

    void                ibus_lookup_table_set_orientation   (IBusLookupTable *table,
                                                             gint orientation);

Set the orientation.

`table` : | An IBusLookupTable.
`orientation` : | .

### ibus_lookup_table_get_orientation ()

    gint                ibus_lookup_table_get_orientation   (IBusLookupTable *table);

Returns the orientation of the IBusLookupTable.

`table` : | An IBusLookupTable.
Returns : | The orientation of the `table`.

### ibus_lookup_table_clear ()

    void                ibus_lookup_table_clear             (IBusLookupTable *table);

Clear and remove all candidate from an IBusLookupTable.

`table` : | An IBusLookupTable.

### ibus_lookup_table_page_up ()

    gboolean            ibus_lookup_table_page_up           (IBusLookupTable *table);

Go to previous page of an IBusLookupTable.

It returns FALSE if it is already at the first page, unless `table>-round==TRUE`, where it will go to the last page.

`table` : | An IBusLookupTable.
Returns : | TRUE if succeed.

### ibus_lookup_table_page_down ()

    gboolean            ibus_lookup_table_page_down         (IBusLookupTable *table);

Go to next page of an IBusLookupTable.

It returns FALSE if it is already at the last page, unless `table>-round==TRUE`, where it will go to the first page.

`table` : | An IBusLookupTable.
Returns : | TRUE if succeed.

### ibus_lookup_table_cursor_up ()

    gboolean            ibus_lookup_table_cursor_up         (IBusLookupTable *table);

Go to previous candidate of an IBusLookupTable.

It returns FALSE if it is already at the first candidate, unless `table>-round==TRUE`, where it will go to the last candidate.

`table` : | An IBusLookupTable.
Returns : | TRUE if succeed.

### ibus_lookup_table_cursor_down ()

    gboolean            ibus_lookup_table_cursor_down       (IBusLookupTable *table);

Go to next candidate of an IBusLookupTable.

It returns FALSE if it is already at the last candidate, unless `table>-round==TRUE`, where it will go to the first candidate.

`table` : | An IBusLookupTable.
Returns : | TRUE if succeed.

## See Also

IBusEngine