summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem2.java23
2 files changed, 27 insertions, 18 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java
index 3f00a1e5d2..143d87ad48 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java
@@ -183,6 +183,7 @@ public class CTabFolder2 extends Composite {
static final int FOREGROUND = SWT.COLOR_TITLE_INACTIVE_FOREGROUND;
static final int BACKGROUND = SWT.COLOR_TITLE_INACTIVE_BACKGROUND;
+ static final int NONE = 0;
static final int NORMAL = 1;
static final int HOT = 2;
static final int SELECTED = 3;
@@ -1709,8 +1710,8 @@ void onMouse(Event event) {
if (showClose && !single) {
for (int i=0; i<items.length; i++) {
CTabItem2 item = items[i];
- if (item.closeImageState != NORMAL) {
- item.closeImageState = NORMAL;
+ if (item.closeImageState != NONE) {
+ item.closeImageState = NONE;
redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false);
}
}
@@ -1799,13 +1800,20 @@ void onMouse(Event event) {
close = false;
if (item.getBounds().contains(x, y)) {
close = true;
- if (item.closeImageState != HOT) {
- item.closeImageState = HOT;
- redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false);
+ if (item.closeRect.contains(x, y)) {
+ if (item.closeImageState != HOT) {
+ item.closeImageState = HOT;
+ redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false);
+ }
+ } else {
+ if (item.closeImageState != NORMAL) {
+ item.closeImageState = NORMAL;
+ redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false);
+ }
}
}
- if (item.closeImageState == HOT && !close) {
- item.closeImageState = NORMAL;
+ if (item.closeImageState != NONE && !close) {
+ item.closeImageState = NONE;
redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem2.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem2.java
index e280c83d22..6666ba7100 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem2.java
@@ -32,7 +32,7 @@ public class CTabItem2 extends Item {
String shortenedText;
int shortenedTextWidth;
Rectangle closeRect = new Rectangle(0, 0, 0, 0);
- int closeImageState = CTabFolder2.NORMAL;
+ int closeImageState = CTabFolder2.NONE;
// internal constants
static final int LEFT_MARGIN = 6;
@@ -150,15 +150,10 @@ void drawClose(GC gc) {
x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9,
x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9,
x,y+7, x+2,y+5, x+2,y+4, x,y+2};
- if (parent.selectedIndex == parent.indexOf(this)) {
- gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.fillPolygon(shape);
- gc.setForeground(CTabFolder2.borderColor1);
- gc.drawPolygon(shape);
- } else {
- gc.setBackground(parent.getBackground());
- gc.fillPolygon(shape);
- }
+ gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
+ gc.fillPolygon(shape);
+ gc.setForeground(CTabFolder2.borderColor1);
+ gc.drawPolygon(shape);
break;
}
case CTabFolder2.HOT: {
@@ -174,7 +169,7 @@ void drawClose(GC gc) {
border.dispose();
break;
}
- case CTabFolder2.SELECTED:
+ case CTabFolder2.SELECTED: {
int[] shape = new int[] {x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1,
x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10,
x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10,
@@ -188,6 +183,12 @@ void drawClose(GC gc) {
gc.drawPolygon(shape);
border.dispose();
break;
+ }
+ case CTabFolder2.NONE: {
+ gc.setBackground(parent.getBackground());
+ gc.fillRectangle(x, y, 10, 10);
+ break;
+ }
}
}
void drawSelected(GC gc ) {