Shouldn't AlertWindow inherit L&F from associated component?

Hello devs,

I’m facing an issue with the AlertWindow look and feel, I thought it was supposed to use the associated component look and feel when being painted but it doesn’t seem to be the case.

By looking at the AlertWindow paint() method I see:

//==============================================================================
void AlertWindow::paint (Graphics& g)
{
    auto& lf = getLookAndFeel();
    lf.drawAlertBox (g, *this, textArea, textLayout);

    g.setColour (findColour (textColourId));
    g.setFont (lf.getAlertWindowFont());
    ...
}

So it doesn’t seem to be the case.
How am I supposed to apply a specific LookAndFeel to an AlertWindow when launching it with the dedicated static methods, like juce::AlertWindow::showMessageBoxAsync?

I know I should normally use the global LookAndFeel, but this is a very specific situation where I need a different one, so the global solution is not viable for me.

Any ideas?
Federico Berti

After some more research I’ve been able to address it by overriding the createAlertWindow(…) method on my specific LookAndFeel class, like this:

AlertWindow* ActivationComponentsLookAndFeel::createAlertWindow(const String& title, const String& message,
	const String& button1,
	const String& button2,
	const String& button3,
	MessageBoxIconType iconType,
	int numButtons, Component* associatedComponent)
{
	juce::AlertWindow* alert = juce::LookAndFeel_V4::createAlertWindow(title, message, button1, button2, button3, iconType, numButtons, associatedComponent);
	alert->setLookAndFeel(this);

	return alert;
}

It works, but I’m not sure it’s the best solution.