JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Member Functions | List of all members
ChangeBroadcaster Class Reference
juce_events » broadcasters

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

`#include <juce_ChangeBroadcaster.h>`

Inheritance diagram for 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.

## Detailed Description

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

See also
  ChangeListener

## Constructor & Destructor Documentation

## ◆ ChangeBroadcaster()

ChangeBroadcaster::ChangeBroadcaster | ( |  | ) |
| noexcept

Creates an ChangeBroadcaster.

## ◆ ~ChangeBroadcaster()

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

Destructor.

## Member Function Documentation

## ◆ addChangeListener()

void 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.

## ◆ removeChangeListener()

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

Unregisters a listener from the list.

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

## ◆ removeAllChangeListeners()

void ChangeBroadcaster::removeAllChangeListeners | ( |  | ) |

Removes all listeners from the list.

## ◆ sendChangeMessage()

void 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().

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

## ◆ sendSynchronousChangeMessage()

void 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

Referenced by SelectedItemSet< SelectableItemType >::changed().

## ◆ dispatchPendingMessages()

void 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.

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

- juce_ChangeBroadcaster.h