gdkkeys.h 5.19 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
15
16
17
18
19
20
21
22
23
24
25
26
 * 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
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * 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/.
 */

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

Havoc Pennington's avatar
Havoc Pennington committed
31
32
33
34
35
#ifndef __GDK_KEYS_H__
#define __GDK_KEYS_H__

#include <gdk/gdktypes.h>

36
G_BEGIN_DECLS
Havoc Pennington's avatar
Havoc Pennington committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

typedef struct _GdkKeymapKey GdkKeymapKey;

/* GdkKeymapKey is a hardware key that can be mapped to a keyval */
struct _GdkKeymapKey
{
  guint keycode;
  gint  group;
  gint  level;
};

/* 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.
 */

typedef struct _GdkKeymap      GdkKeymap;
typedef struct _GdkKeymapClass GdkKeymapClass;

#define GDK_TYPE_KEYMAP              (gdk_keymap_get_type ())
#define GDK_KEYMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
#define GDK_KEYMAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
#define GDK_IS_KEYMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
#define GDK_IS_KEYMAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
#define GDK_KEYMAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))

struct _GdkKeymap
{
68
  GObject     parent_instance;
Matthias Clasen's avatar
Matthias Clasen committed
69
  GdkDisplay *GSEAL (display);
Havoc Pennington's avatar
Havoc Pennington committed
70
71
72
73
74
};

struct _GdkKeymapClass
{
  GObjectClass parent_class;
75

76
  void (*direction_changed) (GdkKeymap *keymap);
77
  void (*keys_changed)      (GdkKeymap *keymap);
78
  void (*state_changed)     (GdkKeymap *keymap);
Havoc Pennington's avatar
Havoc Pennington committed
79
80
81
82
};

GType gdk_keymap_get_type (void) G_GNUC_CONST;

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


89
90
91
92
93
94
95
96
97
guint          gdk_keymap_lookup_key               (GdkKeymap           *keymap,
						    const GdkKeymapKey  *key);
gboolean       gdk_keymap_translate_keyboard_state (GdkKeymap           *keymap,
						    guint                hardware_keycode,
						    GdkModifierType      state,
						    gint                 group,
						    guint               *keyval,
						    gint                *effective_group,
						    gint                *level,
98
						    GdkModifierType     *consumed_modifiers);
99
100
101
102
103
104
105
106
107
108
gboolean       gdk_keymap_get_entries_for_keyval   (GdkKeymap           *keymap,
						    guint                keyval,
						    GdkKeymapKey       **keys,
						    gint                *n_keys);
gboolean       gdk_keymap_get_entries_for_keycode  (GdkKeymap           *keymap,
						    guint                hardware_keycode,
						    GdkKeymapKey       **keys,
						    guint              **keyvals,
						    gint                *n_entries);
PangoDirection gdk_keymap_get_direction            (GdkKeymap           *keymap);
109
gboolean       gdk_keymap_have_bidi_layouts        (GdkKeymap           *keymap);
110
gboolean       gdk_keymap_get_caps_lock_state      (GdkKeymap           *keymap);
111
gboolean       gdk_keymap_get_num_lock_state       (GdkKeymap           *keymap);
Matthias Clasen's avatar
Matthias Clasen committed
112
113
void           gdk_keymap_add_virtual_modifiers    (GdkKeymap           *keymap,
                                                    GdkModifierType     *state);
114
115
gboolean       gdk_keymap_map_virtual_modifiers    (GdkKeymap           *keymap,
                                                    GdkModifierType     *state);
Havoc Pennington's avatar
Havoc Pennington committed
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

/* Key values
 */
gchar*   gdk_keyval_name         (guint        keyval) G_GNUC_CONST;
guint    gdk_keyval_from_name    (const gchar *keyval_name);
void     gdk_keyval_convert_case (guint        symbol,
				  guint       *lower,
				  guint       *upper);
guint    gdk_keyval_to_upper     (guint        keyval) G_GNUC_CONST;
guint    gdk_keyval_to_lower     (guint        keyval) G_GNUC_CONST;
gboolean gdk_keyval_is_upper     (guint        keyval) G_GNUC_CONST;
gboolean gdk_keyval_is_lower     (guint        keyval) G_GNUC_CONST;

guint32  gdk_keyval_to_unicode   (guint        keyval) G_GNUC_CONST;
guint    gdk_unicode_to_keyval   (guint32      wc) G_GNUC_CONST;


133
G_END_DECLS
Havoc Pennington's avatar
Havoc Pennington committed
134
135

#endif /* __GDK_KEYS_H__ */