Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConrad Groth2016-12-21 12:11:29 +0000
committerNiraj Modi2017-12-13 08:22:40 +0000
commitaa02710cfd49bf59fc4fcded6a2bbdb9cdfba8bb (patch)
tree501e5731d4bf4d9c669617b069ddac8b6c97b2ca /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt
parent976989516860f5c746e80633c254c89e1ed3d8bb (diff)
downloadeclipse.platform.swt-aa02710cfd49bf59fc4fcded6a2bbdb9cdfba8bb.tar.gz
eclipse.platform.swt-aa02710cfd49bf59fc4fcded6a2bbdb9cdfba8bb.tar.xz
eclipse.platform.swt-aa02710cfd49bf59fc4fcded6a2bbdb9cdfba8bb.zip
BugĀ 508033 - Win32: Toolbar ignores foreground color
added new datatype and return values for ToolBar custom drawing. Change-Id: I9f1fa65416314ae794d36d298c7dc0159b8cc535 Signed-off-by: Conrad Groth <info@conrad-groth.de>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
index bd3327f5fb..f2dc0e944d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
@@ -1573,6 +1573,10 @@ LRESULT wmCommandChild (long /*int*/ wParam, long /*int*/ lParam) {
return child.wmCommandChild (wParam, lParam);
}
+private boolean customDrawing() {
+ return hasCustomBackground() || (hasCustomForeground() && OS.IsWindowEnabled(handle));
+}
+
@Override
LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
switch (hdr.code) {
@@ -1598,8 +1602,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
* from the default Blue theme. The fix is to draw the
* background.
*/
- NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW ();
- OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof);
+ NMTBCUSTOMDRAW nmcd = new NMTBCUSTOMDRAW ();
+ OS.MoveMemory (nmcd, lParam, NMTBCUSTOMDRAW.sizeof);
// if (drawCount != 0 || !OS.IsWindowVisible (handle)) {
// if (!OS.IsWinCE && OS.WindowFromDC (nmcd.hdc) == handle) break;
// }
@@ -1620,6 +1624,18 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
return new LRESULT (OS.CDRF_SKIPDEFAULT);
}
+ case OS.CDDS_PREPAINT: {
+ return new LRESULT (customDrawing() ? OS.CDRF_NOTIFYITEMDRAW : OS.CDRF_DODEFAULT);
+ }
+ case OS.CDDS_ITEMPREPAINT: {
+ if (customDrawing()) {
+ nmcd.clrBtnFace = getBackgroundPixel();
+ nmcd.clrText = getForegroundPixel();
+ OS.MoveMemory(lParam, nmcd, NMTBCUSTOMDRAW.sizeof);
+ return new LRESULT(OS.TBCDRF_USECDCOLORS);
+ }
+ return new LRESULT (OS.CDRF_DODEFAULT);
+ }
}
break;
case OS.TBN_HOTITEMCHANGE:

Back to the top