Extending LookAndFeel


#1

What is the canonical way of extending LookAndFeel to add additional drawing functions for custom components? The only two options I can think of seem a bit hacky:

  • Have LookAndFeel inherit from CustomComponent::LookAndFeelMethods. Would require changing the JUCE source, which I'm trying to avoid.
  • Create a concrete LookAndFeel subclass that inherits from CustomComponent::LookAndFeelMethods and set instances of it as my LookAndFeel for my CustomComponent.. But that would require me to cast the LookAndFeel& I get from getLookAndFeel(). Not very elegant.

Any other suggestions?


#2

You could always reimplement getLookAndFeel() to return your look and feel type. I'm not sure what the recommended way of doing this is though. Maybe another way is just to create a member function, such as getCustomLookAndFeel(), that does the casting for you so you only have to write it once. Just a thought.