summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2009-03-31 21:13:45 +0000
committerCarolyn MacLeod <carolyn>2009-03-31 21:13:45 +0000
commit83bf79434a40fc13ba09feebfd0beb9c2f12a1e2 (patch)
treeb11d05ec4872331b6245fb42b5aca88ed964c085 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt
parentd8b150f7916e0bed718cb1b6682bc59249791c7a (diff)
downloadeclipse.platform.swt-83bf79434a40fc13ba09feebfd0beb9c2f12a1e2.tar.gz
eclipse.platform.swt-83bf79434a40fc13ba09feebfd0beb9c2f12a1e2.tar.xz
eclipse.platform.swt-83bf79434a40fc13ba09feebfd0beb9c2f12a1e2.zip
185204 - [CTabFolder] CTabItem.drawClose could preserve color
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java8
2 files changed, 13 insertions, 6 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 b26a139106..d4d4e31424 100755
--- 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
@@ -157,6 +157,7 @@ public class CTabFolder extends Composite {
static Color borderColor;
// close, min/max and chevron buttons
+ static Color fillColor;
boolean showClose = false;
boolean showUnselectedClose = true;
@@ -1194,6 +1195,12 @@ public Rectangle getClientArea() {
height -= tabHeight;
return new Rectangle(xClient, yClient, width, height);
}
+Color getFillColor() {
+ if (fillColor == null) {
+ fillColor = new Color(getDisplay(), CTabFolder.CLOSE_FILL);
+ }
+ return fillColor;
+}
/**
* Return the tab that is located at the specified index.
*
@@ -1892,6 +1899,10 @@ void onDispose(Event event) {
items[i].dispose();
}
}
+ if (fillColor != null) {
+ fillColor.dispose();
+ fillColor = null;
+ }
selectionGradientColors = null;
selectionGradientPercents = null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
index 0313d9ad68..4e3fdd727b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
@@ -198,10 +198,8 @@ 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};
- Color fill = new Color(display, CTabFolder.CLOSE_FILL);
- gc.setBackground(fill);
+ gc.setBackground(parent.getFillColor());
gc.fillPolygon(shape);
- fill.dispose();
gc.setForeground(closeBorder);
gc.drawPolygon(shape);
break;
@@ -211,10 +209,8 @@ void drawClose(GC gc) {
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,
x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3};
- Color fill = new Color(display, CTabFolder.CLOSE_FILL);
- gc.setBackground(fill);
+ gc.setBackground(parent.getFillColor());
gc.fillPolygon(shape);
- fill.dispose();
gc.setForeground(closeBorder);
gc.drawPolygon(shape);
break;