Menu fillAll() request


Hey Jules -

I was customizing my lookAndFeel class today, getting the menus looking good, and noticed that you have a fillAll(white) in the juce_popupMenu::paint method before calling the lookAndFeel drawPopupMenuBackground method.

I'd like to have popup menus with rounded corners ... but, of course, the white always bleeds through on the edges currently.

Any chance you might change this to either use a color we can set (maybe PopupMenu::backgroundColor) ... or maybe just eliminate the fillAll?

juce_PopupMenu.cpp line 293:

 void paint (Graphics& g) override

        if (isOpaque())

            g.fillAll (Colours::white);

        getLookAndFeel().drawPopupMenuBackground (g, getWidth(), getHeight());




Sorry - I'm confused.. You can't draw rounded corners if your window is opaque, and if it's not opaque, then the background won't be filled (?)


Aha.  Yeah, I thought this was obvious.  I customized my lookAndFeel::drawPopupMenuBackground to draw a background with rounded corners.  I then noticed the white corners coming through (see image).


But just now I see that when that component is created (the MenuWindow, in juce_popupMenu) it sets it's opaqueness based on the PopupMenu::backgroundColourId.


So ... the simple workaround is to set PopupMenu::backgroundColourId to  Colours::transparentBlack ....

then the MenuWindow isn't opaque, and doesn't drop in the white.


Anyway, that works for me.  I do think it strange that you would use white for the background though instead of whatever the PopupMenu::backgroundColourId is set to.





Yes, to be honest the fillAll is probably unnecessary, it's probably left-over from old code before there was a lookandfeel method to draw it.


Right.  It may be less confusing to remove it at this point.  Always weird when a stange color unexpectedly appears on screen.