View | Details | Raw Unified | Return to bug 316662
Collapse All | Expand All

(-)Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java (-6 / +50 lines)
Lines 54-60 Link Here
54
	Button arrow;
54
	Button arrow;
55
	boolean hasFocus;
55
	boolean hasFocus;
56
	Listener listener, filter;
56
	Listener listener, filter;
57
	Color foreground, background;
57
	Color listForeground, listBackground;
58
	Font font;
58
	Font font;
59
	Shell _shell;
59
	Shell _shell;
60
	
60
	
Lines 467-474 Link Here
467
	if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
467
	if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
468
	list = new List (popup, listStyle);
468
	list = new List (popup, listStyle);
469
	if (font != null) list.setFont (font);
469
	if (font != null) list.setFont (font);
470
	if (foreground != null) list.setForeground (foreground);
470
	if (listForeground != null) list.setForeground (listForeground);
471
	if (background != null) list.setBackground (background);
471
	if (listBackground != null) list.setBackground (listBackground);
472
472
473
	int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
473
	int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
474
	for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
474
	for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
Lines 1400-1411 Link Here
1400
}
1400
}
1401
public void setBackground (Color color) {
1401
public void setBackground (Color color) {
1402
	super.setBackground(color);
1402
	super.setBackground(color);
1403
	background = color;
1403
	setTextBackground(color);
1404
	setListBackground(color);
1405
}
1406
/**
1407
 * Sets the text widget's background color to the color specified
1408
 * by the argument, or to the default system color for the control
1409
 * if the argument is null.
1410
 * <p>
1411
 * Note: This operation is a hint and may be overridden by the platform.
1412
 * For example, on Windows the background of a Button cannot be changed.
1413
 * </p>
1414
 * @param color the new color (or null)
1415
 *
1416
 * @exception IllegalArgumentException <ul>
1417
 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> 
1418
 * </ul>
1419
 * @exception SWTException <ul>
1420
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1421
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1422
 * </ul>
1423
 * @since 3.7
1424
 */
1425
public void setTextBackground(Color color) {
1404
	if (text != null) text.setBackground(color);
1426
	if (text != null) text.setBackground(color);
1405
	if (list != null) list.setBackground(color);
1406
	if (arrow != null) arrow.setBackground(color);
1427
	if (arrow != null) arrow.setBackground(color);
1407
}
1428
}
1408
/**
1429
/**
1430
 * Sets the list widget's background color to the color specified
1431
 * by the argument, or to the default system color for the control
1432
 * if the argument is null.
1433
 * <p>
1434
 * Note: This operation is a hint and may be overridden by the platform.
1435
 * For example, on Windows the background of a Button cannot be changed.
1436
 * </p>
1437
 * @param color the new color (or null)
1438
 *
1439
 * @exception IllegalArgumentException <ul>
1440
 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> 
1441
 * </ul>
1442
 * @exception SWTException <ul>
1443
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1444
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1445
 * </ul>
1446
 * @since 3.7
1447
 */
1448
public void setListBackground(Color color) {
1449
	listBackground = color;
1450
	if (list != null) list.setBackground(color);
1451
}
1452
/**
1409
 * Sets the editable state.
1453
 * Sets the editable state.
1410
 *
1454
 *
1411
 * @param editable the new editable state
1455
 * @param editable the new editable state
Lines 1442-1448 Link Here
1442
}
1486
}
1443
public void setForeground (Color color) {
1487
public void setForeground (Color color) {
1444
	super.setForeground(color);
1488
	super.setForeground(color);
1445
	foreground = color;
1489
	listForeground = color;
1446
	if (text != null) text.setForeground(color);
1490
	if (text != null) text.setForeground(color);
1447
	if (list != null) list.setForeground(color);
1491
	if (list != null) list.setForeground(color);
1448
	if (arrow != null) arrow.setForeground(color);
1492
	if (arrow != null) arrow.setForeground(color);

Return to bug 316662