Hello,
I’ve discovered a bug related to the highlighting of CustomComponents in a PopupMenu.
Behavior: CustomComponents cannot be highlighted because calling PopupMenu::CustomComponent::isItemHighlighted() always returns false.
Example:
void MyCustomComponent::repaint(Graphics &g)
{
if (isItemHighlighted()) // IS ALWAYS FALSE
g.fillAll(_highlightColor);
_drawMyComponent();
}
Cause: When a CustomComponent is added to a PopupMenu via PopupMenu::addCustomComponent, the custom component is wrapped in a NormalComponentWrapper, which is a subclass of CustomComponent. Therefore when CustomComponent::setHighlighted is finally called in PopupMenu::highlightItemUnderMouse (via PopupMenu::setCurrentlyHighlightedChild), it is called on the the NormalComponentWrapper, which does not pass the information along to the user’s CustomComponent.
Thanks!
Joe
