Loading...
Searching...
No Matches
juce::ChangeBroadcaster Class Reference

## Detailed Description

Holds a list of ChangeListeners, and sends messages to them when instructed.

See also
  ChangeListener

The documentation for this class was generated from the following file:

- juce_events/broadcasters/juce_ChangeBroadcaster.h

Inheritance diagram for juce::ChangeBroadcaster:

## Public Member Functions

| ChangeBroadcaster () noexcept
| Creates an ChangeBroadcaster.
virtual | ~ChangeBroadcaster ()
| Destructor.
void | addChangeListener (ChangeListener *listener)
| Registers a listener to receive change callbacks from this broadcaster.
void | removeChangeListener (ChangeListener *listener)
| Unregisters a listener from the list.
void | removeAllChangeListeners ()
| Removes all listeners from the list.
void | sendChangeMessage ()
| Causes an asynchronous change message to be sent to all the registered listeners.
void | sendSynchronousChangeMessage ()
| Sends a synchronous change message to all the registered listeners.
void | dispatchPendingMessages ()
| If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately.

## Constructors and Destructors

## ChangeBroadcaster()

juce::ChangeBroadcaster::ChangeBroadcaster | ( |  | ) |

noexcept

Creates an ChangeBroadcaster.

Referenced by dispatchPendingMessages(), juce::SelectedItemSet< SelectableItemType >::SelectedItemSet(), and ~ChangeBroadcaster().

## ~ChangeBroadcaster()

virtual juce::ChangeBroadcaster::~ChangeBroadcaster | ( |  | ) |

virtual

Destructor.

References ChangeBroadcaster().

## Member Functions

## addChangeListener()

void juce::ChangeBroadcaster::addChangeListener | ( | ChangeListener * | listener | ) |

Registers a listener to receive change callbacks from this broadcaster.

Trying to add a listener that's already on the list will have no effect.

References addChangeListener().

Referenced by addChangeListener().

## removeChangeListener()

void juce::ChangeBroadcaster::removeChangeListener | ( | ChangeListener * | listener | ) |

Unregisters a listener from the list.

If the listener isn't on the list, this won't have any effect.

References removeChangeListener().

Referenced by removeChangeListener().

## removeAllChangeListeners()

void juce::ChangeBroadcaster::removeAllChangeListeners | ( |  | ) |

Removes all listeners from the list.

References removeAllChangeListeners().

Referenced by removeAllChangeListeners().

## sendChangeMessage()

void juce::ChangeBroadcaster::sendChangeMessage | ( |  | ) |

Causes an asynchronous change message to be sent to all the registered listeners.

The message will be delivered asynchronously by the main message thread, so this method will return immediately. To call the listeners synchronously use sendSynchronousChangeMessage().

References sendChangeMessage().

Referenced by juce::SelectedItemSet< SelectableItemType >::changed(), juce::SelectedItemSet< SelectableItemType >::changed(), sendChangeMessage(), and juce::TabbedButtonBar::setCurrentTabIndex().

## sendSynchronousChangeMessage()

void juce::ChangeBroadcaster::sendSynchronousChangeMessage | ( |  | ) |

Sends a synchronous change message to all the registered listeners.

This will immediately call all the listeners that are registered. For thread-safety reasons, you must only call this method on the main message thread.

See also
  dispatchPendingMessages

References sendSynchronousChangeMessage().

Referenced by juce::SelectedItemSet< SelectableItemType >::changed(), and sendSynchronousChangeMessage().

## dispatchPendingMessages()

void juce::ChangeBroadcaster::dispatchPendingMessages | ( |  | ) |

If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately.

For thread-safety reasons, you must only call this method on the main message thread.

References ChangeBroadcaster(), and dispatchPendingMessages().

Referenced by dispatchPendingMessages().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited