summaryrefslogtreecommitdiff
path: root/gtk/gtkaccelgroup.h
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-07-25 13:36:02 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-07-25 13:36:02 +0000
commite70939234cf3af180b4d2a695a0076b4538a3889 (patch)
tree5e26f207b4f43cc10ee5445ca8083138fb86b66c /gtk/gtkaccelgroup.h
parentafacc246f17fa078fa9a47f7496d570a1b0f97c8 (diff)
downloadgtk+-e70939234cf3af180b4d2a695a0076b4538a3889.tar.gz
commiting patch after comments from Alex on IRC
2001-07-15 James Henstridge <james@daa.com.au> * gtk/gtkwindow.c (gtk_window_add_accel_group): cast to GObject. (gtk_window_remove_accel_group): same here. (gtk_window_key_press_event): same here. * gtk/gtkwidget.c (gtk_widget_add_accelerator): cast to GObject. (gtk_widget_remove_accelerator): same here. (gtk_widget_remove_accelerators): same here. * gtk/gtkplug.c (gtk_plug_accel_entries_changed): same here. * gtk/gtkmenushell.c (gtk_menu_shell_key_press): cast to GObject instead of GtkObject. * gtk/gtkmenu.c (gtk_menu_key_press): update since GtkAccelGroup now takes GObjects. * gtk/gtkitemfactory.c (gtk_item_factory_propagate_accelerator): pass a GObject to gtk_accel_group_entries_from_object. (gtk_item_factory_create_item): s/accel_widget/accel_object/ * gtk/gtk-boxed.defs: remove GtkAccelGroup boxed def. * gtk/gtkaccellabel.c: convert to handle GObject accel objects. * gtk/gtkaccellabel.h: fix header to reflect that arbitrary GObjects can have accelerators set now. Add compatibility defines. * gtk/gtkmarshal.list: add missing marshallers. * gtk/gtkaccelgroup.[ch]: convert to a GObject, and allow setting accelerators on plain GObjects. gtk_accel_group_object_destroy has been converted into a weak reference, and gtk_accel_group_delete_entries is now a destroy notify for that piece of data.
Diffstat (limited to 'gtk/gtkaccelgroup.h')
-rw-r--r--gtk/gtkaccelgroup.h58
1 files changed, 34 insertions, 24 deletions
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index 2f6e805291..d3e8d1fb48 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -36,13 +36,20 @@
#include <gtk/gtkenums.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-typedef struct _GtkAccelGroup GtkAccelGroup;
-typedef struct _GtkAccelEntry GtkAccelEntry;
+#define GTK_TYPE_ACCEL_GROUP (gtk_accel_group_get_type ())
+#define GTK_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ACCEL_GROUP, GtkAccelGroup))
+#define GTK_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
+#define GTK_IS_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ACCEL_GROUP))
+#define GTK_IS_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_GROUP))
+#define GTK_ACCEL_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
+
+
+typedef struct _GtkAccelGroup GtkAccelGroup;
+typedef struct _GtkAccelGroupClass GtkAccelGroupClass;
+typedef struct _GtkAccelEntry GtkAccelEntry;
typedef enum
{
@@ -63,12 +70,17 @@ typedef enum
struct _GtkAccelGroup
{
- guint ref_count;
+ GObject parent;
guint lock_count;
GdkModifierType modifier_mask;
GSList *attach_objects;
};
+struct _GtkAccelGroupClass
+{
+ GObjectClass parent_class;
+};
+
struct _GtkAccelEntry
{
/* key portion
@@ -78,7 +90,7 @@ struct _GtkAccelEntry
GdkModifierType accelerator_mods;
GtkAccelFlags accel_flags;
- GtkObject *object;
+ GObject *object;
guint signal_id;
};
@@ -98,13 +110,14 @@ guint gtk_accelerator_get_default_mod_mask (void);
/* Accelerator Groups
*/
+GType gtk_accel_group_get_type (void);
GtkAccelGroup* gtk_accel_group_new (void);
GtkAccelGroup* gtk_accel_group_get_default (void);
GtkAccelGroup* gtk_accel_group_ref (GtkAccelGroup *accel_group);
void gtk_accel_group_unref (GtkAccelGroup *accel_group);
void gtk_accel_group_lock (GtkAccelGroup *accel_group);
void gtk_accel_group_unlock (GtkAccelGroup *accel_group);
-gboolean gtk_accel_groups_activate (GtkObject *object,
+gboolean gtk_accel_groups_activate (GObject *object,
guint accel_key,
GdkModifierType accel_mods);
@@ -114,9 +127,9 @@ gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group,
guint accel_key,
GdkModifierType accel_mods);
void gtk_accel_group_attach (GtkAccelGroup *accel_group,
- GtkObject *object);
+ GObject *object);
void gtk_accel_group_detach (GtkAccelGroup *accel_group,
- GtkObject *object);
+ GObject *object);
/* Accelerator Group Entries (internal)
*/
@@ -133,42 +146,39 @@ void gtk_accel_group_add (GtkAccelGroup *accel_group,
guint accel_key,
GdkModifierType accel_mods,
GtkAccelFlags accel_flags,
- GtkObject *object,
+ GObject *object,
const gchar *accel_signal);
void gtk_accel_group_remove (GtkAccelGroup *accel_group,
guint accel_key,
GdkModifierType accel_mods,
- GtkObject *object);
+ GObject *object);
/* Accelerator Signals (internal)
*/
-void gtk_accel_group_handle_add (GtkObject *object,
+void gtk_accel_group_handle_add (GObject *object,
guint accel_signal_id,
GtkAccelGroup *accel_group,
guint accel_key,
GdkModifierType accel_mods,
GtkAccelFlags accel_flags);
-void gtk_accel_group_handle_remove (GtkObject *object,
+void gtk_accel_group_handle_remove (GObject *object,
GtkAccelGroup *accel_group,
guint accel_key,
GdkModifierType accel_mods);
-guint gtk_accel_group_create_add (GtkType class_type,
- GtkSignalRunType signal_flags,
+guint gtk_accel_group_create_add (GType class_type,
+ GSignalFlags signal_flags,
guint handler_offset);
-guint gtk_accel_group_create_remove (GtkType class_type,
- GtkSignalRunType signal_flags,
+guint gtk_accel_group_create_remove (GType class_type,
+ GSignalFlags signal_flags,
guint handler_offset);
/* Miscellaneous (internal)
*/
-GSList* gtk_accel_groups_from_object (GtkObject *object);
-GSList* gtk_accel_group_entries_from_object (GtkObject *object);
-
+GSList* gtk_accel_groups_from_object (GObject *object);
+GSList* gtk_accel_group_entries_from_object (GObject *object);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* __GTK_ACCEL_GROUP_H__ */