diff options
4 files changed, 19 insertions, 37 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 2c9e554001..2a53132708 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -137,14 +137,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - int width = OS.GTK_WIDGET_WIDTH (fixedHandle); - int height = OS.GTK_WIDGET_HEIGHT (fixedHandle); - OS.gtk_widget_set_size_request (handle, wHint, hHint); - GtkRequisition requisition = new GtkRequisition (); - OS.gtk_widget_size_request (handle, requisition); - OS.gtk_widget_set_size_request (handle, width, height); - width = wHint == SWT.DEFAULT ? requisition.width : wHint; - height = hHint == SWT.DEFAULT ? requisition.height : hHint; + Point size = computeNativeSize (handle, wHint, hHint, changed); if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) { if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) { int /*long*/ [] buffer = new int /*long*/ [1]; @@ -156,11 +149,11 @@ public Point computeSize (int wHint, int hHint, boolean changed) { /* Use the GTK+ default value of 1 for each. */ border.left = border.right = border.top = border.bottom = 1; } - if (wHint != SWT.DEFAULT) width += border.left + border.right; - if (hHint != SWT.DEFAULT) height += border.top + border.bottom; + if (wHint != SWT.DEFAULT) size.x += border.left + border.right; + if (hHint != SWT.DEFAULT) size.y += border.top + border.bottom; } } - return new Point (width, height); + return size; } void createHandle (int index) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 0a51986b93..720a0e429b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -143,7 +143,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { size = new Point (wHint, hHint); } } else { - size = minimumSize (); + size = minimumSize (wHint, hHint, changed); } if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; @@ -662,7 +662,7 @@ void moveBelow (int /*long*/ child, int /*long*/ sibling) { OS.memmove (parentHandle, fixed); } -Point minimumSize () { +Point minimumSize (int wHint, int hHint, boolean changed) { Control [] children = _getChildren (); int width = 0, height = 0; for (int i=0; i<children.length; i++) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index 112094063f..1dfa17875a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -96,19 +96,19 @@ int /*long*/ clientHandle () { return clientHandle; } +public Point computeSize (int wHint, int hHint, boolean changed) { + Point size = super.computeSize(wHint, hHint, changed); + int width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x; + size.x = Math.max (size.x, width); + return size; +} public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget(); int clientX = OS.GTK_WIDGET_X (clientHandle); int clientY = OS.GTK_WIDGET_Y (clientHandle); x -= clientX; y -= clientY; - int oldWidth = OS.GTK_WIDGET_WIDTH (handle); - int oldHeight = OS.GTK_WIDGET_HEIGHT (handle); - OS.gtk_widget_set_size_request (handle, -1, -1); - GtkRequisition requisition = new GtkRequisition (); - OS.gtk_widget_size_request (handle, requisition); - OS.gtk_widget_set_size_request (handle, oldWidth, oldHeight); - width = Math.max (width + clientX + clientX, requisition.width); + width += clientX + clientX; height += clientX + clientY; return new Rectangle (x, y, width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java index 8deb5a75ce..641f6005ed 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java @@ -134,10 +134,11 @@ int /*long*/ clientHandle () { public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); + Point size = super.computeSize (wHint, hHint, changed); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - int width = OS.GTK_WIDGET_WIDTH (fixedHandle); - int height = OS.GTK_WIDGET_HEIGHT (fixedHandle); + int width = OS.GTK_WIDGET_WIDTH (handle); + int height = OS.GTK_WIDGET_HEIGHT (handle); OS.gtk_widget_set_size_request (handle, wHint, hHint); GtkRequisition requisition = new GtkRequisition (); boolean scrollable = OS.gtk_notebook_get_scrollable (handle); @@ -147,21 +148,9 @@ public Point computeSize (int wHint, int hHint, boolean changed) { OS.gtk_widget_set_size_request (handle, width, height); width = wHint == SWT.DEFAULT ? requisition.width : wHint; height = hHint == SWT.DEFAULT ? requisition.height : hHint; - Point size; - if (layout != null) { - size = layout.computeSize (this, wHint, hHint, changed); - } else { - size = minimumSize (wHint, hHint, changed); - } - Rectangle trim = computeTrim (0, 0, size.x, size.y); - size.x = trim.width; size.y = trim.height; - if (size.x == 0) size.x = DEFAULT_WIDTH; - if (size.y == 0) size.y = DEFAULT_HEIGHT; - if (wHint != SWT.DEFAULT) size.x = wHint; - if (hHint != SWT.DEFAULT) size.y = hHint; - width = Math.max (width, size.x); - height = Math.max (height, size.y); - return new Point (width, height); + size.x = Math.max (width, size.x); + size.y = Math.max (height, size.y); + return size; } public Rectangle computeTrim (int x, int y, int width, int height) { |