gdkkeys.h 6.1 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GDK - The GIMP Drawing Kit
Havoc Pennington's avatar
Havoc Pennington committed
2 3 4 5 6 7 8 9 10 11 12 13 14
 * Copyright (C) 2000 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Havoc Pennington's avatar
Havoc Pennington committed
16 17 18 19 20 21 22 23 24
 */

/*
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
 */

25 26 27
#ifndef __GDK_KEYS_H__
#define __GDK_KEYS_H__

28
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
29 30 31
#error "Only <gdk/gdk.h> can be included directly."
#endif

32
#include <gdk/gdkversionmacros.h>
Havoc Pennington's avatar
Havoc Pennington committed
33 34
#include <gdk/gdktypes.h>

35
G_BEGIN_DECLS
Havoc Pennington's avatar
Havoc Pennington committed
36

37

Havoc Pennington's avatar
Havoc Pennington committed
38 39
typedef struct _GdkKeymapKey GdkKeymapKey;

40 41 42 43 44 45 46 47 48
/**
 * GdkKeymapKey:
 * @keycode: the hardware keycode. This is an identifying number for a
 *   physical key.
 * @group: indicates movement in a horizontal direction. Usually groups are used
 *   for two different languages. In group 0, a key might have two English
 *   characters, and in group 1 it might have two Hebrew characters. The Hebrew
 *   characters will be printed on the key next to the English characters.
 * @level: indicates which symbol on the key will be used, in a vertical direction.
49
 *   So on a standard US keyboard, the key with the number “1” on it also has the
50
 *   exclamation point ("!") character on it. The level indicates whether to use
51
 *   the “1” or the “!” symbol. The letter keys are considered to have a lowercase
52 53 54 55 56
 *   letter at level 0, and an uppercase letter at level 1, though only the
 *   uppercase letter is printed.
 *
 * A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
 */
Havoc Pennington's avatar
Havoc Pennington committed
57 58 59 60 61 62 63 64 65 66 67
struct _GdkKeymapKey
{
  guint keycode;
  gint  group;
  gint  level;
};


#define GDK_TYPE_KEYMAP              (gdk_keymap_get_type ())
#define GDK_KEYMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
#define GDK_IS_KEYMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
68 69 70 71 72 73 74 75 76 77 78

/**
 * GdkKeymap:
 *
 * A #GdkKeymap defines the translation from keyboard state
 * (including a hardware key, a modifier mask, and active keyboard group)
 * to a keyval. This translation has two phases. The first phase is
 * to determine the effective keyboard group and level for the keyboard
 * state; the second phase is to look up the keycode/group/level triplet
 * in the keymap and see what keyval it corresponds to.
 */
Havoc Pennington's avatar
Havoc Pennington committed
79

80
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
81 82
GType gdk_keymap_get_type (void) G_GNUC_CONST;

83
#ifndef GDK_MULTIHEAD_SAFE
84
GDK_AVAILABLE_IN_ALL
85 86
GdkKeymap* gdk_keymap_get_default     (void);
#endif
87
GDK_AVAILABLE_IN_ALL
88
GdkKeymap* gdk_keymap_get_for_display (GdkDisplay *display);
Havoc Pennington's avatar
Havoc Pennington committed
89

90
GDK_AVAILABLE_IN_ALL
91 92
guint          gdk_keymap_lookup_key               (GdkKeymap           *keymap,
						    const GdkKeymapKey  *key);
93
GDK_AVAILABLE_IN_ALL
94 95 96 97 98 99 100
gboolean       gdk_keymap_translate_keyboard_state (GdkKeymap           *keymap,
						    guint                hardware_keycode,
						    GdkModifierType      state,
						    gint                 group,
						    guint               *keyval,
						    gint                *effective_group,
						    gint                *level,
101
						    GdkModifierType     *consumed_modifiers);
102
GDK_AVAILABLE_IN_ALL
103 104 105 106
gboolean       gdk_keymap_get_entries_for_keyval   (GdkKeymap           *keymap,
						    guint                keyval,
						    GdkKeymapKey       **keys,
						    gint                *n_keys);
107
GDK_AVAILABLE_IN_ALL
108 109 110 111 112
gboolean       gdk_keymap_get_entries_for_keycode  (GdkKeymap           *keymap,
						    guint                hardware_keycode,
						    GdkKeymapKey       **keys,
						    guint              **keyvals,
						    gint                *n_entries);
113

114
GDK_AVAILABLE_IN_ALL
115
PangoDirection gdk_keymap_get_direction            (GdkKeymap           *keymap);
116
GDK_AVAILABLE_IN_ALL
117
gboolean       gdk_keymap_have_bidi_layouts        (GdkKeymap           *keymap);
118
GDK_AVAILABLE_IN_ALL
119
gboolean       gdk_keymap_get_caps_lock_state      (GdkKeymap           *keymap);
120
GDK_AVAILABLE_IN_ALL
121
gboolean       gdk_keymap_get_num_lock_state       (GdkKeymap           *keymap);
122
GDK_AVAILABLE_IN_3_4
123
guint          gdk_keymap_get_modifier_state       (GdkKeymap           *keymap);
124
GDK_AVAILABLE_IN_ALL
125 126
void           gdk_keymap_add_virtual_modifiers    (GdkKeymap           *keymap,
                                                    GdkModifierType     *state);
127
GDK_AVAILABLE_IN_ALL
128 129
gboolean       gdk_keymap_map_virtual_modifiers    (GdkKeymap           *keymap,
                                                    GdkModifierType     *state);
130
GDK_AVAILABLE_IN_3_4
131 132 133
GdkModifierType gdk_keymap_get_modifier_mask       (GdkKeymap           *keymap,
                                                    GdkModifierIntent    intent);

Havoc Pennington's avatar
Havoc Pennington committed
134 135 136

/* Key values
 */
137
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
138
gchar*   gdk_keyval_name         (guint        keyval) G_GNUC_CONST;
139

140
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
141
guint    gdk_keyval_from_name    (const gchar *keyval_name);
142
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
143 144 145
void     gdk_keyval_convert_case (guint        symbol,
				  guint       *lower,
				  guint       *upper);
146
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
147
guint    gdk_keyval_to_upper     (guint        keyval) G_GNUC_CONST;
148
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
149
guint    gdk_keyval_to_lower     (guint        keyval) G_GNUC_CONST;
150
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
151
gboolean gdk_keyval_is_upper     (guint        keyval) G_GNUC_CONST;
152
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
153 154
gboolean gdk_keyval_is_lower     (guint        keyval) G_GNUC_CONST;

155
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
156
guint32  gdk_keyval_to_unicode   (guint        keyval) G_GNUC_CONST;
157
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
158 159 160
guint    gdk_unicode_to_keyval   (guint32      wc) G_GNUC_CONST;


161
G_END_DECLS
Havoc Pennington's avatar
Havoc Pennington committed
162 163

#endif /* __GDK_KEYS_H__ */