From 1d82cc2f2ed92395635e9cce3d628ddd0e8696d1 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 29 Jun 1998 11:41:46 +0000 Subject: [PATCH] GtkType and macro fixups. widget argument implementation: Mon Jun 29 13:39:45 1998 Tim Janik * gtk/gtkarrow.h: GtkType and macro fixups. * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", "GtkArrow::shadow_type". --- ChangeLog | 6 ++++ ChangeLog.pre-2-0 | 6 ++++ ChangeLog.pre-2-10 | 6 ++++ ChangeLog.pre-2-2 | 6 ++++ ChangeLog.pre-2-4 | 6 ++++ ChangeLog.pre-2-6 | 6 ++++ ChangeLog.pre-2-8 | 6 ++++ gtk/gtkarrow.c | 74 ++++++++++++++++++++++++++++++++++++++++++++-- gtk/gtkarrow.h | 10 ++++--- 9 files changed, 119 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a6ceff3015..00a9e911f3 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Mon Jun 29 13:39:45 1998 Tim Janik + + * gtk/gtkarrow.h: GtkType and macro fixups. + * gtk/gtkarrow.c: widget argument implementation: "GtkArrow::arrow_type", + "GtkArrow::shadow_type". + Sun Jun 28 11:39:17 1998 Tim Janik * gtk/gtkalignment.h: diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index 1e07ac270a..54b543bc0b 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -21,17 +21,29 @@ #define MIN_ARROW_SIZE 11 +enum { + ARG_0, + ARG_ARROW_TYPE, + ARG_SHADOW_TYPE +}; + static void gtk_arrow_class_init (GtkArrowClass *klass); static void gtk_arrow_init (GtkArrow *arrow); static gint gtk_arrow_expose (GtkWidget *widget, GdkEventExpose *event); +static void gtk_arrow_set_arg (GtkObject *object, + GtkArg *arg, + guint arg_id); +static void gtk_arrow_get_arg (GtkObject *object, + GtkArg *arg, + guint arg_id); -guint +GtkType gtk_arrow_get_type (void) { - static guint arrow_type = 0; + static GtkType arrow_type = 0; if (!arrow_type) { @@ -47,7 +59,7 @@ gtk_arrow_get_type (void) (GtkClassInitFunc) NULL, }; - arrow_type = gtk_type_unique (gtk_misc_get_type (), &arrow_info); + arrow_type = gtk_type_unique (GTK_TYPE_MISC, &arrow_info); } return arrow_type; @@ -56,13 +68,69 @@ gtk_arrow_get_type (void) static void gtk_arrow_class_init (GtkArrowClass *class) { + GtkObjectClass *object_class; GtkWidgetClass *widget_class; + object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; + gtk_object_add_arg_type ("GtkArrow::arrow_type", GTK_TYPE_ARROW_TYPE, GTK_ARG_READWRITE, ARG_ARROW_TYPE); + gtk_object_add_arg_type ("GtkArrow::shadow_type", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW_TYPE); + + object_class->set_arg = gtk_arrow_set_arg; + object_class->get_arg = gtk_arrow_get_arg; + widget_class->expose_event = gtk_arrow_expose; } +static void +gtk_arrow_set_arg (GtkObject *object, + GtkArg *arg, + guint arg_id) +{ + GtkArrow *arrow; + + arrow = GTK_ARROW (object); + + switch (arg_id) + { + case ARG_ARROW_TYPE: + gtk_arrow_set (arrow, + GTK_VALUE_ENUM (*arg), + arrow->shadow_type); + break; + case ARG_SHADOW_TYPE: + gtk_arrow_set (arrow, + arrow->arrow_type, + GTK_VALUE_ENUM (*arg)); + break; + default: + break; + } +} + +static void +gtk_arrow_get_arg (GtkObject *object, + GtkArg *arg, + guint arg_id) +{ + GtkArrow *arrow; + + arrow = GTK_ARROW (object); + switch (arg_id) + { + case ARG_ARROW_TYPE: + GTK_VALUE_ENUM (*arg) = arrow->arrow_type; + break; + case ARG_SHADOW_TYPE: + GTK_VALUE_ENUM (*arg) = arrow->shadow_type; + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + static void gtk_arrow_init (GtkArrow *arrow) { diff --git a/gtk/gtkarrow.h b/gtk/gtkarrow.h index e0ce41ad70..bc495cc976 100644 --- a/gtk/gtkarrow.h +++ b/gtk/gtkarrow.h @@ -29,9 +29,11 @@ extern "C" { #endif /* __cplusplus */ -#define GTK_ARROW(obj) GTK_CHECK_CAST (obj, gtk_arrow_get_type (), GtkArrow) -#define GTK_ARROW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_arrow_get_type (), GtkArrowClass) -#define GTK_IS_ARROW(obj) GTK_CHECK_TYPE (obj, gtk_arrow_get_type ()) +#define GTK_TYPE_ARROW (gtk_arrow_get_type ()) +#define GTK_ARROW(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ARROW, GtkArrow)) +#define GTK_ARROW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ARROW, GtkArrowClass)) +#define GTK_IS_ARROW(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ARROW)) +#define GTK_IS_ARROW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ARROW)) typedef struct _GtkArrow GtkArrow; @@ -51,7 +53,7 @@ struct _GtkArrowClass }; -guint gtk_arrow_get_type (void); +GtkType gtk_arrow_get_type (void); GtkWidget* gtk_arrow_new (GtkArrowType arrow_type, GtkShadowType shadow_type); void gtk_arrow_set (GtkArrow *arrow,