diff options
author | Soeren Sandmann <sandmann@daimi.au.dk> | 2003-07-06 13:14:28 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2003-07-06 13:14:28 +0000 |
commit | c8515b2f8d22c9856fc58f71398eea9e13695fb1 (patch) | |
tree | 717fed71a7377b7729c73a610f1eb16463bd130d /gtk/gtkimagemenuitem.c | |
parent | ba999da1d8528afdb7cf810e626bd1ab3946ff17 (diff) | |
download | gdk-pixbuf-c8515b2f8d22c9856fc58f71398eea9e13695fb1.tar.gz |
add vertical_padding style property.
Sat Jul 5 10:34:00 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkmenu.c: add vertical_padding style property.
* gtk/gtkmenuitem.c: add style properties toggle_spacing,
arrow_spacing and horizontal_padding. Also center separators and
make them a bit taller.
* gtk/*menuitem.c: use new style properties.
* docs/widget_geometry.txt: Add note about GtkMenuItem
* gtk/gtkstyle.c
(gtk_default_draw_vline, gtk_default_draw_hline):
fix +/-1 errors.
(gtk_default_draw_shadow): draw a black border around menus.
* gtk/gtkvseparator, gtk/gtkhseparator.c, gtk/gtkmenuitem.c: fix
calls to gtk_paint_hline() and gtk_paint_vline() (they take x1,
x2 and y1, y2 respectively, not x, width and y, height).
Diffstat (limited to 'gtk/gtkimagemenuitem.c')
-rw-r--r-- | gtk/gtkimagemenuitem.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index f12dd540b..9dd1376d2 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -185,7 +185,15 @@ gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item, GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (menu_item); if (image_menu_item->image) - *requisition = image_menu_item->image->requisition.width; + { + guint toggle_spacing; + + gtk_widget_style_get (GTK_WIDGET (menu_item), + "toggle_spacing", &toggle_spacing, + NULL); + + *requisition = image_menu_item->image->requisition.width + toggle_spacing; + } else *requisition = 0; } @@ -237,6 +245,12 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget, { gint width, height, x, y, offset; GtkAllocation child_allocation; + guint horizontal_padding, toggle_spacing; + + gtk_widget_style_get (widget, + "horizontal_padding", &horizontal_padding, + "toggle_spacing", &toggle_spacing, + NULL); /* Man this is lame hardcoding action, but I can't * come up with a solution that's really better. @@ -245,14 +259,22 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget, width = image_menu_item->image->requisition.width; height = image_menu_item->image->requisition.height; offset = GTK_CONTAINER (image_menu_item)->border_width + - widget->style->xthickness; + widget->style->xthickness; if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - x = offset + (GTK_MENU_ITEM (image_menu_item)->toggle_size - width) / 2; - else - x = widget->allocation.width - - GTK_MENU_ITEM (image_menu_item)->toggle_size - offset + - (GTK_MENU_ITEM (image_menu_item)->toggle_size - width) / 2; + { + x = offset + horizontal_padding + + (GTK_MENU_ITEM (image_menu_item)->toggle_size - + toggle_spacing - width) / 2; + } + else + { + x = widget->allocation.width - offset - horizontal_padding - + GTK_MENU_ITEM (image_menu_item)->toggle_size + toggle_spacing + + (GTK_MENU_ITEM (image_menu_item)->toggle_size - + toggle_spacing - width) / 2; + } + y = (widget->allocation.height - height) / 2; child_allocation.width = width; |