ChangeBroadcaster::sendNotification

Jules - how about a one-stop-shop function in ChangeBroadcaster ...

 

void ChangeBroadcaster::sendNotification(NotificationType t) {

switch (t) {

case dontSendNotification:

break;

...

 

And so on..?

cheers!

Sure, it's a good request.

But in what kind of situation would you find it useful? Having a quick look through my codebase I can't see anywhere where this'd be helpful..

I was in the middle of implemeting an image holder component which supports drag and drop and a few things.  I wanted to be able to send a change notification when an image was dropped on it.  

It looks to me like Change Broadcaster would be ideal.  I wanted the same flexibility about sending or not sending notifications when the image was updated programmatically rather than by the user.  And to make it consistent with the rest of the juce stuff that function would have saved 10 lines of code...

Many of your component classes where you implement listeners use custom listener classes and logic which is why you haven't needed it, maybe? Or perhaps I missing something and I need to think more carefully about it :)

I think maybe the reason it seems odd to me is that ChangeBroadcaster only has one job to do, which is to be a quick-and-simple way of sending messages asynchronously.. So there's not really much point in using it if you're doing something more complicated than that. TBH what you're suggesting would work equally well as a small free function that takes a ChangeBroadcaster, so that might be a better idea.