diff options
author | Steve Northover <steve> | 2006-03-17 19:01:09 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2006-03-17 19:01:09 +0000 |
commit | 156d213c176b38959f26be8a2a687b54e9492204 (patch) | |
tree | 9050d5dd749c0fd7efd6e446311971e4deea101b | |
parent | 869d0b47847f64e864b376350d43251357ab2f40 (diff) | |
download | eclipse.platform.swt-156d213c176b38959f26be8a2a687b54e9492204.tar.gz eclipse.platform.swt-156d213c176b38959f26be8a2a687b54e9492204.tar.xz eclipse.platform.swt-156d213c176b38959f26be8a2a687b54e9492204.zip |
draw the table like the tree when disabled (with or without an image)
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java | 43 |
1 files changed, 34 insertions, 9 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 fcf1cca245..97866ca8e5 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 @@ -389,7 +389,7 @@ LRESULT CDDS_PREPAINT (int wParam, int lParam) { } } } - if (OS.IsWindowVisible (handle) && OS.IsWindowEnabled (handle)) { + if (OS.IsWindowVisible (handle)) { Control control = findBackgroundControl (); if (control != null && control.backgroundImage != null) { NMLVCUSTOMDRAW nmcd = new NMLVCUSTOMDRAW (); @@ -399,12 +399,14 @@ LRESULT CDDS_PREPAINT (int wParam, int lParam) { fillImageBackground (nmcd.hdc, control, rect); } else { if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) == OS.CLR_NONE) { - NMLVCUSTOMDRAW nmcd = new NMLVCUSTOMDRAW (); - OS.MoveMemory (nmcd, lParam, NMLVCUSTOMDRAW.sizeof); - RECT rect = new RECT (); - OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); - if (control == null) control = this; - fillBackground (nmcd.hdc, control.getBackgroundPixel (), rect); + if (OS.IsWindowEnabled (handle)) { + NMLVCUSTOMDRAW nmcd = new NMLVCUSTOMDRAW (); + OS.MoveMemory (nmcd, lParam, NMLVCUSTOMDRAW.sizeof); + RECT rect = new RECT (); + OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); + if (control == null) control = this; + fillBackground (nmcd.hdc, control.getBackgroundPixel (), rect); + } } } } @@ -548,6 +550,21 @@ LRESULT CDDS_SUBITEMPREPAINT (int wParam, int lParam) { } code |= OS.CDRF_NEWFONT; } + /* + * Feature in Windows. When the table is disabled, it draws + * with a gray background but does not gray the text. The fix + * is to explicitly gray the text. + */ + if (!OS.IsWindowEnabled (handle)) { + nmcd.clrText = OS.GetSysColor (OS.COLOR_GRAYTEXT); + if (findImageControl () != null) { + nmcd.clrTextBk = OS.CLR_NONE; + } else { + nmcd.clrTextBk = OS.GetSysColor (OS.COLOR_3DFACE); + } + OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); + code |= OS.CDRF_NEWFONT; + } } return new LRESULT (code); } @@ -2744,7 +2761,8 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, int lParam) { } } else { data.foreground = OS.GetTextColor (hDC); - data.background = clrSelectionBk = OS.GetSysColor (OS.COLOR_3DFACE); + data.background = OS.GetSysColor (OS.COLOR_3DFACE); + if (selected) clrSelectionBk = data.background; } data.hPen = OS.CreatePen (OS.PS_SOLID, 0, data.foreground); data.hBrush = OS.CreateSolidBrush (data.background); @@ -5088,7 +5106,14 @@ LRESULT wmNotifyChild (int wParam, int lParam) { case OS.NM_CUSTOMDRAW: { int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (hdr.hwndFrom == hwndHeader) break; - if (!customDraw && findImageControl () == null) break; + if (!customDraw && findImageControl () == null) { + /* + * Feature in Windows. When the table is disabled, it draws + * with a gray background but does not gray the text. The fix + * is to explicitly gray the text using Custom Draw. + */ + if (OS.IsWindowEnabled (handle)) break; + } NMLVCUSTOMDRAW nmcd = new NMLVCUSTOMDRAW (); OS.MoveMemory (nmcd, lParam, NMLVCUSTOMDRAW.sizeof); switch (nmcd.dwDrawStage) { |