|
14 | 14 | *******************************************************************************/ |
15 | 15 | package org.eclipse.swt.custom; |
16 | 16 |
|
| 17 | +import java.util.*; |
| 18 | + |
17 | 19 | import org.eclipse.swt.*; |
18 | 20 | import org.eclipse.swt.graphics.*; |
19 | 21 | import org.eclipse.swt.widgets.*; |
@@ -1380,10 +1382,31 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) { |
1380 | 1382 |
|
1381 | 1383 | // draw highlight marker of selected tab |
1382 | 1384 | if (parent.selectionHighlightBarThickness > 0 && parent.simple) { |
1383 | | - Color previousColor = gc.getBackground(); |
1384 | | - gc.setBackground(item.getDisplay().getSystemColor(parent.shouldHighlight() ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND)); |
1385 | | - gc.fillRectangle(x + 1 /* outline */, parent.onBottom ? y + height - 1 - parent.selectionHighlightBarThickness : y + 1, width - 2 /*outline*/, parent.selectionHighlightBarThickness); |
1386 | | - gc.setBackground(previousColor); |
| 1385 | + int thickness = parent.selectionHighlightBarThickness; |
| 1386 | + boolean onBottom = parent.onBottom; |
| 1387 | + boolean highlight = parent.shouldHighlight(); |
| 1388 | + |
| 1389 | + Color oldBackground = gc.getBackground(); |
| 1390 | + Color highlightColor = item.getDisplay().getSystemColor( |
| 1391 | + highlight ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND |
| 1392 | + ); |
| 1393 | + gc.setBackground(highlightColor); |
| 1394 | + |
| 1395 | + int bottomY = y + height - 1; |
| 1396 | + int highlightY = onBottom ? bottomY - thickness : thickness; |
| 1397 | + |
| 1398 | + int[] shape2 = Arrays.copyOf(shape, shape.length); |
| 1399 | + // Update Y coordinates in shape to apply highlight thickness |
| 1400 | + shape2[1] = shape2[3] = shape2[shape2.length - 1] = shape2[shape2.length - 3] = highlightY; |
| 1401 | + |
| 1402 | + xx = x; |
| 1403 | + yy = onBottom ? bottomY - thickness - 1 : y; |
| 1404 | + ww = width; |
| 1405 | + hh = height; |
| 1406 | + |
| 1407 | + drawBackground(gc, shape2, xx, yy, ww, hh, highlightColor, null, null, null, false); |
| 1408 | + |
| 1409 | + gc.setBackground(oldBackground); |
1387 | 1410 | } |
1388 | 1411 |
|
1389 | 1412 | // draw outline |
|
0 commit comments