fixes compile
[platform/upstream/ibus-libpinyin.git] / src / PYProperty.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-libpinyin - Intelligent Pinyin engine based on libpinyin 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20  */
21 #ifndef __PY_PROPERTY_H_
22 #define __PY_PROPERTY_H_
23
24 #include <ibus.h>
25 #include "PYObject.h"
26 #include "PYText.h"
27
28 namespace PY {
29
30 class Property : public Object {
31 public:
32     Property (const gchar   *key,
33               IBusPropType   type = PROP_TYPE_NORMAL,
34               IBusText      *label = NULL,
35               const gchar   *icon = NULL,
36               IBusText      *tooltip = NULL,
37               gboolean       sensitive = TRUE,
38               gboolean       visible = TRUE,
39               IBusPropState  state = PROP_STATE_UNCHECKED,
40               IBusPropList  *props = NULL)
41         : Object (ibus_property_new (key, type, label, icon, tooltip, sensitive, visible, state, props)) { }
42
43     void setLabel (IBusText *text)
44     {
45         ibus_property_set_label (get<IBusProperty> (), text);
46     }
47
48     void setLabel (const gchar *text)
49     {
50         setLabel (Text (text));
51     }
52
53     void setIcon (const gchar *icon)
54     {
55         ibus_property_set_icon (get<IBusProperty> (), icon);
56     }
57
58     void setSensitive (gboolean sensitive)
59     {
60         ibus_property_set_sensitive (get<IBusProperty> (), sensitive);
61     }
62
63     void setTooltip (IBusText *text)
64     {
65         ibus_property_set_tooltip (get<IBusProperty> (), text);
66     }
67
68     void setTooltip (const gchar *text)
69     {
70         setTooltip (Text (text));
71     }
72
73     operator IBusProperty * (void) const
74     {
75         return get<IBusProperty> ();
76     }
77 };
78
79
80 class PropList : Object {
81 public:
82     PropList (void) : Object (ibus_prop_list_new ()) { }
83
84     void append (Property &prop)
85     {
86         ibus_prop_list_append (get<IBusPropList> (), prop);
87     }
88
89     operator IBusPropList * (void) const
90     {
91         return get<IBusPropList> ();
92     }
93 };
94
95 };
96
97 #endif