Skip to content

Commit ae55d60

Browse files
committed
Bug 495033 - Using the same color for min / max as for the close icon
Using the same color as the close icon instead of a hard-coded color. Change-Id: I2466333536e6d3052bc4f41e6e5e9e2ca4f6c882 Signed-off-by: Lars Vogel <[email protected]> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184518 Tested-by: Platform Bot <[email protected]>
1 parent fb22c8e commit ae55d60

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class CTabFolderRenderer {
5151
Color selectedOuterColor = null;
5252
Color selectedInnerColor = null;
5353
Color tabAreaColor = null;
54-
Color minMaxBorderColor = null;
5554
/*
5655
* Border color that was used in computing the cached anti-alias Colors.
5756
* We have to recompute the colors if the border color changes
@@ -544,7 +543,6 @@ protected void dispose() {
544543
disposeSelectionHighlightGradientColors();
545544

546545
fillColor = null;
547-
minMaxBorderColor = null;
548546

549547
if (chevronFont != null) {
550548
chevronFont.dispose();
@@ -593,12 +591,6 @@ void disposeSelectionHighlightGradientColors() {
593591
* @since 3.6
594592
*/
595593
protected void draw (int part, int state, Rectangle bounds, GC gc) {
596-
if (minMaxBorderColor == null) {
597-
// this color has to be identical to the colors used in the PNG files of
598-
// the view drop down menu located in
599-
// org.eclipse.e4.ui.workbench.renderers.swt/icons/full/elcl16/view_menu.png
600-
minMaxBorderColor = new Color (105, 105, 105);
601-
}
602594
switch (part) {
603595
case PART_BACKGROUND:
604596
this.drawBackground(gc, bounds, state);
@@ -1096,23 +1088,18 @@ void drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state) {
10961088

10971089
void drawMaximize(GC gc, Rectangle maxRect, int maxImageState) {
10981090
if (maxRect.width == 0 || maxRect.height == 0) return;
1099-
Display display = parent.getDisplay();
11001091
// 5x4 or 7x9
11011092
int x = maxRect.x + (maxRect.width - 10)/2;
11021093
int y = maxRect.y + 3;
11031094

1104-
gc.setForeground(minMaxBorderColor);
1105-
gc.setBackground(display.getSystemColor(BUTTON_FILL));
1095+
gc.setForeground(parent.getForeground());
11061096

11071097
switch (maxImageState & (SWT.HOT | SWT.SELECTED)) {
11081098
case SWT.NONE: {
11091099
if (!parent.getMaximized()) {
1110-
gc.fillRectangle(x, y, 9, 9);
11111100
gc.drawRectangle(x, y, 9, 9);
11121101
gc.drawLine(x, y+2, x+9, y+2);
11131102
} else {
1114-
gc.fillRectangle(x, y+3, 5, 4);
1115-
gc.fillRectangle(x+2, y, 5, 4);
11161103
gc.drawRectangle(x, y+3, 5, 4);
11171104
gc.drawRectangle(x+2, y, 5, 4);
11181105
gc.drawLine(x+2, y+1, x+7, y+1);
@@ -1123,12 +1110,9 @@ void drawMaximize(GC gc, Rectangle maxRect, int maxImageState) {
11231110
case SWT.HOT: {
11241111
drawRoundRectangle(gc, maxRect);
11251112
if (!parent.getMaximized()) {
1126-
gc.fillRectangle(x, y, 9, 9);
11271113
gc.drawRectangle(x, y, 9, 9);
11281114
gc.drawLine(x, y+2, x+9, y+2);
11291115
} else {
1130-
gc.fillRectangle(x, y+3, 5, 4);
1131-
gc.fillRectangle(x+2, y, 5, 4);
11321116
gc.drawRectangle(x, y+3, 5, 4);
11331117
gc.drawRectangle(x+2, y, 5, 4);
11341118
gc.drawLine(x+2, y+1, x+7, y+1);
@@ -1139,12 +1123,9 @@ void drawMaximize(GC gc, Rectangle maxRect, int maxImageState) {
11391123
case SWT.SELECTED: {
11401124
drawRoundRectangle(gc, maxRect);
11411125
if (!parent.getMaximized()) {
1142-
gc.fillRectangle(x+1, y+1, 9, 9);
11431126
gc.drawRectangle(x+1, y+1, 9, 9);
11441127
gc.drawLine(x+1, y+3, x+10, y+3);
11451128
} else {
1146-
gc.fillRectangle(x+1, y+4, 5, 4);
1147-
gc.fillRectangle(x+3, y+1, 5, 4);
11481129
gc.drawRectangle(x+1, y+4, 5, 4);
11491130
gc.drawRectangle(x+3, y+1, 5, 4);
11501131
gc.drawLine(x+3, y+2, x+8, y+2);
@@ -1156,22 +1137,17 @@ void drawMaximize(GC gc, Rectangle maxRect, int maxImageState) {
11561137
}
11571138
void drawMinimize(GC gc, Rectangle minRect, int minImageState) {
11581139
if (minRect.width == 0 || minRect.height == 0) return;
1159-
Display display = parent.getDisplay();
11601140
// 5x4 or 9x3
11611141
int x = minRect.x + (minRect.width - 10)/2;
11621142
int y = minRect.y + 3;
11631143

1164-
gc.setForeground(minMaxBorderColor);
1165-
gc.setBackground(display.getSystemColor(BUTTON_FILL));
1144+
gc.setForeground(parent.getForeground());
11661145

11671146
switch (minImageState & (SWT.HOT | SWT.SELECTED)) {
11681147
case SWT.NONE: {
11691148
if (!parent.getMinimized()) {
1170-
gc.fillRectangle(x, y, 9, 3);
11711149
gc.drawRectangle(x, y, 9, 3);
11721150
} else {
1173-
gc.fillRectangle(x, y+3, 5, 4);
1174-
gc.fillRectangle(x+2, y, 5, 4);
11751151
gc.drawRectangle(x, y+3, 5, 4);
11761152
gc.drawRectangle(x+2, y, 5, 4);
11771153
gc.drawLine(x+3, y+1, x+6, y+1);
@@ -1182,11 +1158,8 @@ void drawMinimize(GC gc, Rectangle minRect, int minImageState) {
11821158
case SWT.HOT: {
11831159
drawRoundRectangle(gc, minRect);
11841160
if (!parent.getMinimized()) {
1185-
gc.fillRectangle(x, y, 9, 3);
11861161
gc.drawRectangle(x, y, 9, 3);
11871162
} else {
1188-
gc.fillRectangle(x, y+3, 5, 4);
1189-
gc.fillRectangle(x+2, y, 5, 4);
11901163
gc.drawRectangle(x, y+3, 5, 4);
11911164
gc.drawRectangle(x+2, y, 5, 4);
11921165
gc.drawLine(x+3, y+1, x+6, y+1);
@@ -1197,11 +1170,8 @@ void drawMinimize(GC gc, Rectangle minRect, int minImageState) {
11971170
case SWT.SELECTED: {
11981171
drawRoundRectangle(gc, minRect);
11991172
if (!parent.getMinimized()) {
1200-
gc.fillRectangle(x+1, y+1, 9, 3);
12011173
gc.drawRectangle(x+1, y+1, 9, 3);
12021174
} else {
1203-
gc.fillRectangle(x+1, y+4, 5, 4);
1204-
gc.fillRectangle(x+3, y+1, 5, 4);
12051175
gc.drawRectangle(x+1, y+4, 5, 4);
12061176
gc.drawRectangle(x+3, y+1, 5, 4);
12071177
gc.drawLine(x+4, y+2, x+7, y+2);

0 commit comments

Comments
 (0)