Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2017-02-28 04:17:44 -0500
committerNiraj Modi2017-02-28 04:17:44 -0500
commit11ad2e8b4cb2326eba69ca3af5864937e05f8b49 (patch)
tree420d5ba8b7bf74352186e367387731eadf2ce159
parent5393c1ea4b292672b37610784b6cbedee263edc1 (diff)
downloadeclipse.platform.swt-nmodi/VerticalCTab_v4738.tar.gz
eclipse.platform.swt-nmodi/VerticalCTab_v4738.tar.xz
eclipse.platform.swt-nmodi/VerticalCTab_v4738.zip
Fixed initial size of CTabFolder with vertical styling.nmodi/VerticalCTab_v4738
Change-Id: I3ac8ab8f9e9fdf444e64150c5c38f669cfe1c25d Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderLayout.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderLayout.java
index 5b849f9463..a6e0016254 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderLayout.java
@@ -26,17 +26,19 @@ protected Point computeSize(Composite composite, int wHint, int hHint, boolean f
CTabItem[] items = folder.items;
CTabFolderRenderer renderer = folder.renderer;
// preferred width of tab area to show all tabs
- int tabW = 0;
+ int tabW = 0, tabH = 0;
int selectedIndex = folder.selectedIndex;
if (selectedIndex == -1) selectedIndex = 0;
GC gc = new GC(folder);
for (int i = 0; i < items.length; i++) {
if (folder.single) {
tabW = Math.max(tabW, renderer.computeSize(i, SWT.SELECTED, gc, SWT.DEFAULT, SWT.DEFAULT).x);
+ tabH = Math.max(tabW, renderer.computeSize(i, SWT.SELECTED, gc, SWT.DEFAULT, SWT.DEFAULT).y);
} else {
int state = 0;
if (i == selectedIndex) state |= SWT.SELECTED;
tabW += renderer.computeSize(i, state, gc, SWT.DEFAULT, SWT.DEFAULT).x;
+ tabH += renderer.computeSize(i, state, gc, SWT.DEFAULT, SWT.DEFAULT).y;
}
}
@@ -91,9 +93,17 @@ protected Point computeSize(Composite composite, int wHint, int hHint, boolean f
controlH = Math.max (controlH, size.y);
}
}
-
int minWidth = Math.max(tabW, controlW + folder.marginWidth);
- int minHeight = (folder.minimized) ? 0 : controlH + wrapHeight;
+ int minHeight = 0;
+ switch (folder.tabPosition) {
+ case CTabFolder.LEFT:
+ case CTabFolder.RIGHT:
+ minHeight = (folder.minimized) ? 0 : Math.max(tabH, controlH + wrapHeight);
+ break;
+ case CTabFolder.BOTTOM:
+ default:
+ minHeight = (folder.minimized) ? 0 : controlH + wrapHeight;
+ }
if (minWidth == 0) minWidth = CTabFolder.DEFAULT_WIDTH;
if (minHeight == 0) minHeight = CTabFolder.DEFAULT_HEIGHT;

Back to the top