diff options
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, |