### Eclipse Workspace Patch 1.0 #P org.eclipse.swt Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java,v retrieving revision 1.105 diff -u -r1.105 CTabItem.java --- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 5 Jul 2007 18:27:13 -0000 1.105 +++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 20 Aug 2007 09:53:10 -0000 @@ -11,9 +11,21 @@ package org.eclipse.swt.custom; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Pattern; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.Widget; /** * Instances of this class represent a selectable user interface object @@ -402,12 +414,28 @@ shortenedText = shortenText(gc, getText(), textWidth); shortenedTextWidth = textWidth; } - Point extent = gc.textExtent(shortenedText, FLAGS); + int fadeChars= shortenedText.length() == getText().length() + ? 0 + : Math.min(4, shortenedText.length()); + String blackText= shortenedText.substring(0, shortenedText.length() - fadeChars); + Point extent = gc.textExtent(blackText, FLAGS); int textY = y + (height - extent.y) / 2; textY += parent.onBottom ? -1 : 1; gc.setForeground(parent.selectionForeground); - gc.drawText(shortenedText, xDraw, textY, FLAGS); + gc.drawText(blackText, xDraw, textY, FLAGS); + if (fadeChars > 0) { + String fadeText= getText().substring(blackText.length(), blackText.length() + fadeChars); + int fadeTextWidth= gc.textExtent(fadeText, FLAGS).x; + Pattern pattern= new Pattern(gc.getDevice(), + xDraw + extent.x, 0, xDraw + extent.x + fadeTextWidth, 0, + parent.selectionForeground, 255, parent.selectionBackground, 128); + gc.setForegroundPattern(pattern); + gc.drawText(fadeText, + xDraw + extent.x, textY, FLAGS); + gc.setForegroundPattern(null); + pattern.dispose(); + } gc.setFont(gcFont); // draw a Focus rectangle