diff options
author | aspektor <aspektor@redhat.com> | 2013-03-13 09:14:17 -0400 |
---|---|---|
committer | aspektor <aspektor@redhat.com> | 2013-03-13 09:30:48 -0400 |
commit | 3aabfde24327c046237c0af9502b2d8177a046e4 (patch) | |
tree | b8771664a3269954bb0e412511ace95ac266ccc7 | |
parent | ff54d13b51a8adb13dd3c83857ae74c1b27d17b5 (diff) | |
download | eclipse.platform.swt-swt_fixed.tar.gz eclipse.platform.swt-swt_fixed.tar.xz eclipse.platform.swt-swt_fixed.zip |
[GTK+3] Implement SwtFixed preferred height/width methodsswt_fixed
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c index f3e78ab482..713106a2ca 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c @@ -504,13 +504,56 @@ static void swt_fixed_map (GtkWidget *widget) { } static void swt_fixed_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural) { - if (minimum) *minimum = 0; - if (natural) *natural = 0; + if (GTK_CHECK_VERSION(3,0,0)){ + SwtFixed *fixed = SWT_FIXED (widget); + SwtFixedPrivate *priv = fixed->priv; + GList *list; + GtkRequisition min_requisition, nat_requisition; + + list = priv->children; + + while (list) { + SwtFixedChild *child_data = list->data; + GtkWidget *child = child_data->widget; + list = list->next; + + gtk_widget_get_preferred_size (child, &min_requisition, &nat_requisition); + *minimum = child_data->x; + *natural = child_data->x; + *minimum += min_requisition.width; + *natural += nat_requisition.width; + } + }else{ + if (minimum) *minimum = 0; + if (natural) *natural = 0; + } } static void swt_fixed_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) { - if (minimum) *minimum = 0; - if (natural) *natural = 0; + if (GTK_CHECK_VERSION(3,0,0)){ + SwtFixed *fixed = SWT_FIXED (widget); + SwtFixedPrivate *priv = fixed->priv; + GList *list; + GtkRequisition min_requisition, nat_requisition; + + list = priv->children; + + while (list) { + SwtFixedChild *child_data = list->data; + GtkWidget *child = child_data->widget; + list = list->next; + + gtk_widget_get_preferred_size (child, &min_requisition, &nat_requisition); + + *minimum = child_data->y; + *natural = child_data->y; + *minimum += min_requisition.height; + *natural += nat_requisition.height; + } + }else{ + if (minimum) *minimum = 0; + if (natural) *natural = 0; + } } static void swt_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { |