diff options
author | Michael Natterer <mitch@imendio.com> | 2006-03-03 12:38:42 +0000 |
---|---|---|
committer | Michael Natterer <mitch@src.gnome.org> | 2006-03-03 12:38:42 +0000 |
commit | 43cb6010cc65870b2a715fc0fe0baee4dce69b5c (patch) | |
tree | fb869be391118b9526b0187f1768e40a8e6f19e7 /gtk/gtkhseparator.c | |
parent | d168e186aabed146af57fcb6db94880ce0275be2 (diff) | |
download | gdk-pixbuf-43cb6010cc65870b2a715fc0fe0baee4dce69b5c.tar.gz |
Applied modified patch from maemo-gtk which makes separators more
2006-03-03 Michael Natterer <mitch@imendio.com>
Applied modified patch from maemo-gtk which makes separators more
themeable. Fixes bug #332022.
* gtk/gtkwidget.c: added style properties "wide-separators",
"separator-width" and "separator-height".
* gtk/gtkhseparator.c
* gtk/gtkvseparator.c
* gtk/gtkmenuitem.c
* gtk/gtktoolbar.c: honor the new settings and paint separators
using gtk_paint_box() if wide-separators is true.
Diffstat (limited to 'gtk/gtkhseparator.c')
-rw-r--r-- | gtk/gtkhseparator.c | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c index 80b6a991f..cc6c4f8a1 100644 --- a/gtk/gtkhseparator.c +++ b/gtk/gtkhseparator.c @@ -30,10 +30,12 @@ #include "gtkalias.h" -static void gtk_hseparator_class_init (GtkHSeparatorClass *klass); -static void gtk_hseparator_init (GtkHSeparator *hseparator); -static gint gtk_hseparator_expose (GtkWidget *widget, - GdkEventExpose *event); +static void gtk_hseparator_class_init (GtkHSeparatorClass *klass); +static void gtk_hseparator_init (GtkHSeparator *hseparator); +static void gtk_hseparator_size_request (GtkWidget *widget, + GtkRequisition *requisition); +static gint gtk_hseparator_expose (GtkWidget *widget, + GdkEventExpose *event); GType @@ -71,6 +73,7 @@ gtk_hseparator_class_init (GtkHSeparatorClass *class) widget_class = (GtkWidgetClass*) class; + widget_class->size_request = gtk_hseparator_size_request; widget_class->expose_event = gtk_hseparator_expose; } @@ -87,18 +90,56 @@ gtk_hseparator_new (void) return g_object_new (GTK_TYPE_HSEPARATOR, NULL); } +static void +gtk_hseparator_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + gboolean wide_separators; + gint separator_height; + + gtk_widget_style_get (widget, + "wide-separators", &wide_separators, + "separator-height", &separator_height, + NULL); + + if (wide_separators) + requisition->height = separator_height; + else + requisition->height = widget->style->ythickness; +} static gint gtk_hseparator_expose (GtkWidget *widget, GdkEventExpose *event) { if (GTK_WIDGET_DRAWABLE (widget)) - gtk_paint_hline (widget->style, widget->window, GTK_WIDGET_STATE (widget), - &event->area, widget, "hseparator", - widget->allocation.x, - widget->allocation.x + widget->allocation.width - 1, - widget->allocation.y + (widget->allocation.height - - widget->style->ythickness) / 2); + { + gboolean wide_separators; + gint separator_height; + + gtk_widget_style_get (widget, + "wide-separators", &wide_separators, + "separator-height", &separator_height, + NULL); + + if (wide_separators) + gtk_paint_box (widget->style, widget->window, + GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT, + &event->area, widget, "hseparator", + widget->allocation.x, + widget->allocation.y + (widget->allocation.height - + separator_height) / 2, + widget->allocation.width, + separator_height); + else + gtk_paint_hline (widget->style, widget->window, + GTK_WIDGET_STATE (widget), + &event->area, widget, "hseparator", + widget->allocation.x, + widget->allocation.x + widget->allocation.width - 1, + widget->allocation.y + (widget->allocation.height - + widget->style->ythickness) / 2); + } return FALSE; } |