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

Collapse All | Expand All

(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java (-2 / +2 lines)
Lines 1736-1743 Link Here
1736
}
1736
}
1737
1737
1738
void setForegroundColor (GdkColor color) {
1738
void setForegroundColor (GdkColor color) {
1739
	super.setForegroundColor (color);
1739
	super.setForegroundColor (handle, color, false);
1740
	if (entryHandle != 0) setForegroundColor (entryHandle, color);
1740
	if (entryHandle != 0) setForegroundColor (entryHandle, color, false);
1741
	OS.g_object_set (textRenderer, OS.foreground_gdk, color, 0);
1741
	OS.g_object_set (textRenderer, OS.foreground_gdk, color, 0);
1742
}
1742
}
1743
1743
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java (-1 / +5 lines)
Lines 1098-1103 Link Here
1098
	redraw();
1098
	redraw();
1099
}
1099
}
1100
1100
1101
void setForegroundColor (GdkColor color) {
1102
	setForegroundColor (handle, color, false);
1103
}
1104
1101
public void setForeground(Color color) {
1105
public void setForeground(Color color) {
1102
	super.setForeground(color);
1106
	super.setForeground(color);
1103
	fg = color;
1107
	fg = color;
Lines 1608-1611 Link Here
1608
	}
1612
	}
1609
	redraw();	
1613
	redraw();	
1610
}
1614
}
1611
}
1615
}
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java (+8 lines)
Lines 268-273 Link Here
268
	GdkColor COLOR_WIDGET_DARK_SHADOW, COLOR_WIDGET_NORMAL_SHADOW, COLOR_WIDGET_LIGHT_SHADOW;
268
	GdkColor COLOR_WIDGET_DARK_SHADOW, COLOR_WIDGET_NORMAL_SHADOW, COLOR_WIDGET_LIGHT_SHADOW;
269
	GdkColor COLOR_WIDGET_HIGHLIGHT_SHADOW, COLOR_WIDGET_BACKGROUND, COLOR_WIDGET_FOREGROUND, COLOR_WIDGET_BORDER;
269
	GdkColor COLOR_WIDGET_HIGHLIGHT_SHADOW, COLOR_WIDGET_BACKGROUND, COLOR_WIDGET_FOREGROUND, COLOR_WIDGET_BORDER;
270
	GdkColor COLOR_LIST_FOREGROUND, COLOR_LIST_BACKGROUND, COLOR_LIST_SELECTION, COLOR_LIST_SELECTION_TEXT;
270
	GdkColor COLOR_LIST_FOREGROUND, COLOR_LIST_BACKGROUND, COLOR_LIST_SELECTION, COLOR_LIST_SELECTION_TEXT;
271
	GdkColor COLOR_LIST_SELECTION_INACTIVE, COLOR_LIST_SELECTION_TEXT_INACTIVE;
271
	GdkColor COLOR_INFO_BACKGROUND, COLOR_INFO_FOREGROUND;
272
	GdkColor COLOR_INFO_BACKGROUND, COLOR_INFO_FOREGROUND;
272
	GdkColor COLOR_TITLE_FOREGROUND, COLOR_TITLE_BACKGROUND, COLOR_TITLE_BACKGROUND_GRADIENT;
273
	GdkColor COLOR_TITLE_FOREGROUND, COLOR_TITLE_BACKGROUND, COLOR_TITLE_BACKGROUND_GRADIENT;
273
	GdkColor COLOR_TITLE_INACTIVE_FOREGROUND, COLOR_TITLE_INACTIVE_BACKGROUND, COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT;
274
	GdkColor COLOR_TITLE_INACTIVE_FOREGROUND, COLOR_TITLE_INACTIVE_BACKGROUND, COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT;
Lines 2231-2236 Link Here
2231
	OS.gtk_style_get_base (style, OS.GTK_STATE_SELECTED, gdkColor);
2232
	OS.gtk_style_get_base (style, OS.GTK_STATE_SELECTED, gdkColor);
2232
	COLOR_LIST_SELECTION = gdkColor;
2233
	COLOR_LIST_SELECTION = gdkColor;
2233
	gdkColor = new GdkColor();
2234
	gdkColor = new GdkColor();
2235
	OS.gtk_style_get_text (style, OS.GTK_STATE_ACTIVE, gdkColor);
2236
	COLOR_LIST_SELECTION_TEXT_INACTIVE = gdkColor;
2237
	gdkColor = new GdkColor();
2238
	OS.gtk_style_get_base (style, OS.GTK_STATE_ACTIVE, gdkColor);
2239
	COLOR_LIST_SELECTION_INACTIVE = gdkColor;
2240
	gdkColor = new GdkColor();
2234
	OS.gtk_style_get_bg (style, OS.GTK_STATE_SELECTED, gdkColor);
2241
	OS.gtk_style_get_bg (style, OS.GTK_STATE_SELECTED, gdkColor);
2235
	COLOR_TITLE_BACKGROUND = gdkColor;
2242
	COLOR_TITLE_BACKGROUND = gdkColor;
2236
	gdkColor = new GdkColor();
2243
	gdkColor = new GdkColor();
Lines 3365-3370 Link Here
3365
	COLOR_WIDGET_DARK_SHADOW = COLOR_WIDGET_NORMAL_SHADOW = COLOR_WIDGET_LIGHT_SHADOW =
3372
	COLOR_WIDGET_DARK_SHADOW = COLOR_WIDGET_NORMAL_SHADOW = COLOR_WIDGET_LIGHT_SHADOW =
3366
	COLOR_WIDGET_HIGHLIGHT_SHADOW = COLOR_WIDGET_BACKGROUND = COLOR_WIDGET_BORDER =
3373
	COLOR_WIDGET_HIGHLIGHT_SHADOW = COLOR_WIDGET_BACKGROUND = COLOR_WIDGET_BORDER =
3367
	COLOR_LIST_FOREGROUND = COLOR_LIST_BACKGROUND = COLOR_LIST_SELECTION = COLOR_LIST_SELECTION_TEXT =
3374
	COLOR_LIST_FOREGROUND = COLOR_LIST_BACKGROUND = COLOR_LIST_SELECTION = COLOR_LIST_SELECTION_TEXT =
3375
	COLOR_LIST_SELECTION_INACTIVE = COLOR_LIST_SELECTION_TEXT_INACTIVE =
3368
	COLOR_WIDGET_FOREGROUND = COLOR_TITLE_FOREGROUND = COLOR_TITLE_BACKGROUND = COLOR_TITLE_BACKGROUND_GRADIENT =
3376
	COLOR_WIDGET_FOREGROUND = COLOR_TITLE_FOREGROUND = COLOR_TITLE_BACKGROUND = COLOR_TITLE_BACKGROUND_GRADIENT =
3369
	COLOR_TITLE_INACTIVE_FOREGROUND = COLOR_TITLE_INACTIVE_BACKGROUND = COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT =
3377
	COLOR_TITLE_INACTIVE_FOREGROUND = COLOR_TITLE_INACTIVE_BACKGROUND = COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT =
3370
	COLOR_INFO_BACKGROUND = COLOR_INFO_FOREGROUND = null;
3378
	COLOR_INFO_BACKGROUND = COLOR_INFO_FOREGROUND = null;
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java (+4 lines)
Lines 1314-1319 Link Here
1314
	OS.g_free (iter);
1314
	OS.g_free (iter);
1315
}
1315
}
1316
1316
1317
void setForegroundColor (GdkColor color) {
1318
	setForegroundColor (handle, color, false);
1319
}
1320
1317
/**
1321
/**
1318
 * Selects the item at the given zero-relative index in the receiver. 
1322
 * Selects the item at the given zero-relative index in the receiver. 
1319
 * If the item at the index was already selected, it remains selected.
1323
 * If the item at the index was already selected, it remains selected.
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java (+4 lines)
Lines 887-892 Link Here
887
	super.setFontDescription (font);
887
	super.setFontDescription (font);
888
}
888
}
889
889
890
void setForegroundColor (GdkColor color) {
891
	setForegroundColor (handle, color, false);
892
}
893
890
/**
894
/**
891
 * Sets the amount that the receiver's value will be
895
 * Sets the amount that the receiver's value will be
892
 * modified by when the up/down arrows are pressed to
896
 * modified by when the up/down arrows are pressed to
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java (-2 / +2 lines)
Lines 288-295 Link Here
288
288
289
void setForegroundColor (GdkColor color) {
289
void setForegroundColor (GdkColor color) {
290
	/* Don't set the color in vbox handle (it doesn't draw) */
290
	/* Don't set the color in vbox handle (it doesn't draw) */
291
	setForegroundColor (labelHandle, color);
291
	setForegroundColor (labelHandle, color, false);
292
	setForegroundColor (imageHandle, color);
292
	setForegroundColor (imageHandle, color, false);
293
}
293
}
294
294
295
public void setImage (Image image) {
295
public void setImage (Image image) {
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java (-2 / +19 lines)
Lines 2676-2683 Link Here
2676
				contentWidth [0] += imageWidth;
2676
				contentWidth [0] += imageWidth;
2677
				GC gc = new GC (this);
2677
				GC gc = new GC (this);
2678
				if ((drawState & SWT.SELECTED) != 0) {
2678
				if ((drawState & SWT.SELECTED) != 0) {
2679
					gc.setBackground (display.getSystemColor (SWT.COLOR_LIST_SELECTION));
2679
					Color background, foreground;
2680
					gc.setForeground (display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT));
2680
					if (OS.GTK_WIDGET_HAS_FOCUS (handle)) {
2681
						background = display.getSystemColor (SWT.COLOR_LIST_SELECTION);
2682
						foreground = display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT);
2683
					} else {
2684
						/*
2685
						 * Feature in GTK. When the widget doesn't have focus, then
2686
						 * gtk_paint_flat_box () changes the background color state_type
2687
						 * to GTK_STATE_ACTIVE. The fix is to use the same values in the GC.
2688
						 */
2689
						background = Color.gtk_new (display, display.COLOR_LIST_SELECTION_INACTIVE);
2690
						foreground = Color.gtk_new (display, display.COLOR_LIST_SELECTION_TEXT_INACTIVE);
2691
					}
2692
					gc.setBackground (background);
2693
					gc.setForeground (foreground);
2681
				} else {
2694
				} else {
2682
					gc.setBackground (item.getBackground (columnIndex));
2695
					gc.setBackground (item.getBackground (columnIndex));
2683
					Color foreground = drawForeground != null ? Color.gtk_new (display, drawForeground) : item.getForeground (columnIndex);
2696
					Color foreground = drawForeground != null ? Color.gtk_new (display, drawForeground) : item.getForeground (columnIndex);
Lines 3001-3006 Link Here
3001
	}
3014
	}
3002
}
3015
}
3003
3016
3017
void setForegroundColor (GdkColor color) {
3018
	setForegroundColor (handle, color, false);
3019
}
3020
3004
/**
3021
/**
3005
 * Marks the receiver's header as visible if the argument is <code>true</code>,
3022
 * Marks the receiver's header as visible if the argument is <code>true</code>,
3006
 * and marks it invisible otherwise. 
3023
 * and marks it invisible otherwise. 
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java (+4 lines)
Lines 2131-2136 Link Here
2131
	setTabStops (tabs);
2131
	setTabStops (tabs);
2132
}
2132
}
2133
2133
2134
void setForegroundColor (GdkColor color) {
2135
	setForegroundColor (handle, color, false);
2136
}
2137
2134
/**
2138
/**
2135
 * Sets the widget message. The message text is displayed
2139
 * Sets the widget message. The message text is displayed
2136
 * as a hint for the user, indicating the purpose of the field.
2140
 * as a hint for the user, indicating the purpose of the field.
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java (-2 / +19 lines)
Lines 2677-2684 Link Here
2677
				contentWidth [0] += imageWidth;
2677
				contentWidth [0] += imageWidth;
2678
				GC gc = new GC (this);
2678
				GC gc = new GC (this);
2679
				if ((drawState & SWT.SELECTED) != 0) {
2679
				if ((drawState & SWT.SELECTED) != 0) {
2680
					gc.setBackground (display.getSystemColor (SWT.COLOR_LIST_SELECTION));
2680
					Color background, foreground;
2681
					gc.setForeground (display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT));
2681
					if (OS.GTK_WIDGET_HAS_FOCUS (handle)) {
2682
						background = display.getSystemColor (SWT.COLOR_LIST_SELECTION);
2683
						foreground = display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT);
2684
					} else {
2685
						/*
2686
						 * Feature in GTK. When the widget doesn't have focus, then
2687
						 * gtk_paint_flat_box () changes the background color state_type
2688
						 * to GTK_STATE_ACTIVE. The fix is to use the same values in the GC.
2689
						 */
2690
						background = Color.gtk_new (display, display.COLOR_LIST_SELECTION_INACTIVE);
2691
						foreground = Color.gtk_new (display, display.COLOR_LIST_SELECTION_TEXT_INACTIVE);
2692
					}
2693
					gc.setBackground (background);
2694
					gc.setForeground (foreground);
2682
				} else {
2695
				} else {
2683
					gc.setBackground (item.getBackground (columnIndex));
2696
					gc.setBackground (item.getBackground (columnIndex));
2684
					Color foreground = drawForeground != null ? Color.gtk_new (display, drawForeground) : item.getForeground (columnIndex);
2697
					Color foreground = drawForeground != null ? Color.gtk_new (display, drawForeground) : item.getForeground (columnIndex);
Lines 2972-2977 Link Here
2972
	}
2985
	}
2973
}
2986
}
2974
2987
2988
void setForegroundColor (GdkColor color) {
2989
	setForegroundColor (handle, color, false);
2990
}
2991
2975
/**
2992
/**
2976
 * Marks the receiver's header as visible if the argument is <code>true</code>,
2993
 * Marks the receiver's header as visible if the argument is <code>true</code>,
2977
 * and marks it invisible otherwise. 
2994
 * and marks it invisible otherwise. 
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java (-8 / +23 lines)
Lines 1528-1549 Link Here
1528
}
1528
}
1529
1529
1530
void setForegroundColor (int /*long*/ handle, GdkColor color) {
1530
void setForegroundColor (int /*long*/ handle, GdkColor color) {
1531
	setForegroundColor (handle, color, true);
1532
}
1533
1534
void setForegroundColor (int /*long*/ handle, GdkColor color, boolean setStateActive) {
1535
	/*
1536
	 * Feature in GTK. When the widget doesn't have focus, then
1537
	 * gtk_default_draw_flat_box () changes the background color state_type
1538
	 * to GTK_STATE_ACTIVE. Widgets whose background is drawn using
1539
	 * gtk_paint_flat_box or gtk_default_draw_flat_box have to pass false for
1540
	 * setStateActive.
1541
	 */
1531
	int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
1542
	int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
1532
	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
1543
	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
1533
	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
1544
	if (setStateActive) OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
1534
	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
1545
	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
1535
	int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
1546
	int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
1536
	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1547
	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1537
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
1548
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
1538
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
1549
	if (setStateActive) {
1539
	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1550
		flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
1540
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
1551
		flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1552
		OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
1553
	}
1541
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
1554
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
1542
	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1555
	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
1543
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
1556
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
1544
1557
1545
	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
1558
	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
1546
	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
1559
	if (setStateActive) OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
1547
	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
1560
	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
1548
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
1561
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
1549
	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
1562
	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
Lines 1551-1559 Link Here
1551
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);	
1564
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);	
1552
	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
1565
	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
1553
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);	
1566
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);	
1554
	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
1567
	if (setStateActive) {
1555
	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
1568
		flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
1556
	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
1569
		flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
1570
		OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
1571
	}
1557
	modifyStyle (handle, style);	
1572
	modifyStyle (handle, style);	
1558
}
1573
}
1559
1574

Return to bug 361373