Added more Wikipedia configurations
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / util / TabFolderLayout.java
1 /*
2  * (c) Copyright IBM Corp. 2000, 2001.
3  * All Rights Reserved
4  */
5 package net.sourceforge.phpdt.internal.ui.util;
6
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.graphics.Point;
9 import org.eclipse.swt.graphics.Rectangle;
10 import org.eclipse.swt.widgets.Composite;
11 import org.eclipse.swt.widgets.Control;
12 import org.eclipse.swt.widgets.Layout;
13
14 public class TabFolderLayout extends Layout {
15
16         protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
17                 if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
18                         return new Point(wHint, hHint);
19                         
20                 Control [] children = composite.getChildren ();
21                 int count = children.length;
22                 int maxWidth = 0, maxHeight = 0;
23                 for (int i=0; i<count; i++) {
24                         Control child = children [i];
25                         Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
26                         maxWidth = Math.max (maxWidth, pt.x);
27                         maxHeight = Math.max (maxHeight, pt.y);
28                 }
29                 
30                 if (wHint != SWT.DEFAULT)
31                         maxWidth= wHint;
32                 if (hHint != SWT.DEFAULT)
33                         maxHeight= hHint;
34                 
35                 return new Point(maxWidth, maxHeight);  
36                 
37         }
38         
39         protected void layout (Composite composite, boolean flushCache) {
40                 Rectangle rect= composite.getClientArea();
41         
42                 Control[] children = composite.getChildren();
43                 for (int i = 0; i < children.length; i++) {
44                         children[i].setBounds(rect);
45                 }
46         }
47 }