diff --git a/ChangeLog b/ChangeLog index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 923e4d2cd9..17d009b4cd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Sun Apr 5 08:03:01 1998 Tim Janik + + * 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. + Sat Apr 4 12:23:23 BST 1998 Tony Gale * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 934c8a3f92..7c1c63bdc7 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -434,12 +434,13 @@ gtk_entry_realize (GtkWidget *widget) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); entry = GTK_ENTRY (widget); editable = GTK_EDITABLE (widget); - + attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; + attributes.y = widget->allocation.y + (widget->allocation.height - + widget->requisition.height) / 2; attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + attributes.height = widget->requisition.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); 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, diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index f26fc22cc0..733e96a3ed 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -222,8 +222,8 @@ gtk_spin_button_map (GtkWidget *widget) if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) { - gdk_window_show (GTK_SPIN_BUTTON (widget)->panel); GTK_WIDGET_CLASS (parent_class)->map (widget); + gdk_window_show (GTK_SPIN_BUTTON (widget)->panel); } } @@ -246,14 +246,18 @@ gtk_spin_button_realize (GtkWidget *widget) GtkSpinButton *spin; GdkWindowAttr attributes; gint attributes_mask; + guint real_width; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - + spin = GTK_SPIN_BUTTON (widget); + real_width = widget->allocation.width; + widget->allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness; GTK_WIDGET_CLASS (parent_class)->realize (widget); - + widget->allocation.width = real_width; + attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); @@ -265,19 +269,18 @@ gtk_spin_button_realize (GtkWidget *widget) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - attributes.x = widget->allocation.x + widget->allocation.width - - ARROW_SIZE - 2 * widget->style->klass->xthickness; - attributes.y = widget->allocation.y; - - attributes.width = ARROW_SIZE; - attributes.height = widget->allocation.height; + attributes.x = (widget->allocation.x + widget->allocation.width - ARROW_SIZE - + 2 * widget->style->klass->xthickness); + attributes.y = widget->allocation.y + (widget->allocation.height - + widget->requisition.height) / 2; + attributes.width = ARROW_SIZE + 2 * widget->style->klass->xthickness; + attributes.height = widget->requisition.height; spin->panel = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); + gdk_window_set_user_data (spin->panel, widget); gtk_style_set_background (widget->style, spin->panel, GTK_STATE_NORMAL); - - gdk_window_set_user_data (spin->panel, widget); } static void @@ -325,9 +328,7 @@ gtk_spin_button_size_allocate (GtkWidget *widget, g_return_if_fail (allocation != NULL); child_allocation = *allocation; - child_allocation.width = allocation->width - ARROW_SIZE - - 2 * widget->style->klass->xthickness; - child_allocation.height = allocation->height; + child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness; GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation); @@ -335,13 +336,11 @@ gtk_spin_button_size_allocate (GtkWidget *widget, if (GTK_WIDGET_REALIZED (widget)) { - child_allocation.width = ARROW_SIZE - + 2 * widget->style->klass->xthickness; + child_allocation.width = ARROW_SIZE + 2 * widget->style->klass->xthickness; child_allocation.height = widget->requisition.height; child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE - 2 * widget->style->klass->xthickness); - child_allocation.y = allocation->y + (allocation->height - - widget->requisition.height) / 2; + child_allocation.y = allocation->y + (allocation->height - widget->requisition.height) / 2; gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel, child_allocation.x,