Why does PopupMenu have a border on Windows?


#1

The L&F drawPopupMenuBackground method draws a border around the popup menu, but only on Windows (and I suppose Linux too):

#if ! JUCE_MAC
    g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
    g.drawRect (0, 0, width, height);
#endif 

What is the purpose of this border? My guess is that the dropshadow that is applied to the menu cannot be reliably applied on Windows, so the border is a way of ensuring that the menu has sufficient contrast with its background?


#2

I suspect that code is very old indeed, but probably the original reason was that OSX always adds a 1px border around its menus, so this made it look consistent when you run your code on other OSes.


#3

Thanks Jules. It sounds like I can safely remove that snippet from my drawPopupMenuBackground override? On Mac the menu is being rendered without a border, but with a dropshadow, and I’d like it to look like that on Windows too.


#4

yeah, you can do whatever you want in your override!