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/gtkvseparator.c | |
parent | d168e186aabed146af57fcb6db94880ce0275be2 (diff) | |
download | gtk+-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/gtkvseparator.c')
-rw-r--r-- | gtk/gtkvseparator.c | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c index bbf517780d..eca00ef48b 100644 --- a/gtk/gtkvseparator.c +++ b/gtk/gtkvseparator.c @@ -30,10 +30,12 @@ #include "gtkalias.h" -static void gtk_vseparator_class_init (GtkVSeparatorClass *klass); -static void gtk_vseparator_init (GtkVSeparator *vseparator); -static gint gtk_vseparator_expose (GtkWidget *widget, - GdkEventExpose *event); +static void gtk_vseparator_class_init (GtkVSeparatorClass *klass); +static void gtk_vseparator_init (GtkVSeparator *vseparator); +static void gtk_vseparator_size_request (GtkWidget *widget, + GtkRequisition *requisition); +static gint gtk_vseparator_expose (GtkWidget *widget, + GdkEventExpose *event); GType @@ -71,6 +73,7 @@ gtk_vseparator_class_init (GtkVSeparatorClass *klass) widget_class = (GtkWidgetClass*) klass; + widget_class->size_request = gtk_vseparator_size_request; widget_class->expose_event = gtk_vseparator_expose; } @@ -87,18 +90,56 @@ gtk_vseparator_new (void) return g_object_new (GTK_TYPE_VSEPARATOR, NULL); } +static void +gtk_vseparator_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + gboolean wide_separators; + gint separator_width; + + gtk_widget_style_get (widget, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + NULL); + + if (wide_separators) + requisition->height = separator_width; + else + requisition->height = widget->style->xthickness; +} static gint gtk_vseparator_expose (GtkWidget *widget, GdkEventExpose *event) { if (GTK_WIDGET_DRAWABLE (widget)) - gtk_paint_vline (widget->style, widget->window, GTK_WIDGET_STATE (widget), - &event->area, widget, "vseparator", - widget->allocation.y, - widget->allocation.y + widget->allocation.height - 1, - widget->allocation.x + (widget->allocation.width - - widget->style->xthickness) / 2); + { + gboolean wide_separators; + gint separator_width; + + gtk_widget_style_get (widget, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + NULL); + + if (wide_separators) + gtk_paint_box (widget->style, widget->window, + GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT, + &event->area, widget, "vseparator", + widget->allocation.x + (widget->allocation.width - + separator_width) / 2, + widget->allocation.y, + separator_width, + widget->allocation.height); + else + gtk_paint_vline (widget->style, widget->window, + GTK_WIDGET_STATE (widget), + &event->area, widget, "vseparator", + widget->allocation.y, + widget->allocation.y + widget->allocation.height - 1, + widget->allocation.x + (widget->allocation.width - + widget->style->xthickness) / 2); + } return FALSE; } |