summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
diff options
context:
space:
mode:
authorSteve Northover <steve>2003-01-07 00:29:29 +0000
committerSteve Northover <steve>2003-01-07 00:29:29 +0000
commit7dd36e84b92b9911644cc658fd7cda753ee5809e (patch)
treea78ba51133e1ef76f6b7a5d6b31d1ed1baf5612f /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
parent4b0c1648e362e2696ffd8c335358b9980a84206e (diff)
downloadeclipse.platform.swt-7dd36e84b92b9911644cc658fd7cda753ee5809e.tar.gz
eclipse.platform.swt-7dd36e84b92b9911644cc658fd7cda753ee5809e.tar.xz
eclipse.platform.swt-7dd36e84b92b9911644cc658fd7cda753ee5809e.zip
28991
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java
index 4f56a9aeda..f8c53bde76 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java
@@ -173,6 +173,27 @@ private static int checkStyle (int style) {
return style & mask;
}
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ /*
+ * When a composite does layout without using a layout
+ * manager, it must take into account the preferred size
+ * of it's children when computing it's preferred size in
+ * the same way that a layout manager would. In particular,
+ * when a scrolled composite hides the scroll bars and
+ * places a child to fill the client area, then repeated
+ * calls to compute the preferred size of the scrolled
+ * composite should not keep adding in the space used by
+ * the scroll bars.
+ */
+ if (content == null) {
+ return super.computeSize (wHint, hHint, changed);
+ }
+ Point size = content.computeSize (wHint, hHint, changed);
+ Rectangle trim = computeTrim (0, 0, size.x, size.y);
+ return new Point (trim.width, trim.height);
+}
+
/**
* Returns the Always Show Scrollbars flag. True if the scrollbars are
* always shown even if they are not required. False if the scrollbars are only