From 0b93b8efc540b8cfc514f6d78c1b1106fec6bbe6 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sun, 22 Mar 2009 20:15:37 +0000 Subject: [PATCH] fix squashed vruler: add requisition methon --- src/widgets/ruler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 7e347acad..c90b55e73 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -375,6 +375,7 @@ static gint sp_vruler_motion_notify (GtkWidget *widget, GdkEventMotion *event); static void sp_vruler_draw_ticks (GtkRuler *ruler); static void sp_vruler_draw_pos (GtkRuler *ruler); +static void sp_vruler_size_request (GtkWidget *widget, GtkRequisition *requisition); static void sp_vruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static GtkWidgetClass *vruler_parent_class; @@ -421,6 +422,7 @@ sp_vruler_class_init (SPVRulerClass *klass) widget_class->motion_notify_event = sp_vruler_motion_notify; widget_class->size_allocate = sp_vruler_size_allocate; + widget_class->size_request = sp_vruler_size_request; ruler_class->draw_ticks = sp_vruler_draw_ticks; ruler_class->draw_pos = sp_vruler_draw_pos; @@ -682,6 +684,13 @@ sp_vruler_draw_pos (GtkRuler *ruler) } } +static void +sp_vruler_size_request (GtkWidget *widget, GtkRequisition *requisition) +{ + requisition->width = widget->style->xthickness * 2 + RULER_WIDTH; +} + + /** * The vruler widget's size_allocate callback. */ @@ -694,7 +703,7 @@ sp_vruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) // First call the default gtk_widget_size_allocate() method (which is being overridden here) if (GTK_WIDGET_CLASS (vruler_parent_class)->size_allocate) (* GTK_WIDGET_CLASS (vruler_parent_class)->size_allocate) (widget, allocation); - + // Now the size of the ruler has changed, the ruler bounds (upper & lower) need to be updated // For this we first need to obtain a pointer to the desktop, by walking up the tree of ancestors GtkWidget *parent = gtk_widget_get_parent(widget); -- 2.30.2