LnF stub/fowarder


Would be great to add by default a LookAndFeelForwarder which forward all functions to an instance given in the ctor but still allowing to override couple of functions by deriving from it.

It allows to only override the current LnF for couples of functions without knowing what is the current class used.

Hope you see what I mean.
The tricky part is that it should be maintained with the trunk as it should forward all the LookAndFeel interface functions.

Thanks !


Can you show an example snippet of what you mean? Maybe I read that too fast, but that was really confusing to me lol


Something along

class LookAndFeelForwarder : public LookAndFeel
LookAndFeelForwarder(LookAndFeel *pLnf) : mpLnf(pLnf)

 virtual void drawPropertyPanelSectionHeader (juce::Graphics& g, const juce::String& name,
                                                 bool isOpen, int width, int height) override
return mpLnf->drawPropertyPanelSectionHeader(g, name, isOpen, width; height);

virtual void drawPropertyComponentBackground (juce::Graphics& g, int width, int height,
                                                  juce::PropertyComponent& component) override
return mpLnf->drawPropertyComponentBackground (g, width, height, component);
LookAndFeel *mpLnf;

but for all functions


How is that different from just subclassing LookAndFeel and calling LookAndFeel::paintButton in your overridden paintButton call? what am I not getting?

struct MyLookAndFeel : public LookAndFeel
   void paintButton(Graphics& g, bool a, bool b) override { LookAndFeel::paintButton(g, a, b); } 


In case you want to customize the LnF of a widget in a hierarchy where you don’t know what the current LnF is and can only get its pointer by asking the parent widget.
If you do custom widget, they can be used in different context hence different base LnF


can’t you just make your widget that you want customized (differently from your existing LnF) just override the paintButton or paintWhatever directly?

struct MyButton : public Button
    MyButton() { setLookAndFeel( myLookAndFeel ); }
    void paintButton(Graphics& g, bool, bool ) override { /* customize however */ }

is that not something we are allowed to do if we use LookAndFeel?


Probably not the most maintenable solution and only works for virtual function like the painting ones.