[SOLVED] How to access Graphics Context from another class indirectly?

I want this on a t-shirt.

Listener’s aren’t anything magic, they’re just base classes (or structs) that can be used to inform objects about changes in another object. Here’s a super basic example using JUCE’s ListenerList class:

class MyCoolClass
    void setValue(int newValue)
        value = newValue;
        listeners.call([this](Listener& l) {
            l.coolClassValueChanged(*this, value);

    struct Listener
        virtual ~Listener() = default;
        virtual void coolClassValueChanged(MyCoolClass&, int newValue) = 0;

    void addListener(Listener* newListener) { listeners.add(newListener); }
    void removeListener(Listener* listenerToRemove) { listeners.remove(listenerToRemove); }

    int value = 0;
    juce::ListenerList<Listener> listeners;

Here’s the juce::Slider::Listener implementation:

Thank you James!