Re: Labels not vertically centered for check or radio buttons



Manish Singh <yosh gimp org> writes:

> causes the labels associated with the widget to be top aligned with the
> widget, not center aligned. If you look in testgtk, the label text is
> slightly offset upward from being centered with relation to the indicator.
> If you increase the value of the indicator_size property, the behavior is
> more readily apparent.
> 
> I'm not sure what the proper fix is here. Why was this change made
> exactly?

I noticed the problem too. I have this in my tree:

Index: gtkcheckbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcheckbutton.c,v
retrieving revision 1.34
diff -u -r1.34 gtkcheckbutton.c
--- gtkcheckbutton.c	2001/09/19 00:49:51	1.34
+++ gtkcheckbutton.c	2001/09/28 10:36:59
@@ -283,14 +283,14 @@
 	{
  	  gint border_width = GTK_CONTAINER (widget)->border_width;
  
-	  child_allocation.x = (border_width + indicator_size + indicator_spacing * 3 + 1 +
-				widget->allocation.x);
-	  child_allocation.y = border_width + 1 + widget->allocation.y;
 	  child_allocation.width = MIN (GTK_BIN (button)->child->requisition.width,
 					allocation->width -
 					((border_width + 1) * 2 + indicator_size + indicator_spacing * 3));
 	  child_allocation.height = MIN (GTK_BIN (button)->child->requisition.height,
 					 allocation->height - (border_width + 1) * 2);
+	  child_allocation.x = (border_width + indicator_size + indicator_spacing * 3 + 1 +
+				widget->allocation.x);
+	  child_allocation.y = widget->allocation.y + (allocation->height - child_allocation.height) / 2;
 	  
 	  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
 	    child_allocation.x = allocation->x + allocation->width




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]