diff options
author | Steve Northover <steve> | 2006-03-03 20:56:53 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2006-03-03 20:56:53 +0000 |
commit | bfc70829f8c27802e49d915f1f94c324c3126693 (patch) | |
tree | 3f6b7c90fac578ab6485b8afab9c2e98941df23e /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java | |
parent | 88a58bf65aeae18bd54f877859c97b39dce23f62 (diff) | |
download | eclipse.platform.swt-bfc70829f8c27802e49d915f1f94c324c3126693.tar.gz eclipse.platform.swt-bfc70829f8c27802e49d915f1f94c324c3126693.tar.xz eclipse.platform.swt-bfc70829f8c27802e49d915f1f94c324c3126693.zip |
130375 - Background Inheritance Incorrect in Composite Hierarchies
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java index 8f1fc482f8..f922bd79bc 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java @@ -425,6 +425,20 @@ LRESULT WM_ERASEBKGND (int wParam, int lParam) { if ((bits & OS.SS_OWNERDRAW) == OS.SS_OWNERDRAW) { return LRESULT.ONE; } + /* + * Bug in Windows. For some reason, the HBRUSH that + * is returned from WM_CTRLCOLOR is misaligned when + * the label uses it to draw. If the brush is a solid + * color, this does not matter. However, if the brush + * contains an image, the image is misaligned. The + * fix is to draw the background in WM_ERASEBKGND. + */ + if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { + if (findImageControl () != null) { + drawBackground (wParam); + return LRESULT.ONE; + } + } return result; } @@ -479,6 +493,29 @@ LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { return result; } + +LRESULT wmColorChild (int wParam, int lParam) { + int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); + if ((bits & OS.SS_OWNERDRAW) == OS.SS_OWNERDRAW) { + return super.wmColorChild (wParam, lParam); + } + /* + * Bug in Windows. For some reason, the HBRUSH that + * is returned from WM_CTRLCOLOR is misaligned when + * the label uses it to draw. If the brush is a solid + * color, this does not matter. However, if the brush + * contains an image, the image is misaligned. The + * fix is to draw the background in WM_ERASEBKGND. + */ + if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { + if (findImageControl () != null) { + OS.SetBkMode (wParam, OS.TRANSPARENT); + return new LRESULT (OS.GetStockObject (OS.NULL_BRUSH)); + } + } + return super.wmColorChild (wParam, lParam); +} + LRESULT wmDrawChild (int wParam, int lParam) { DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT (); OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof); |