diff options
author | Steve Northover | 2006-05-02 13:58:39 +0000 |
---|---|---|
committer | Steve Northover | 2006-05-02 13:58:39 +0000 |
commit | 4e5d42eb21dc353825a14c7be0dd4eb90fbcadc4 (patch) | |
tree | 160bb4e50647965070312328b4c7a8951518caad | |
parent | ce44e057ecb68d0eeac12f3ad1f32ce88c8f5510 (diff) | |
download | eclipse.platform.swt-4e5d42eb21dc353825a14c7be0dd4eb90fbcadc4.tar.gz eclipse.platform.swt-4e5d42eb21dc353825a14c7be0dd4eb90fbcadc4.tar.xz eclipse.platform.swt-4e5d42eb21dc353825a14c7be0dd4eb90fbcadc4.zip |
139509 - Table with custom drawn text doesn't inherit background colour
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index ad78f816d8..8b79413238 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -2797,9 +2797,21 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, int lParam) { data.background = clrSelectionBk = OS.GetSysColor (OS.COLOR_3DFACE); } } else { + drawBackground = clrTextBk != -1; + /* + * Bug in Windows. When LVM_SETTEXTBKCOLOR or LVM_SETBKCOLOR + * is used to set the background color of the the text or the + * control, the color is not set in the HDC that is provided + * in Custom Draw. The fix is to explicitly set the background + * color. + */ + if (clrTextBk == -1) { + Control control = findBackgroundControl (); + if (control == null) control = this; + clrTextBk = control.getBackgroundPixel (); + } data.foreground = clrText != -1 ? clrText : OS.GetTextColor (hDC); data.background = clrTextBk != -1 ? clrTextBk : OS.GetBkColor (hDC); - drawBackground = clrTextBk != -1; } } else { data.foreground = OS.GetSysColor (OS.COLOR_GRAYTEXT); @@ -3036,9 +3048,21 @@ void sendPaintItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd) { if (clrText == -1) clrText = item.foreground; int clrTextBk = item.cellBackground != null ? item.cellBackground [nmcd.iSubItem] : -1; if (clrTextBk == -1) clrTextBk = item.background; + drawBackground = clrTextBk != -1; + /* + * Bug in Windows. When LVM_SETTEXTBKCOLOR or LVM_SETBKCOLOR + * is used to set the background color of the the text or the + * control, the color is not set in the HDC that is provided + * in Custom Draw. The fix is to explicitly set the background + * color. + */ + if (clrTextBk == -1) { + Control control = findBackgroundControl (); + if (control == null) control = this; + clrTextBk = control.getBackgroundPixel (); + } data.foreground = clrText != -1 ? clrText : OS.GetTextColor (hDC); data.background = clrTextBk != -1 ? clrTextBk : OS.GetBkColor (hDC); - drawBackground = clrTextBk != -1; } } else { data.foreground = OS.GetSysColor (OS.COLOR_GRAYTEXT); |