[14481] | 1 | /* GTK - The GIMP Toolkit |
---|
| 2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
---|
| 3 | * |
---|
| 4 | * GtkAccelGroup: Accelerator manager for GtkObjects. |
---|
| 5 | * Copyright (C) 1998 Tim Janik |
---|
| 6 | * |
---|
| 7 | * This library is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU Library General Public |
---|
| 9 | * License as published by the Free Software Foundation; either |
---|
| 10 | * version 2 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 | * Library General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU Library General Public |
---|
| 18 | * License along with this library; if not, write to the |
---|
| 19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
| 20 | * Boston, MA 02111-1307, USA. |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS |
---|
| 25 | * file for a list of people on the GTK+ Team. See the ChangeLog |
---|
| 26 | * files for a list of changes. These files are distributed with |
---|
| 27 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef __GTK_ACCEL_GROUP_H__ |
---|
| 31 | #define __GTK_ACCEL_GROUP_H__ |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | #include <gdk/gdk.h> |
---|
| 35 | #include <gtk/gtkobject.h> |
---|
| 36 | #include <gtk/gtkenums.h> |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | #ifdef __cplusplus |
---|
| 40 | extern "C" { |
---|
| 41 | #endif /* __cplusplus */ |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | typedef struct _GtkAccelGroup GtkAccelGroup; |
---|
| 45 | typedef struct _GtkAccelEntry GtkAccelEntry; |
---|
| 46 | |
---|
| 47 | typedef enum |
---|
| 48 | { |
---|
| 49 | /* should the accelerator appear in |
---|
| 50 | * the widget's display? |
---|
| 51 | */ |
---|
| 52 | GTK_ACCEL_VISIBLE = 1 << 0, |
---|
| 53 | /* should the signal associated with |
---|
| 54 | * this accelerator be also visible? |
---|
| 55 | */ |
---|
| 56 | GTK_ACCEL_SIGNAL_VISIBLE = 1 << 1, |
---|
| 57 | /* may the accelerator be removed |
---|
| 58 | * again? |
---|
| 59 | */ |
---|
| 60 | GTK_ACCEL_LOCKED = 1 << 2, |
---|
| 61 | GTK_ACCEL_MASK = 0x07 |
---|
| 62 | } GtkAccelFlags; |
---|
| 63 | |
---|
| 64 | struct _GtkAccelGroup |
---|
| 65 | { |
---|
| 66 | guint ref_count; |
---|
| 67 | guint lock_count; |
---|
| 68 | GdkModifierType modifier_mask; |
---|
| 69 | GSList *attach_objects; |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | struct _GtkAccelEntry |
---|
| 73 | { |
---|
| 74 | /* key portion |
---|
| 75 | */ |
---|
| 76 | GtkAccelGroup *accel_group; |
---|
| 77 | guint accelerator_key; |
---|
| 78 | GdkModifierType accelerator_mods; |
---|
| 79 | |
---|
| 80 | GtkAccelFlags accel_flags; |
---|
| 81 | GtkObject *object; |
---|
| 82 | guint signal_id; |
---|
| 83 | }; |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | /* Accelerators |
---|
| 87 | */ |
---|
| 88 | gboolean gtk_accelerator_valid (guint keyval, |
---|
| 89 | GdkModifierType modifiers); |
---|
| 90 | void gtk_accelerator_parse (const gchar *accelerator, |
---|
| 91 | guint *accelerator_key, |
---|
| 92 | GdkModifierType *accelerator_mods); |
---|
| 93 | gchar* gtk_accelerator_name (guint accelerator_key, |
---|
| 94 | GdkModifierType accelerator_mods); |
---|
| 95 | void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask); |
---|
| 96 | guint gtk_accelerator_get_default_mod_mask (void); |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | /* Accelerator Groups |
---|
| 100 | */ |
---|
| 101 | GtkAccelGroup* gtk_accel_group_new (void); |
---|
| 102 | GtkAccelGroup* gtk_accel_group_get_default (void); |
---|
| 103 | GtkAccelGroup* gtk_accel_group_ref (GtkAccelGroup *accel_group); |
---|
| 104 | void gtk_accel_group_unref (GtkAccelGroup *accel_group); |
---|
| 105 | void gtk_accel_group_lock (GtkAccelGroup *accel_group); |
---|
| 106 | void gtk_accel_group_unlock (GtkAccelGroup *accel_group); |
---|
| 107 | gboolean gtk_accel_groups_activate (GtkObject *object, |
---|
| 108 | guint accel_key, |
---|
| 109 | GdkModifierType accel_mods); |
---|
| 110 | |
---|
| 111 | /* internal functions |
---|
| 112 | */ |
---|
| 113 | gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group, |
---|
| 114 | guint accel_key, |
---|
| 115 | GdkModifierType accel_mods); |
---|
| 116 | void gtk_accel_group_attach (GtkAccelGroup *accel_group, |
---|
| 117 | GtkObject *object); |
---|
| 118 | void gtk_accel_group_detach (GtkAccelGroup *accel_group, |
---|
| 119 | GtkObject *object); |
---|
| 120 | |
---|
| 121 | /* Accelerator Group Entries (internal) |
---|
| 122 | */ |
---|
| 123 | GtkAccelEntry* gtk_accel_group_get_entry (GtkAccelGroup *accel_group, |
---|
| 124 | guint accel_key, |
---|
| 125 | GdkModifierType accel_mods); |
---|
| 126 | void gtk_accel_group_lock_entry (GtkAccelGroup *accel_group, |
---|
| 127 | guint accel_key, |
---|
| 128 | GdkModifierType accel_mods); |
---|
| 129 | void gtk_accel_group_unlock_entry (GtkAccelGroup *accel_group, |
---|
| 130 | guint accel_key, |
---|
| 131 | GdkModifierType accel_mods); |
---|
| 132 | void gtk_accel_group_add (GtkAccelGroup *accel_group, |
---|
| 133 | guint accel_key, |
---|
| 134 | GdkModifierType accel_mods, |
---|
| 135 | GtkAccelFlags accel_flags, |
---|
| 136 | GtkObject *object, |
---|
| 137 | const gchar *accel_signal); |
---|
| 138 | void gtk_accel_group_remove (GtkAccelGroup *accel_group, |
---|
| 139 | guint accel_key, |
---|
| 140 | GdkModifierType accel_mods, |
---|
| 141 | GtkObject *object); |
---|
| 142 | |
---|
| 143 | /* Accelerator Signals (internal) |
---|
| 144 | */ |
---|
| 145 | void gtk_accel_group_handle_add (GtkObject *object, |
---|
| 146 | guint accel_signal_id, |
---|
| 147 | GtkAccelGroup *accel_group, |
---|
| 148 | guint accel_key, |
---|
| 149 | GdkModifierType accel_mods, |
---|
| 150 | GtkAccelFlags accel_flags); |
---|
| 151 | void gtk_accel_group_handle_remove (GtkObject *object, |
---|
| 152 | GtkAccelGroup *accel_group, |
---|
| 153 | guint accel_key, |
---|
| 154 | GdkModifierType accel_mods); |
---|
| 155 | guint gtk_accel_group_create_add (GtkType class_type, |
---|
| 156 | GtkSignalRunType signal_flags, |
---|
| 157 | guint handler_offset); |
---|
| 158 | guint gtk_accel_group_create_remove (GtkType class_type, |
---|
| 159 | GtkSignalRunType signal_flags, |
---|
| 160 | guint handler_offset); |
---|
| 161 | |
---|
| 162 | /* Miscellaneous (internal) |
---|
| 163 | */ |
---|
| 164 | GSList* gtk_accel_groups_from_object (GtkObject *object); |
---|
| 165 | GSList* gtk_accel_group_entries_from_object (GtkObject *object); |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | #ifdef __cplusplus |
---|
| 170 | } |
---|
| 171 | #endif /* __cplusplus */ |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | #endif /* __GTK_ACCEL_GROUP_H__ */ |
---|