Exemple #1
0
static void slot_update_lookup_table(const LookupTable& table)
{
    std::vector<String> labels;
    std::vector<String> candidates;
    std::vector<String> attrs;
    size_t current_page_size = table.get_current_page_size();
    for (size_t i = 0; i < current_page_size; ++i) {
        labels.push_back(utf8_wcstombs(table.get_candidate_label(i)));
    }
    for (size_t i = 0; i < current_page_size; ++i) {
        candidates.push_back(utf8_wcstombs(table.get_candidate_in_current_page(i)));
        attrs.push_back(AttrList2String(table.get_attributes_in_current_page(i)));
    }
    bool hasprev = table.get_current_page_start();
    bool hasnext = table.get_current_page_start() + current_page_size < table.number_of_candidates();
    panel->UpdateLookupTable(labels, candidates, attrs, hasprev, hasnext);

    int cursor_pos = table.get_cursor_pos_in_current_page();
    panel->UpdateLookupTableCursor(cursor_pos);
}