This should be an easy one… but I just can’t figure it out.
I just want to make the font of the active tab of a TabbedComponent appear in red.
So I have this object
TabbedComponent tabs{ TabbedButtonBar::TabsAtTop };
And in the parent consturctor:
tabs.getTabbedButtonBar().addChangeListener(this);
now, I thought I would use something like this:
class otherLookandFeel : public LookAndFeel_V4
{
public:
otherLookandFeel() {};
~otherLookandFeel() {};
void drawTabButtonText(TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
{
g.setColour(Colours::red);
g.drawFittedText(button.getButtonText(), button.getBounds(), Justification::centred, 1);
}
private:
};
In the parent:
otherLookandFeel feelRed;
And in the parent callback:
void Parent::changeListenerCallback(ChangeBroadcaster* source)
{
for (int x = 0; x < tabs.getTabbedButtonBar().getNumTabs(); ++x)
{
TabBarButton* button = tabs.getTabbedButtonBar().getTabButton(x);
if (button ->isFrontTab())
{
button ->setLookAndFeel(&feelRed);
button ->sendLookAndFeelChange();
button->repaint();
}
}
The callback code gets hit but it does not trigger the modified drawTabButtonText
function. What am I missing here?