Community
Participate
Working Groups
Followup for bug 508033 (see comments 6 and 7): > Found one issue with the ToolBar's DropDown arrow which continues to be in > black color irrespective on the foreground/background color. IMO, if > possible this DropDown triangle should be of the same color as Toolbar > foreground. > Unfortunately there's no API method for changing that arrow's Color, so that > would be more work of custom drawing.
Guys, has anybody found a solution to this issue yet? Any suggestion on how to create a custom drawer for the Arrow in ToolItems?
I just addressed this issue in DevStyle by adding a PaintListener to the ToolBar, directly at the end of the contructor and then paint the dopdown arrow for each item like this: public ToolBar (Composite parent, int style) { … addPaintListener(new ToolBarPainter()); } //DropDown icon drawer class private final class ToolBarPainter implements PaintListener { @Override public void paintControl(PaintEvent e) { if (items == null || items.length == 0) { return; } if (!isDarkTheme) { //Need to check if it’s an eclipse dark theme return; } for (ToolItem item : items) { if (item != null && item.isEnabled()) { if ((item.getStyle() & SWT.DROP_DOWN) == 0) { continue; } Rectangle itemBounds = item.getBounds(); //Now some maths magic Point tbSize = ToolBar.this.getSize(); int centerY = tbSize.y / 2; e.gc.setBackground(e.widget.getDisplay() .getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); e.gc.setForeground(e.widget.getDisplay() .getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); int[] points = new int[6]; points[0] = itemBounds.x + itemBounds.width - 14; points[1] = centerY - 2; points[2] = itemBounds.x + itemBounds.width - 5; points[3] = centerY - 2; points[4] = itemBounds.x + itemBounds.width - 10; points[5] = centerY + 3; e.gc.fillPolygon(points); } } } } This fix works well on Windows.
Aaron, I like the idea. Please convert that idea into a Gerrit for a custom CSS handler so that it can be applied. See http://www.vogella.com/tutorials/Eclipse4CSS/article.html#exercise-define-a-custom-css-selector-and-css-property for an example for a custom CSS handler.
I had to move the painting some pixels to the right. Under Windows 10 the black arrow which came from the OS was visible for 1 pixel at the right. So my version is: final int[] points = new int[6]; points[0] = itemBounds.x + itemBounds.width - 13; points[1] = centerY - 2; points[2] = itemBounds.x + itemBounds.width - 3; points[3] = centerY - 2; points[4] = itemBounds.x + itemBounds.width - 9; points[5] = centerY + 3; e.gc.fillPolygon(points);
We had the same issue on our RCP-based application. We noticed that on other platform (MacOS, I did not tried on Linux) the color of the arrow is the foreground color of the toolbar. So in the proposed PaintListener (Comment #2) we should use e.gc.setBackground(e.widget.getDisplay() .getSystemColor(item.getParent().getForeground()); @Lars : in this case, the "color" property of the CSS entry should change the color of the arrow. What do you think ?
Alexandr, can you check? I think this one is fixed with your recent changes.
Our application doesn't use Toolbar, therefore I won't be able to spend time on this issue. However, I did a quick analysis and found that most likely, on Win10 this code will help when placed in 'createHandle()' : if (OS.IsAppThemed ()) OS.SetWindowTheme (handle, "DarkMode\0".toCharArray(), null);
(In reply to Alexandr Miloslavskiy from comment #7) > Our application doesn't use Toolbar, therefore I won't be able to spend time > on this issue. > > However, I did a quick analysis and found that most likely, on Win10 this > code will help when placed in 'createHandle()' : > > if (OS.IsAppThemed ()) > OS.SetWindowTheme (handle, "DarkMode\0".toCharArray(), null); Thanks, Alexander for this tip. Anyone interested in converting this to a Gerrit?
Resetting target, please re-target as required.
Mass move out to 4.18
Resetting target.