clean db
[platform/upstream/ibus-libpinyin.git] / src / PYLookupTable.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-pinyin - The Chinese PinYin engine for IBus
4  *
5  * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 #ifndef __PY_LOOKUP_TABLE_H_
22 #define __PY_LOOKUP_TABLE_H_
23
24 #include <ibus.h>
25 #include "PYObject.h"
26 #include "PYText.h"
27
28 namespace PY {
29
30 class LookupTable : Object {
31 public:
32     LookupTable (guint page_size = 10,
33                  guint cursor_pos = 0,
34                  gboolean cursor_visible = TRUE,
35                  gboolean round = FALSE)
36         : Object (ibus_lookup_table_new (page_size, cursor_pos, cursor_visible, round)) { }
37
38     guint pageSize (void)       { return ibus_lookup_table_get_page_size (*this); }
39     guint orientation (void)    { return ibus_lookup_table_get_orientation (*this); }
40     guint cursorPos (void)      { return ibus_lookup_table_get_cursor_pos (*this); }
41     guint size (void)           { return ibus_lookup_table_get_number_of_candidates (*this); }
42
43     gboolean pageUp (void)      { return ibus_lookup_table_page_up (*this); }
44     gboolean pageDown (void)    { return ibus_lookup_table_page_down (*this); }
45     gboolean cursorUp (void)    { return ibus_lookup_table_cursor_up (*this); }
46     gboolean cursorDown (void)  { return ibus_lookup_table_cursor_down (*this); }
47
48     void setPageSize (guint size)           { ibus_lookup_table_set_page_size (*this, size); }
49     void setCursorPos (guint pos)           { ibus_lookup_table_set_cursor_pos (*this, pos); }
50     void setOrientation (gint orientation)  { ibus_lookup_table_set_orientation (*this, orientation); }
51     void clear (void)                       { ibus_lookup_table_clear (*this); }
52     void setCursorVisable (gboolean visable){ ibus_lookup_table_set_cursor_visible (*this, visable); }
53     void setLabel (guint index, IBusText *text) { ibus_lookup_table_set_label (*this, index, text); }
54     void appendCandidate (IBusText *text)   { ibus_lookup_table_append_candidate (*this, text); }
55     void appendLabel (IBusText *text)       { ibus_lookup_table_append_label (*this, text); }
56     IBusText * getCandidate(guint index)    { return ibus_lookup_table_get_candidate(*this, index); }
57
58     operator IBusLookupTable * (void) const
59     {
60         return get<IBusLookupTable> ();
61     }
62
63 };
64
65 };
66
67 #endif