Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe2013-05-08 22:00:09 +0000
committerBogdan Gheorghe2013-05-08 22:01:25 +0000
commitc660730bd911adbdda866a00c1ace2ec715d90d6 (patch)
tree5e149e416e7eb82ff4262a5509e74b76ee9a41dc
parent13013d1f122aaa548cb8d013ae9e3b9a7015bfef (diff)
downloadeclipse.platform.swt-c660730bd911adbdda866a00c1ace2ec715d90d6.tar.gz
eclipse.platform.swt-c660730bd911adbdda866a00c1ace2ec715d90d6.tar.xz
eclipse.platform.swt-c660730bd911adbdda866a00c1ace2ec715d90d6.zip
Bug 396780 - CTabRendering doesn't draw bottom tabs correctlyv4329aI20130509-2000I20130508-2000
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java28
1 files changed, 20 insertions, 8 deletions
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 5b7012830d..bec1880664 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
@@ -167,10 +167,10 @@ public class CTabFolder extends Composite {
Menu showMenu;
ToolBar chevronTb;
ToolItem chevronItem;
- Image chevronImage;
int chevronCount;
boolean chevronVisible = true;
+ Image chevronImage;
Control topRight;
int topRightAlignment = SWT.RIGHT;
boolean ignoreResize;
@@ -562,7 +562,7 @@ Rectangle[] computeControlBounds (Point size, boolean[][] position) {
int bodyLeft = -bodyTrim.x;
int bodyWidth = size.x - bodyLeft - bodyRight;
x = size.x - bodyRight;
- int y = -bodyTrim.y;
+ int y = onBottom ? this.getSize().y - getTabHeight() + 2*bodyTrim.y : -bodyTrim.y;
availableWidth = bodyWidth;
int maxHeight = 0;
for (int i = 0; i < controls.length; i++) {
@@ -571,7 +571,7 @@ Rectangle[] computeControlBounds (Point size, boolean[][] position) {
if (availableWidth > ctrlSize.x) {
x -= ctrlSize.x;
rects[i].width = ctrlSize.x;
- rects[i].y = y;
+ rects[i].y = onBottom ? y - ctrlSize.y : y;
rects[i].height = ctrlSize.y;
rects[i].x = x;
availableWidth -= ctrlSize.x;
@@ -587,7 +587,7 @@ Rectangle[] computeControlBounds (Point size, boolean[][] position) {
} else {
ctrlSize = controls[i].isDisposed() ? new Point(0,0) : controls[i].computeSize(bodyWidth, SWT.DEFAULT);
rects[i].width = bodyWidth;
- rects[i].y = y;
+ rects[i].y = onBottom ? y - ctrlSize.y : y;
rects[i].height = ctrlSize.y;
rects[i].x = size.x - ctrlSize.x - bodyRight;
y += ctrlSize.y;
@@ -3331,7 +3331,7 @@ public void setSingle(boolean single) {
int getControlY(Point size, Rectangle[] rects, int borderBottom, int borderTop, int i) {
int center = fixedTabHeight != SWT.DEFAULT ? 0 : (tabHeight - rects[i].height)/2;
- return onBottom ? size.y - 1 - borderBottom - tabHeight + center : 1 + borderTop + center;
+ return onBottom ? size.y - borderBottom - tabHeight + center : 1 + borderTop + center;
}
/**
@@ -3726,14 +3726,26 @@ void updateBkImages() {
if (control instanceof Composite) ((Composite) control).setBackgroundMode(SWT.INHERIT_DEFAULT);
Rectangle bounds = control.getBounds();
int tabHeight = getTabHeight();
- boolean wrapped = onBottom ? bounds.y > this.getSize().y - tabHeight : bounds.y > tabHeight;
+ int height = this.getSize().y;
+ boolean wrapped = onBottom ? bounds.y + bounds.height < height - tabHeight : bounds.y > tabHeight;
if (wrapped || gradientColors == null) {
control.setBackgroundImage(null);
control.setBackground(getBackground());
} else {
bounds.width = 10;
- bounds.y = -bounds.y;
- bounds.height -= 2*bounds.y - 1;
+ if (!onBottom) {
+ bounds.y = -bounds.y;
+ bounds.height -= 2*bounds.y - 1;
+ } else {
+ Rectangle trim = renderer.computeTrim(CTabFolderRenderer.PART_BORDER, SWT.NONE, 0, 0, 0, 0);
+ int borderRight = trim.width + trim.x;
+ int borderLeft = -trim.x;
+ int borderBottom = trim.height + trim.y;
+ int borderTop = -trim.y;
+ int origY = bounds.y + bounds.height;
+ bounds.height += height - (bounds.y + bounds.height);
+ bounds.y = -1;
+ }
bounds.x = 0;
if (controlBkImages[i] != null) controlBkImages[i].dispose();
controlBkImages[i] = new Image(control.getDisplay(), bounds);

Back to the top