summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraspektor <aspektor@redhat.com>2013-03-13 09:14:17 -0400
committeraspektor <aspektor@redhat.com>2013-03-13 09:30:48 -0400
commit3aabfde24327c046237c0af9502b2d8177a046e4 (patch)
treeb8771664a3269954bb0e412511ace95ac266ccc7
parentff54d13b51a8adb13dd3c83857ae74c1b27d17b5 (diff)
downloadeclipse.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.c51
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) {