1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2000 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
31 #ifndef __GDK_KEYS_H__
32 #define __GDK_KEYS_H__
34 #include <gdk/gdktypes.h>
39 typedef struct _GdkKeymapKey GdkKeymapKey;
43 * @keycode: the hardware keycode. This is an identifying number for a
45 * @group: indicates movement in a horizontal direction. Usually groups are used
46 * for two different languages. In group 0, a key might have two English
47 * characters, and in group 1 it might have two Hebrew characters. The Hebrew
48 * characters will be printed on the key next to the English characters.
49 * @level: indicates which symbol on the key will be used, in a vertical direction.
50 * So on a standard US keyboard, the key with the number "1" on it also has the
51 * exclamation point ("!") character on it. The level indicates whether to use
52 * the "1" or the "!" symbol. The letter keys are considered to have a lowercase
53 * letter at level 0, and an uppercase letter at level 1, though only the
54 * uppercase letter is printed.
56 * A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
66 #define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
67 #define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
68 #define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
69 #define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
70 #define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
71 #define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))
73 typedef struct _GdkKeymap GdkKeymap;
74 typedef struct _GdkKeymapClass GdkKeymapClass;
79 * A #GdkKeymap defines the translation from keyboard state
80 * (including a hardware key, a modifier mask, and active keyboard group)
81 * to a keyval. This translation has two phases. The first phase is
82 * to determine the effective keyboard group and level for the keyboard
83 * state; the second phase is to look up the keycode/group/level triplet
84 * in the keymap and see what keyval it corresponds to.
88 GObject parent_instance;
89 GdkDisplay *GSEAL (display);
92 struct _GdkKeymapClass
94 GObjectClass parent_class;
96 void (*direction_changed) (GdkKeymap *keymap);
97 void (*keys_changed) (GdkKeymap *keymap);
98 void (*state_changed) (GdkKeymap *keymap);
101 GType gdk_keymap_get_type (void) G_GNUC_CONST;
103 #ifndef GDK_MULTIHEAD_SAFE
104 GdkKeymap* gdk_keymap_get_default (void);
106 GdkKeymap* gdk_keymap_get_for_display (GdkDisplay *display);
109 guint gdk_keymap_lookup_key (GdkKeymap *keymap,
110 const GdkKeymapKey *key);
111 gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
112 guint hardware_keycode,
113 GdkModifierType state,
116 gint *effective_group,
118 GdkModifierType *consumed_modifiers);
119 gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
123 gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
124 guint hardware_keycode,
130 * gdk_keymap_get_direction:
131 * @keymap: a #GdkKeymap or %NULL to use the default keymap.
133 * Returns the direction of the keymap.
135 * Returns: the direction of the keymap, %PANGO_DIRECTION_LTR or
136 * %PANGO_DIRECTION_RTL.
138 PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap);
139 gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
140 gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
141 gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
142 void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
143 GdkModifierType *state);
144 gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
145 GdkModifierType *state);
149 gchar* gdk_keyval_name (guint keyval) G_GNUC_CONST;
152 * gdk_keyval_from_name:
153 * @keyval_name: a key name.
155 * Converts a key name to a key value.
157 * Returns: the corresponding key value, or %GDK_VoidSymbol if the key name is
160 guint gdk_keyval_from_name (const gchar *keyval_name);
161 void gdk_keyval_convert_case (guint symbol,
164 guint gdk_keyval_to_upper (guint keyval) G_GNUC_CONST;
165 guint gdk_keyval_to_lower (guint keyval) G_GNUC_CONST;
166 gboolean gdk_keyval_is_upper (guint keyval) G_GNUC_CONST;
167 gboolean gdk_keyval_is_lower (guint keyval) G_GNUC_CONST;
169 guint32 gdk_keyval_to_unicode (guint keyval) G_GNUC_CONST;
170 guint gdk_unicode_to_keyval (guint32 wc) G_GNUC_CONST;
175 #endif /* __GDK_KEYS_H__ */