summaryrefslogtreecommitdiff
path: root/gtk/gtkspinbutton.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-04-05 06:58:29 +0000
committerTim Janik <timj@src.gnome.org>1998-04-05 06:58:29 +0000
commit6e28c40061fc7a11dfaa6062df136f8c3e4e1a5c (patch)
tree5b180bd6e00497ab19eacef6455e51226e8b7ff2 /gtk/gtkspinbutton.c
parent9a5ad5d44e61d74da2f2e87b2f6d0a28e4124ded (diff)
downloadgtk+-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/gtkspinbutton.c')
-rw-r--r--gtk/gtkspinbutton.c35
1 files changed, 17 insertions, 18 deletions
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,