Custom Component and LookAndFeel


#1

I am making a custom widget (inheriting from Component) from scratch which includes a Listener class and a LookAndFeelMethods struct similar to some of the widgets that come with Juce.

My custom LookAndFeel class (which inherits from v3) also inherits from the LookAndFeel struct.

Obviously, I can easily draw the widget using the paint() method, but I am having a hard time finding how to access the methods in the LookAndFeel class as I would with others.

When I use getLookAndFeel() in my new widget, it makes sense that I can’t access them, but this is how it appears to be done in Juce widgets like Slider.

Can anyone offer any help for how I can hook that up so that I can use the methods in the laf class?


#2

you can dynamically cast the result of Component::getLookAndFeel() to your type, but dont forget to provide your laf somewhere in the environment by setting it