diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-04-17 11:21:44 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-04-17 11:21:44 +0000 |
| commit | e48a286477d5b8d1d0f9188262e8252d5f77380b (patch) | |
| tree | f255b920768d807c134c973649c50d5788c922f0 /src/widgets/icon.cpp | |
| parent | Fix for 169888 : HIG Style frame (diff) | |
| download | inkscape-e48a286477d5b8d1d0f9188262e8252d5f77380b.tar.gz inkscape-e48a286477d5b8d1d0f9188262e8252d5f77380b.zip | |
Work around for some missing glibmm headers in gtkmm (should be fixed in gtkmm 3.4)
(bzr r11261)
Diffstat (limited to 'src/widgets/icon.cpp')
| -rw-r--r-- | src/widgets/icon.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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); |
