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

## Stability Level

Stable, unless otherwise indicated

## Functions

IBusLookupTable * | ibus_lookup_table_new ()
void | ibus_lookup_table_append_candidate ()
guint | ibus_lookup_table_get_number_of_candidates ()
IBusText * | ibus_lookup_table_get_candidate ()
void | ibus_lookup_table_append_label ()
void | ibus_lookup_table_set_label ()
IBusText * | ibus_lookup_table_get_label ()
void | ibus_lookup_table_set_cursor_pos ()
guint | ibus_lookup_table_get_cursor_pos ()
void | ibus_lookup_table_set_cursor_visible ()
gboolean | ibus_lookup_table_is_cursor_visible ()
guint | ibus_lookup_table_get_cursor_in_page ()
void | ibus_lookup_table_set_page_size ()
guint | ibus_lookup_table_get_page_size ()
void | ibus_lookup_table_set_round ()
gboolean | ibus_lookup_table_is_round ()
void | ibus_lookup_table_set_orientation ()
gint | ibus_lookup_table_get_orientation ()
void | ibus_lookup_table_clear ()
gboolean | ibus_lookup_table_page_up ()
gboolean | ibus_lookup_table_page_down ()
gboolean | ibus_lookup_table_cursor_up ()
gboolean | ibus_lookup_table_cursor_down ()

## Types and Values

struct | IBusLookupTable

## 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.

see_also: IBusEngine

## Functions

### ibus_lookup_table_new ()

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

New a IBusLookupTable.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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;".

#### Parameters

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;".

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

table | An IBusLookupTable. |
orientation | . |

### ibus_lookup_table_get_orientation ()

    gint
    ibus_lookup_table_get_orientation (IBusLookupTable *table);

Returns the orientation of the IBusLookupTable.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

table | An IBusLookupTable. |

#### Returns

TRUE if succeed.

## Types and Values

### 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()`.

#### Members

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 ... |