Using custom TabbedButtonBar with TabbedComponent?


I’m trying to use a custom TabbedButtonBar class with a TabbedComponent. It’s easy to implement my own custom tabs via to the virtual createTabButton, but I don’t see any equivalent for the button bar itself. The closest thing is the protected ScopedPointer object tabs, but arbitrarily replacing the contents of that pointer seems wrong (and crashes anyway, when I tried it out of curiosity in my derived TabbedComponent's constructor).

FWIW, what I’m implementing are special-case draggable/rearrangeable tabs.


It’s not something I’d thought anyone would want to do, but if you want to suggest a non-hacky change to TabbedComponent that would make it possible to do what you need, I’d be happy to take a look.


FWIW, this also would have been handy for me recently; the client’s feature request has been deferred for now. (And I guarantee that they’ll be asking for draggable tabs before long…)

First thought was to add a counterpart to this that lets your class return a derived button bar class:
virtual TabBarButton * createTabButton (const String &tabName, int tabIndex)


virtual TabBarButton * createTabbedButtonBar(orientation)

…until I saw that the button bar is created in the component’s ctor, and the virtual function call wouldn’t work.

Is it unreasonable to make this a template class specialized on the type of the button bar?


Thanks for offering to take a look. I’m usually extremely averse to modifying JUCE code directly (i.e. for a pull request) and come up with crazy workarounds with subclasses that carefully modify JUCE object state based on knowledge from the normal implementations instead. If I come up with something I’ll post here.

I think @bgporter is onto the right idea, but a template definitely isn’t the way to go since that isn’t how any other composite components (to my knowledge) are designed. We’d definitely want something like virtual TabBarButton * createTabbedButtonBar(orientation)