PopupMenu CustomComponent gets a forced border because of magic number

gui

#1

Hello. I found a magic number in ItemComponent::resized()

void resized() override
{
    if (Component* const child = getChildComponent (0))
        child->setBounds (getLocalBounds().reduced (2, 0));
}

I don’t really see the point of adding 2px padding on each side. Would be nice if it at least used getPopupMenuBorderSize() from the look and feel or something. It’s extra weird because it’s only for the CustomComponent which then can’t paint over these columns of pixels. The reason for this problem is that we are using the full background colour as a tick marker instead of a Path.

Or just get rid of the reduce call and let the user decide on padding inside the CustomComponent.

Cheers, thank you for a great framework.

edit: example fix

void resized() override
    {
        if (Component* const child = getChildComponent (0))
            child->setBounds (getLocalBounds().reduced (getLookAndFeel().getPopupMenuBorderSize(), 0));
    }

#2

Yeah, there are still a few old magic numbers lurking from ancient times… Thanks, I’ll have a look at that one!