Has anyone used a TabbedComponent with a non-default LookAndFeel? It crashes with a SIGABRT on OSX at
TabbedButtonBar::updateTabPositions() line 409
const int overlap = lf.getTabButtonOverlap (depth) + lf.getTabButtonSpaceAroundImage() * 2;
The address of lf is the same as my LookAndFeel object.
My LookAndFeel is derived from LookAndFeel_V2 and I’ve implemented all the methods:
int getTabButtonOverlap (int tabDepth) override;
int getTabButtonSpaceAroundImage() override;
int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;
Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton& button, Rectangle<int>& textArea, Component& comp) override;
void createTabButtonShape (TabBarButton& button, Path& p, bool /*isMouseOver*/, bool /*isMouseDown*/) override;
void fillTabButtonShape (TabBarButton& button, Graphics& g, const Path& path, bool /*isMouseOver*/, bool /*isMouseDown*/) override;
void drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown) override;
void drawTabButtonText (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
void drawTabbedButtonBarBackground (TabbedButtonBar&, Graphics&) override;
void drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphics& g, const int w, const int h) override;
Button* createTabBarExtrasButton() override;
which are all currently implemented using the same code as in LookAndFeel_V2 for each method.
I’ve run into this before where I got around it by using a default LookAndFeel, but this time that’s not a viable option.
You can reproduce the issue in the JUCE demo by changing the Widgets demo:
class WidgetsDemo : public Component
{
public:
WidgetsDemo()
{
setOpaque (true);
tabs.setLookAndFeel (&testLF);
addAndMakeVisible (tabs);
}
void paint (Graphics& g) override
{
g.fillAll (Colours::white);
}
void resized() override
{
tabs.setBounds (getLocalBounds().reduced (4));
}
private:
DemoTabbedComponent tabs;
LookAndFeel_V2 testLF;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WidgetsDemo);
};
Thanks,
Rail