31 : broadcaster (const_cast<ActionBroadcaster*> (ab)),
32 message (messageText),
36 void messageCallback()
override 38 if (
auto b = broadcaster.get())
39 if (b->actionListeners.contains (listener))
55 JUCE_ASSERT_MESSAGE_MANAGER_EXISTS
61 JUCE_ASSERT_MESSAGE_MANAGER_EXISTS
68 if (listener !=
nullptr)
69 actionListeners.add (listener);
75 actionListeners.removeValue (listener);
81 actionListeners.clear();
88 for (
int i = actionListeners.size(); --i >= 0;)
89 (
new ActionMessage (
this, message, actionListeners.getUnchecked(i)))->post();
Interface class for delivery of events that are sent by an ActionBroadcaster.
virtual void actionListenerCallback(const String &message)=0
Overridden by your subclass to receive the callback.
ActionBroadcaster()
Creates an ActionBroadcaster.
void sendActionMessage(const String &message) const
Broadcasts a message to all the registered listeners.
void addActionListener(ActionListener *listener)
Adds a listener to the list.
void removeActionListener(ActionListener *listener)
Removes a listener from the list.
virtual ~ActionBroadcaster()
Destructor.
This class acts as a pointer which will automatically become null if the object to which it points is...
Automatically locks and unlocks a mutex object.
void removeAllActionListeners()
Removes all listeners from the list.
Manages a list of ActionListeners, and can send them messages.
Internal class used as the base class for all message objects.