diff options
author | Eugen Neufeld | 2016-02-11 11:09:32 +0000 |
---|---|---|
committer | Eric Williams | 2016-07-18 19:05:49 +0000 |
commit | 0fe0e41c717b6a94e20a817c11162c04acaa2ca8 (patch) | |
tree | 4b734d86f0b977acaab816ef72010bfe2aa9c79e | |
parent | 444d5bbc2b44b619733a9fa9f5a9cbf7fd53aeea (diff) | |
download | eclipse.platform.swt-0fe0e41c717b6a94e20a817c11162c04acaa2ca8.tar.gz eclipse.platform.swt-0fe0e41c717b6a94e20a817c11162c04acaa2ca8.tar.xz eclipse.platform.swt-0fe0e41c717b6a94e20a817c11162c04acaa2ca8.zip |
Bug 443185 - view's toolbar does not cope well with small views
added checks whether the controls size is bigger then the available size
and if so recalculate the size using the corresponding width/height as a
hint
Change-Id: Ibe36817a3834b936577d9be38072afa6f2fa7c4a
Signed-off-by: Eugen Neufeld <eneufeld@eclipsesource.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java index 06427532d6..97c2165c6d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java @@ -261,6 +261,9 @@ Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int wid for (int i=0; i<count; i++) { Control child = children [i]; Point size = computeSize (child, flushCache); + if (width > SWT.DEFAULT && width < size.x && wrap) { + size = child.computeSize (width, child.getLayoutData() == null ? SWT.DEFAULT : ((RowData) child.getLayoutData()).height, flushCache); + } childWidth = Math.max (childWidth, size.x); childHeight = Math.max (childHeight, size.y); } @@ -284,6 +287,9 @@ Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int wid Control child = children [i]; if (pack) { Point size = computeSize (child, flushCache); + if (width > SWT.DEFAULT && width < size.x && wrap) { + size = child.computeSize (width, child.getLayoutData() == null ? SWT.DEFAULT : ((RowData) child.getLayoutData()).height, flushCache); + } childWidth = size.x; childHeight = size.y; } @@ -380,6 +386,8 @@ Point layoutVertical (Composite composite, boolean move, boolean wrap, int heigh for (int i=0; i<count; i++) { Control child = children [i]; Point size = computeSize (child, flushCache); + if(height>SWT.DEFAULT && height<size.y && wrap) + size=child.computeSize(child.getLayoutData()==null?SWT.DEFAULT:((RowData)child.getLayoutData()).width,height,flushCache); childWidth = Math.max (childWidth, size.x); childHeight = Math.max (childHeight, size.y); } @@ -403,6 +411,8 @@ Point layoutVertical (Composite composite, boolean move, boolean wrap, int heigh Control child = children [i]; if (pack) { Point size = computeSize (child, flushCache); + if(height>SWT.DEFAULT && height<size.y && wrap) + size=child.computeSize(child.getLayoutData()==null?SWT.DEFAULT:((RowData)child.getLayoutData()).width,height,flushCache); childWidth = size.x; childHeight = size.y; } |