1 package net.mograsim.plugin.util;
3 import org.eclipse.swt.SWT;
4 import org.eclipse.swt.graphics.Point;
5 import org.eclipse.swt.graphics.Rectangle;
6 import org.eclipse.swt.widgets.Composite;
7 import org.eclipse.swt.widgets.Control;
8 import org.eclipse.swt.widgets.Layout;
10 public class OverlappingFillLayout extends Layout
13 protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
15 Point size = new Point(wHint == SWT.DEFAULT ? 0 : wHint, hHint == SWT.DEFAULT ? 0 : hHint);
17 Control[] children = composite.getChildren();
18 for (Control child : children)
20 Point childSize = child.computeSize(wHint, hHint, flushCache);
21 size.x = Math.max(size.x, childSize.x);
22 size.y = Math.max(size.y, childSize.y);
29 protected void layout(Composite composite, boolean flushCache)
31 Rectangle bounds = composite.getClientArea();
33 Control[] children = composite.getChildren();
34 for (Control child : children)
35 child.setBounds(bounds);