diff options
author | Tim Janik <timj@gtk.org> | 1998-04-05 06:58:29 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-04-05 06:58:29 +0000 |
commit | 6e28c40061fc7a11dfaa6062df136f8c3e4e1a5c (patch) | |
tree | 5b180bd6e00497ab19eacef6455e51226e8b7ff2 /gtk/gtkmisc.c | |
parent | 9a5ad5d44e61d74da2f2e87b2f6d0a28e4124ded (diff) | |
download | gtk+-6e28c40061fc7a11dfaa6062df136f8c3e4e1a5c.tar.gz |
fixed panel allocation and stacking order, fixed the base class
Sun Apr 5 08:03:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtkspinbutton.c: fixed panel allocation and stacking order,
fixed the base class realization.
* gtk/gtkmisc.c: implemented widget arguments.
* gtk/gtkentry.c: fixes in _realize to behave similar to
_size_allocate.
Diffstat (limited to 'gtk/gtkmisc.c')
-rw-r--r-- | gtk/gtkmisc.c | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c index d044e40c2e..13b5e965a0 100644 --- a/gtk/gtkmisc.c +++ b/gtk/gtkmisc.c @@ -19,9 +19,23 @@ #include "gtkmisc.h" +enum { + ARG_0, + ARG_XALIGN, + ARG_YALIGN, + ARG_XPAD, + ARG_YPAD, +}; + static void gtk_misc_class_init (GtkMiscClass *klass); static void gtk_misc_init (GtkMisc *misc); static void gtk_misc_realize (GtkWidget *widget); +static void gtk_misc_set_arg (GtkMisc *misc, + GtkArg *arg, + guint arg_id); +static void gtk_misc_get_arg (GtkMisc *misc, + GtkArg *arg, + guint arg_id); guint @@ -38,8 +52,8 @@ gtk_misc_get_type () sizeof (GtkMiscClass), (GtkClassInitFunc) gtk_misc_class_init, (GtkObjectInitFunc) gtk_misc_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL, + (GtkArgSetFunc) gtk_misc_set_arg, + (GtkArgGetFunc) gtk_misc_get_arg, }; misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info); @@ -55,6 +69,11 @@ gtk_misc_class_init (GtkMiscClass *class) widget_class = (GtkWidgetClass*) class; + gtk_object_add_arg_type ("GtkMisc::xalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_XALIGN); + gtk_object_add_arg_type ("GtkMisc::yalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_YALIGN); + gtk_object_add_arg_type ("GtkMisc::xpad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_XPAD); + gtk_object_add_arg_type ("GtkMisc::ypad", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_YPAD); + widget_class->realize = gtk_misc_realize; } @@ -69,6 +88,56 @@ gtk_misc_init (GtkMisc *misc) misc->ypad = 0; } +static void +gtk_misc_set_arg (GtkMisc *misc, + GtkArg *arg, + guint arg_id) +{ + switch (arg_id) + { + case ARG_XALIGN: + gtk_misc_set_alignment (misc, GTK_VALUE_DOUBLE (*arg), misc->yalign); + break; + case ARG_YALIGN: + gtk_misc_set_alignment (misc, misc->xalign, GTK_VALUE_DOUBLE (*arg)); + break; + case ARG_XPAD: + gtk_misc_set_alignment (misc, GTK_VALUE_INT (*arg), misc->ypad); + break; + case ARG_YPAD: + gtk_misc_set_alignment (misc, misc->xpad, GTK_VALUE_INT (*arg)); + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + +static void +gtk_misc_get_arg (GtkMisc *misc, + GtkArg *arg, + guint arg_id) +{ + switch (arg_id) + { + case ARG_XALIGN: + GTK_VALUE_DOUBLE (*arg) = misc->xalign; + break; + case ARG_YALIGN: + GTK_VALUE_DOUBLE (*arg) = misc->yalign; + break; + case ARG_XPAD: + GTK_VALUE_INT (*arg) = misc->xpad; + break; + case ARG_YPAD: + GTK_VALUE_INT (*arg) = misc->ypad; + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + void gtk_misc_set_alignment (GtkMisc *misc, gfloat xalign, |