diff options
author | Alexandr Miloslavskiy | 2020-05-13 20:52:54 +0000 |
---|---|---|
committer | Niraj Modi | 2020-05-15 14:07:48 +0000 |
commit | fdad775eff1272fde91253a01f85ee57d35b3ec6 (patch) | |
tree | 397393c16c8d55246022b385c53447c088c3e9b7 /bundles/org.eclipse.swt | |
parent | 3cd2dc7cb792b9be2c78013774b23a7cbecd4560 (diff) | |
download | eclipse.platform.swt-fdad775eff1272fde91253a01f85ee57d35b3ec6.tar.gz eclipse.platform.swt-fdad775eff1272fde91253a01f85ee57d35b3ec6.tar.xz eclipse.platform.swt-fdad775eff1272fde91253a01f85ee57d35b3ec6.zip |
Bug 560284 - [win32][Dark] Table header delimiters color is bad for dark theme
The color is configurable, because Eclipse and the product I'm working
on are likely to use different colors.
For API design goals, see recent patch for Bug 444560.
Change-Id: I9a1dec43d6081097bb0db0a47a0f381163ba5b32
Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Diffstat (limited to 'bundles/org.eclipse.swt')
3 files changed, 21 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index 6ca6bfc5af..f75d045cc0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -2361,6 +2361,7 @@ public static final void setTheme(boolean isDarkTheme) { display.setData("org.eclipse.swt.internal.win32.Table.use_WS_BORDER", isDarkTheme); display.setData("org.eclipse.swt.internal.win32.Text.use_WS_BORDER", isDarkTheme); display.setData("org.eclipse.swt.internal.win32.Tree.use_WS_BORDER", isDarkTheme); + display.setData("org.eclipse.swt.internal.win32.Table.headerLineColor", isDarkTheme ? new Color(display, 0x50, 0x50, 0x50) : null); } public static final boolean SetDllDirectory (TCHAR lpPathName) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 15f321386b..b25dc66b7a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -222,6 +222,13 @@ public class Display extends Device { boolean useWsBorderText = false; static final String USE_WS_BORDER_TREE_KEY = "org.eclipse.swt.internal.win32.Tree.use_WS_BORDER"; //$NON-NLS-1$ boolean useWsBorderTree = false; + /** + * Changes the color of Table header's column delimiters. + * Only affects custom-drawn header, that is when background/foreground header color is set. + * Expects a <code>Color</code> value. + */ + static final String TABLE_HEADER_LINE_COLOR_KEY = "org.eclipse.swt.internal.win32.Table.headerLineColor"; //$NON-NLS-1$ + int tableHeaderLinePixel = -1; /* Custom icons */ long hIconSearch; @@ -4401,6 +4408,9 @@ public void setData (String key, Object value) { case USE_WS_BORDER_TREE_KEY: useWsBorderTree = !disableCustomThemeTweaks && _toBoolean(value); return; + case TABLE_HEADER_LINE_COLOR_KEY: + tableHeaderLinePixel = disableCustomThemeTweaks ? -1 : _toColorPixel(value); + return; } /* Remove the key/value pair */ 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 8c50ec196f..efd4d1f913 100644 --- 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 @@ -6954,18 +6954,24 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) { OS.DeleteObject (pen); } + int alignmentCorrection = _getLinesVisible () ? 0 : 1; + /* Windows 7 and 10 always draw a nearly invisible vertical line between the columns, even if lines are disabled. This line uses no fixed color constant, but calculates it from the background color. - The method getSlightlyDifferentColor gives us a color, that is near enough to the windows algorithm. */ + The method getSlightlyDifferentColor gives us a color, that is near enough to the windows algorithm. + + NOTE: This code has no effect since Bug 517003, because next OS.Polyline() draws over the same coords. + long pen = OS.CreatePen (OS.PS_SOLID, getGridLineWidthInPixels(), getSlightlyDifferentColor(getHeaderBackgroundPixel())); long oldPen = OS.SelectObject (nmcd.hdc, pen); - int alignmentCorrection = _getLinesVisible () ? 0 : 1; OS.Polyline(nmcd.hdc, new int[] {rects[i].right-alignmentCorrection, rects[i].top, rects[i].right-alignmentCorrection, rects[i].bottom}, 2); OS.SelectObject (nmcd.hdc, oldPen); OS.DeleteObject (pen); + */ - pen = OS.CreatePen (OS.PS_SOLID, getGridLineWidthInPixels(), OS.GetSysColor(OS.COLOR_3DFACE)); - oldPen = OS.SelectObject (nmcd.hdc, pen); + int lineColor = (display.tableHeaderLinePixel != -1) ? display.tableHeaderLinePixel : OS.GetSysColor(OS.COLOR_3DFACE); + long pen = OS.CreatePen (OS.PS_SOLID, getGridLineWidthInPixels(), lineColor); + long oldPen = OS.SelectObject (nmcd.hdc, pen); /* To differentiate headers, always draw header column separator. */ OS.Polyline(nmcd.hdc, new int[] {rects[i].right - alignmentCorrection, rects[i].top, rects[i].right - alignmentCorrection, rects[i].bottom}, 2); /* To differentiate header & content area, always draw the line separator between header & first row. */ |