TooltipWindow and LnF


I have multiple components that has to display tooltips and these tooltips should look different (each component its own LookAndFeel class).
I have my only instance of tooltip in the parent component (the parent of all of the components that have to display tooltips).

What is the best way to manage the LookAndFeel of the tooltip object so it should display to correct LnF class for each component?


The TooltipWindow isn’t designed to show different kinds of tips for different components, the point was really that it just has a uniform look for everything. I think you’d probably need to write some custom tooltip code if you need to do that. Or I suppose you could embed some sort of code into the tooltip string, which your l+f could use as a signal about what kind of look to use for it.

I ended up adding an attribute class and a method to juce_TooltipWindow.h…

[code]class JUCE_API TooltipWindowCustomLookAndFeel{}

void setCustomLookAndFeel(Component* componentUnderMouse);[/code]


[code]void TooltipWindow::setCustomLookAndFeel(Component* componentUnderMouse)
while (componentUnderMouse != nullptr && dynamic_cast<TooltipWindowCustomLookAndFeel*>(componentUnderMouse) == nullptr)
componentUnderMouse = componentUnderMouse->getParentComponent();

if (componentUnderMouse != nullptr)


This method gets invoked just before the 2 incarnations of the line showFor (newTip);

This way any tooltip shown will check whether some parent of the component under the mouse has the attribute and if so, will take its LookAndFeel…
I hate to change the framework code, but I really don’t want to forget to add prefixes to strings and such…