View | Details | Raw Unified | Return to bug 280969 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java (-1 / +49 lines)
Lines 44-49 Link Here
44
	
44
	
45
	// Appearance
45
	// Appearance
46
	Font font;
46
	Font font;
47
	Color foreground;
47
	Image disabledImage; 
48
	Image disabledImage; 
48
	
49
	
49
	Rectangle closeRect = new Rectangle(0, 0, 0, 0);
50
	Rectangle closeRect = new Rectangle(0, 0, 0, 0);
Lines 663-669 Link Here
663
		Point extent = gc.textExtent(shortenedText, FLAGS);
664
		Point extent = gc.textExtent(shortenedText, FLAGS);
664
		int textY = y + (height - extent.y) / 2;
665
		int textY = y + (height - extent.y) / 2;
665
		textY += parent.onBottom ? -1 : 1;
666
		textY += parent.onBottom ? -1 : 1;
666
		gc.setForeground(parent.getForeground());
667
		gc.setForeground(foreground == null ? parent.getForeground() : foreground);
667
		gc.drawText(shortenedText, xDraw, textY, FLAGS);
668
		gc.drawText(shortenedText, xDraw, textY, FLAGS);
668
		gc.setFont(gcFont);
669
		gc.setFont(gcFont);
669
	}
670
	}
Lines 735-740 Link Here
735
	return parent.getFont();
736
	return parent.getFont();
736
}
737
}
737
/**
738
/**
739
 * Returns the foreground color that the receiver will use to draw.
740
 *
741
 * @return the receiver's foreground color
742
 *
743
 * @exception SWTException <ul>
744
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
745
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
746
 * </ul>
747
 * 
748
 * @since 3.6
749
 */
750
public Color getForeground () {
751
	checkWidget ();
752
	return foreground;
753
}
754
/**
738
 * Returns the receiver's parent, which must be a <code>CTabFolder</code>.
755
 * Returns the receiver's parent, which must be a <code>CTabFolder</code>.
739
 *
756
 *
740
 * @return the receiver's parent
757
 * @return the receiver's parent
Lines 953-958 Link Here
953
		parent.redrawTabs();
970
		parent.redrawTabs();
954
	}
971
	}
955
}
972
}
973
/**
974
 * Sets the receiver's foreground color to the color specified
975
 * by the argument, or to the default system color for the item
976
 * if the argument is null.
977
 *
978
 * @param color the new color (or null)
979
 * 
980
 * @exception IllegalArgumentException <ul>
981
 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> 
982
 * </ul>
983
 * @exception SWTException <ul>
984
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
985
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
986
 * </ul>
987
 * 
988
 * @since 3.6
989
 */
990
public void setForeground (Color color){
991
	checkWidget ();
992
	if (color != null && color.isDisposed ()) {
993
		SWT.error (SWT.ERROR_INVALID_ARGUMENT);
994
	}
995
	Color oldColor = getForeground();
996
	if (color == null && oldColor == null) return;
997
	if (color != null && color.equals(oldColor)) return;
998
	foreground = color;
999
	if (!parent.updateTabHeight(false)) {
1000
		parent.updateItems();
1001
		parent.redrawTabs();
1002
	}
1003
}
956
public void setImage (Image image) {
1004
public void setImage (Image image) {
957
	checkWidget();
1005
	checkWidget();
958
	if (image != null && image.isDisposed ()) {
1006
	if (image != null && image.isDisposed ()) {

Return to bug 280969