Expose private method setToggleState(bool, clickNotification, stateNotification) from Button

Hello!

So, I often find myself in the given scenario:

  • I have a juce::Button that I want to programmatically change its state
  • This change in state must update the UI and listeners, therefore I’m obligated to send notifications, by calling setToggleState(state, juce::NotificationType::sendNotification)
  • On the other hand, this button has a onClick method that I do not want to be called, because it should be called only when, well, the user clicks the button. But when sending notifications, the onClick and all click notifications/methods gets called anyway. That’s because the notificationType from setToggleState() is for both the click and the state notifications.

It seems that Button already has a method that separates those 2 notifications: setToggleState(bool, clickNotification, stateNotification), and that’s exactly what I’m looking for, but it is private.

Are there any reasons this method is private and we should avoid using it on the scenario above? If not, I’d suggest to make it public because right now I have to do some fancy workaround to avoid the clicks being called.

Thanks!