@@ -881,31 +881,29 @@ void drawClose(GC gc, Rectangle closeRect, int closeImageState, boolean showDirt
881
881
if (closeRect .width == 0 || closeRect .height == 0 ) return ;
882
882
883
883
int originalLineWidth = gc .getLineWidth ();
884
- Color originalForeground = gc .getForeground ();
885
884
int state = closeImageState & (SWT .HOT | SWT .SELECTED | SWT .BACKGROUND );
886
885
if (state == SWT .NONE ) {
887
886
if (showDirtyIndicator )
888
- drawDirtyIndicator (gc , closeRect , originalForeground , false );
887
+ drawDirtyIndicator (gc , closeRect , false );
889
888
else
890
889
drawCloseButton (gc , closeRect , false );
891
890
} else if (state == SWT .HOT || state == SWT .SELECTED ) {
892
891
drawCloseButton (gc , closeRect , true );
893
892
} else if (state == SWT .BACKGROUND ) {
894
893
if (showDirtyIndicator )
895
- drawDirtyIndicator (gc , closeRect , originalForeground , false );
894
+ drawDirtyIndicator (gc , closeRect , false );
896
895
else
897
896
drawBackground (gc , closeRect , SWT .BACKGROUND );
898
-
899
897
}
900
898
gc .setLineWidth (originalLineWidth );
901
- gc .setForeground (originalForeground );
902
899
}
903
900
904
- private void drawDirtyIndicator (GC gc , Rectangle closeRect , Color originalForeground , boolean hot ) {
905
- Color originalBackground = gc .getBackground ();
906
- gc .setBackground (originalForeground );
907
- gc .fillOval (closeRect .x + 3 , closeRect .y + 4 , closeRect .width - 6 , closeRect .height - 6 );
908
- gc .setBackground (originalBackground );
901
+ private void drawDirtyIndicator (GC gc , Rectangle closeRect , boolean hot ) {
902
+ String DIRTY_INDICATOR = "●" ;
903
+ Point stringExtent = gc .stringExtent (DIRTY_INDICATOR );
904
+ int x = closeRect .x + (closeRect .width - stringExtent .x ) / 2 ;
905
+ int y = closeRect .y + (closeRect .height - stringExtent .y ) / 2 ;
906
+ gc .drawString (DIRTY_INDICATOR , x , y , true );
909
907
}
910
908
911
909
private void drawCloseBackground (GC gc , Rectangle closeRect , Color backgroundColor ) {
@@ -1477,7 +1475,7 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) {
1477
1475
gc .setBackground (orginalBackground );
1478
1476
}
1479
1477
}
1480
- if (shouldDrawCloseIcon (item )) drawClose (gc , item .closeRect , item .closeImageState , item .showDirty );
1478
+ if (shouldDrawCloseIcon (item )) drawClose (gc , item .closeRect , item .closeImageState , item .showDirty );
1481
1479
}
1482
1480
}
1483
1481
0 commit comments