scim::LookupTable Class Referenceabstract
Accessories

The base class of lookup table. More...

`#include <scim_lookup_table.h>`

## Public Member Functions

| LookupTable (int page_size=10)
| Constructor.
virtual | ~LookupTable ()
| Virtual destructor.
void | set_candidate_labels (const std::vector< WideString > &labels)
| Set the strings to label the candidates in one page.
WideString | get_candidate_label (int page_index) const
| Get the label string of a candidate in a page.
void | set_page_size (int page_size)
| Set the maximum page size.
int | get_page_size () const
| Get the maximum page size.
int | get_current_page_size () const
| Get current page size,.
int | get_current_page_start () const
| Get the start index of current page.
bool | is_cursor_visible () const
| Check if the cursor is visible.
bool | is_page_size_fixed () const
| Check if the page size is fixed, aka. couldn't reduced by FrontEnd.
int | get_cursor_pos () const
| Get current cursor position.
int | get_cursor_pos_in_current_page () const
| Get the cursor position in current page.
bool | page_up ()
| Flip to the previous page.
bool | page_down ()
| Flip to the next page.
bool | cursor_up ()
| Move cursor position to the previous entry.
bool | cursor_down ()
| Move cursor position to the next entry.
void | show_cursor (bool show=true)
| Set the cursor visibility.
void | fix_page_size (bool fixed=true)
| Set the page size to be fixed, aka. prevent from being changed by FrontEnd.
void | set_cursor_pos (int pos)
| Set the cursor position.
void | set_cursor_pos_in_current_page (int pos)
| Set the cursor position in current page.
WideString | get_candidate_in_current_page (int page_index) const
| Get a candidate in current page.
AttributeList | get_attributes_in_current_page (int page_index) const
| Get the display attributes of a candidate in current page.
Pure Virtual functions.
These functions should be implemented in derivation classes.
virtual WideString | get_candidate (int index) const =0
| Get a candidate.
virtual AttributeList | get_attributes (int index) const =0
| Get the attributes of a candidate.
virtual uint32 | number_of_candidates () const =0
| Return the number of candidates in this table.
virtual void | clear ()=0
| Clear the table.

## Detailed Description

The base class of lookup table.

LookupTable is used to store the candidate phrases, it provides a easy way to manage the content of candidates and flip between multiple pages.

It also can manage the attributes for each candidate string.

This is abstract class and cannot store data. IMEngine should use its derivation class. This class is the interface that uses within FrontEnd class.

## Constructor & Destructor Documentation

## LookupTable()

scim::LookupTable::LookupTable | ( | int | page_size = 10 | ) |

Constructor.

Parameters

  page_size | - the maximum page size, can be set by set_page_size() later.

## ~LookupTable()

virtual scim::LookupTable::~LookupTable | ( |  | ) |

virtual

Virtual destructor.

## Member Function Documentation

## set_candidate_labels()

void scim::LookupTable::set_candidate_labels | ( | const std::vector< WideString > & | labels | ) |

Set the strings to label the candidates in one page.

Parameters

  labels | - the strings to label the candidates in one page.

## get_candidate_label()

WideString scim::LookupTable::get_candidate_label | ( | int | page_index | ) | const

Get the label string of a candidate in a page.

Parameters

  page_index | - the index in a page, 0 to (max page size - 1).

Returns
  the corresponding label of the index.

## set_page_size()

void scim::LookupTable::set_page_size | ( | int | page_size | ) |

Set the maximum page size.

Parameters

  page_size | - the max page size of the table.

## get_page_size()

int scim::LookupTable::get_page_size | ( |  | ) | const

Get the maximum page size.

Returns
  the max page size of the table.

## get_current_page_size()

int scim::LookupTable::get_current_page_size | ( |  | ) | const

Get current page size,.

Returns
  the page size of current page.It can be less than the max page size.

## get_current_page_start()

int scim::LookupTable::get_current_page_start | ( |  | ) | const

Get the start index of current page.

Returns
  the start item index of current page, starting from 0.

## is_cursor_visible()

bool scim::LookupTable::is_cursor_visible | ( |  | ) | const

Check if the cursor is visible.

Returns
  true if the cursor should be shown.

## is_page_size_fixed()

bool scim::LookupTable::is_page_size_fixed | ( |  | ) | const

Check if the page size is fixed, aka. couldn't reduced by FrontEnd.

Returns
  true if the page size shouldn't be reduced by FrontEnd.

## get_cursor_pos()

int scim::LookupTable::get_cursor_pos | ( |  | ) | const

Get current cursor position.

Returns
  the cursor position in the table, starting from 0.

## get_cursor_pos_in_current_page()

int scim::LookupTable::get_cursor_pos_in_current_page | ( |  | ) | const

Get the cursor position in current page.

Returns
  the cursor position in current page, equals to get_cursor_pos () - get_current_page_start ().

## page_up()

bool scim::LookupTable::page_up | ( |  | ) |

Flip to the previous page.

Returns
  true if success, false if it's already in the first page.

## page_down()

bool scim::LookupTable::page_down | ( |  | ) |

Flip to the next page.

Returns
  true if success, false if it's already in the last page.

## cursor_up()

bool scim::LookupTable::cursor_up | ( |  | ) |

Move cursor position to the previous entry.

Returns
  true if success, false if it's already at the first entry.

## cursor_down()

bool scim::LookupTable::cursor_down | ( |  | ) |

Move cursor position to the next entry.

Returns
  true if success. false if it's already at the last entry.

## show_cursor()

void scim::LookupTable::show_cursor | ( | bool | show = true | ) |

Set the cursor visibility.

Parameters

  show | - true to show the cursor.

## fix_page_size()

void scim::LookupTable::fix_page_size | ( | bool | fixed = true | ) |

Set the page size to be fixed, aka. prevent from being changed by FrontEnd.

## set_cursor_pos()

void scim::LookupTable::set_cursor_pos | ( | int | pos | ) |

Set the cursor position.

Parameters

  pos | - the absolute position of the cursor.

## set_cursor_pos_in_current_page()

void scim::LookupTable::set_cursor_pos_in_current_page | ( | int | pos | ) |

Set the cursor position in current page.

Parameters

  pos | - the relative position of the cursor in current page.

## get_candidate_in_current_page()

WideString scim::LookupTable::get_candidate_in_current_page | ( | int | page_index | ) | const

Get a candidate in current page.

Parameters

  page_index | - the candidate index in current page.

Returns
  the content of this candidate.

See also
  get_candidate

## get_attributes_in_current_page()

AttributeList scim::LookupTable::get_attributes_in_current_page | ( | int | page_index | ) | const

Get the display attributes of a candidate in current page.

Parameters

  page_index | - the index in current page.

Returns
  the AttributeList object holding the attributes of this candidate.

See also
  get_attributes

## get_candidate()

virtual WideString scim::LookupTable::get_candidate | ( | int | index | ) | const

pure virtual

Get a candidate.

Parameters

  index | - the candidate index in the lookup table.

Returns
  the content of this candidate.

Implemented in scim::CommonLookupTable.

## get_attributes()

virtual AttributeList scim::LookupTable::get_attributes | ( | int | index | ) | const

pure virtual

Get the attributes of a candidate.

Parameters

  index | - the index in the lookup table.

Returns
  the AttributeList object holding the attributes of this candidate.

Implemented in scim::CommonLookupTable.

## number_of_candidates()

virtual uint32 scim::LookupTable::number_of_candidates | ( |  | ) | const

pure virtual

Return the number of candidates in this table.

Returns
  the number of entries currently in this table.

Implemented in scim::CommonLookupTable.

## clear()

virtual void scim::LookupTable::clear | ( |  | ) |

pure virtual

Clear the table.

Implemented in scim::CommonLookupTable.

The documentation for this class was generated from the following file:

- scim_lookup_table.h