1 | /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ |
2 | /* vim:set et sts=4: */ |
3 | /* ibus - The Input Bus |
4 | * Copyright (C) 2011 Peng Huang <shawn.p.huang@gmail.com> |
5 | * Copyright (C) 2011 Google, Inc. |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2.1 of the License, or (at your option) any later version. |
11 | * |
12 | * This library 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 GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
20 | * USA |
21 | */ |
22 | |
23 | #if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION) |
24 | #error "Only <ibus.h> can be included directly" |
25 | #endif |
26 | |
27 | #ifndef __IBUS_KEYS_H_ |
28 | #define __IBUS_KEYS_H_ |
29 | |
30 | #include <glib.h> |
31 | |
32 | G_BEGIN_DECLS |
33 | /** |
34 | * ibus_keyval_name: |
35 | * @keyval: Key symbol. |
36 | * |
37 | * Return the name of a key symbol. |
38 | * |
39 | * Note that the returned string is used internally, so don't free it. |
40 | * |
41 | * Returns: Corresponding key name. %NULL if no such key symbol. |
42 | */ |
43 | const gchar *ibus_keyval_name (guint keyval); |
44 | |
45 | /** |
46 | * ibus_keyval_from_name: |
47 | * @keyval_name: Key name in #gdk_keys_by_name. |
48 | * |
49 | * Return the key symbol that associate with the key name. |
50 | * |
51 | * Returns: Corresponding key symbol. |
52 | */ |
53 | guint ibus_keyval_from_name (const gchar *keyval_name); |
54 | |
55 | /** |
56 | * ibus_unicode_to_keyval: |
57 | * @wc: a ISO10646 encoded character |
58 | * |
59 | * Convert from a ISO10646 character to a key symbol. |
60 | * |
61 | * Returns: the corresponding IBus key symbol, if one exists. |
62 | * or, if there is no corresponding symbol, |
63 | * wc | 0x01000000 |
64 | **/ |
65 | guint ibus_unicode_to_keyval (gunichar wc); |
66 | |
67 | /** |
68 | * ibus_keyval_to_unicode: |
69 | * @keyval: an IBus key symbol |
70 | * |
71 | * Convert from an IBus key symbol to the corresponding ISO10646 (Unicode) |
72 | * character. |
73 | * |
74 | * Returns: the corresponding unicode character, or 0 if there |
75 | * is no corresponding character. |
76 | **/ |
77 | gunichar ibus_keyval_to_unicode (guint keyval); |
78 | |
79 | /** |
80 | * ibus_keyval_to_upper: |
81 | * @keyval: a key value. |
82 | * |
83 | * Converts a key value to upper case, if applicable. |
84 | * |
85 | * Returns: the upper case form of @keyval, or @keyval itself if it is already |
86 | * in upper case or it is not subject to case conversion. |
87 | */ |
88 | guint ibus_keyval_to_upper (guint keyval); |
89 | |
90 | /** |
91 | * ibus_keyval_to_lower: |
92 | * @keyval: a key value. |
93 | * |
94 | * Converts a key value to lower case, if applicable. |
95 | * |
96 | * Returns: the lower case form of @keyval, or @keyval itself if it is already |
97 | * in lower case or it is not subject to case conversion. |
98 | */ |
99 | guint ibus_keyval_to_lower (guint keyval); |
100 | |
101 | /** |
102 | * ibus_keyval_convert_case: |
103 | * @symbol: a keyval |
104 | * @lower: (out): return location for lowercase version of @symbol |
105 | * @upper: (out): return location for uppercase version of @symbol |
106 | * |
107 | * Obtains the upper- and lower-case versions of the keyval @symbol. |
108 | * Examples of keyvals are #IBUS_KEY_a, #IBUS_KEY_Return, #IBUS_KEY_F1, etc. |
109 | */ |
110 | void ibus_keyval_convert_case (guint symbol, guint *lower, guint *upper); |
111 | |
112 | G_END_DECLS |
113 | #endif // __IBUS_KEYS_H_ |
114 | |