diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java index 0aaa92847f3..9ae628e05b6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java @@ -115,10 +115,14 @@ public class CTabFolder extends Composite { /* sizing, positioning */ boolean onBottom = false; + boolean onSide = false; + boolean onRight = false; boolean single = false; boolean simple = true; int fixedTabHeight = SWT.DEFAULT; + int fixedTabWidth = SWT.DEFAULT; int tabHeight; + int tabWidth; int minChars = 20; boolean borderVisible = false; @@ -238,6 +242,7 @@ public class CTabFolder extends Composite { final static int REDRAW = 1 << 1; final static int REDRAW_TABS = 1 << 2; final static int UPDATE_TAB_HEIGHT = 1 << 3; + final static int UPDATE_TAB_WIDTH = 1 << 4; Runnable updateRun; // when disposing CTabFolder, don't try to layout the items or @@ -301,7 +306,19 @@ void init(int style) { super.setLayout(new CTabFolderLayout()); int style2 = super.getStyle(); oldFont = getFont(); - onBottom = (style2 & SWT.BOTTOM) != 0; + switch (style2 & (SWT.TOP | SWT.BOTTOM | SWT.LEFT | SWT.RIGHT)) { + case SWT.BOTTOM: + onBottom = true; + break; + case SWT.LEFT: + onSide = true; + break; + case SWT.RIGHT: + onSide = true; + onRight = true; + break; + // SWT.TOP is the default + } showClose = (style2 & SWT.CLOSE) != 0; // showMin = (style2 & SWT.MIN) != 0; - conflicts with SWT.TOP // showMax = (style2 & SWT.MAX) != 0; - conflicts with SWT.BOTTOM @@ -394,11 +411,19 @@ void onActivate(Event event) { } static int checkStyle (Composite parent, int style) { - int mask = SWT.CLOSE | SWT.TOP | SWT.BOTTOM | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.SINGLE | SWT.MULTI; + int mask = SWT.CLOSE | SWT.TOP | SWT.BOTTOM | SWT.LEFT | SWT.RIGHT | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.SINGLE | SWT.MULTI; style = style & mask; - // TOP and BOTTOM are mutually exclusive. + // TOP, BOTTOM, LEFT and RIGHT are mutually exclusive. // TOP is the default - if ((style & SWT.TOP) != 0) style = style & ~SWT.BOTTOM; + if ((style & SWT.TOP) != 0) { + style = style & ~SWT.BOTTOM & ~SWT.LEFT & ~SWT.RIGHT; + } + else if ((style & SWT.BOTTOM) != 0) { + style = style & ~SWT.LEFT & ~SWT.RIGHT; + } + else if ((style & SWT.LEFT) != 0) { + style = style & ~SWT.RIGHT; + } // SINGLE and MULTI are mutually exclusive. // MULTI is the default if ((style & SWT.MULTI) != 0) style = style & ~SWT.SINGLE; @@ -1295,6 +1320,22 @@ public int getTabHeight(){ if (fixedTabHeight != SWT.DEFAULT) return fixedTabHeight; return tabHeight - 1; // -1 for line drawn across top of tab //TODO: replace w/ computeTrim of tab area? } +/** + * Returns the width of the tab + * + * @return the width of the tab + * + * @exception SWTException