### 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.116 diff -u -r1.116 CTabItem.java --- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 29 May 2009 21:30:22 -0000 1.116 +++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 20 Jun 2009 13:40:23 -0000 @@ -44,6 +44,7 @@ // Appearance Font font; + Color foreground; Image disabledImage; Rectangle closeRect = new Rectangle(0, 0, 0, 0); @@ -663,7 +664,7 @@ Point extent = gc.textExtent(shortenedText, FLAGS); int textY = y + (height - extent.y) / 2; textY += parent.onBottom ? -1 : 1; - gc.setForeground(parent.getForeground()); + gc.setForeground(foreground == null ? parent.getForeground() : foreground); gc.drawText(shortenedText, xDraw, textY, FLAGS); gc.setFont(gcFont); } @@ -735,6 +736,22 @@ return parent.getFont(); } /** + * Returns the foreground color that the receiver will use to draw. + * + * @return the receiver's foreground color + * + * @exception SWTException + * + * @since 3.6 + */ +public Color getForeground () { + checkWidget (); + return foreground; +} +/** * Returns the receiver's parent, which must be a CTabFolder. * * @return the receiver's parent @@ -953,6 +970,37 @@ parent.redrawTabs(); } } +/** + * Sets the receiver's foreground color to the color specified + * by the argument, or to the default system color for the item + * if the argument is null. + * + * @param color the new color (or null) + * + * @exception IllegalArgumentException + * @exception SWTException + * + * @since 3.6 + */ +public void setForeground (Color color){ + checkWidget (); + if (color != null && color.isDisposed ()) { + SWT.error (SWT.ERROR_INVALID_ARGUMENT); + } + Color oldColor = getForeground(); + if (color == null && oldColor == null) return; + if (color != null && color.equals(oldColor)) return; + foreground = color; + if (!parent.updateTabHeight(false)) { + parent.updateItems(); + parent.redrawTabs(); + } +} public void setImage (Image image) { checkWidget(); if (image != null && image.isDisposed ()) {