From e48a286477d5b8d1d0f9188262e8252d5f77380b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 17 Apr 2012 12:21:44 +0100 Subject: Work around for some missing glibmm headers in gtkmm (should be fixed in gtkmm 3.4) (bzr r11261) --- src/widgets/icon.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 7f027870d..a58645015 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -61,6 +61,15 @@ struct IconImpl { static void clear(SPIcon *icon); static void sizeRequest(GtkWidget *widget, GtkRequisition *requisition); + + static void getPreferredWidth(GtkWidget *widget, + gint *minimal_width, + gint *natural_width); + + static void getPreferredHeight(GtkWidget *widget, + gint *minimal_height, + gint *natural_height); + static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation); static int expose(GtkWidget *widget, GdkEventExpose *event); @@ -172,7 +181,12 @@ void IconImpl::classInit(SPIconClass *klass) object_class->dispose = IconImpl::dispose; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->get_preferred_width = IconImpl::getPreferredWidth; + widget_class->get_preferred_height = IconImpl::getPreferredHeight; +#else widget_class->size_request = IconImpl::sizeRequest; +#endif widget_class->size_allocate = IconImpl::sizeAllocate; widget_class->expose_event = IconImpl::expose; widget_class->screen_changed = IconImpl::screenChanged; @@ -225,6 +239,20 @@ void IconImpl::sizeRequest(GtkWidget *widget, GtkRequisition *requisition) requisition->height = size; } +void IconImpl::getPreferredWidth(GtkWidget *widget, gint *minimal_width, gint *natural_width) +{ + GtkRequisition requisition; + sizeRequest(widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +void IconImpl::getPreferredHeight(GtkWidget *widget, gint *minimal_height, gint *natural_height) +{ + GtkRequisition requisition; + sizeRequest(widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} + void IconImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { gtk_widget_set_allocation(widget, allocation); -- cgit v1.2.3