Loading...
Searching...
No Matches
juce::CallbackMessage Class Referenceabstract

`#include <juce_CallbackMessage.h>`

Inheritance diagram for juce::CallbackMessage:

## Public Member Functions

| ~CallbackMessage () override=default
void | messageCallback () override=0
Public Member Functions inherited from juce::MessageManager::MessageBase
bool | post ()
Public Member Functions inherited from juce::ReferenceCountedObject
void | incReferenceCount () noexcept
void | decReferenceCount () noexcept
bool | decReferenceCountWithoutDeleting () noexcept
int | getReferenceCount () const noexcept

## Additional Inherited Members

Public Types inherited from juce::MessageManager::MessageBase
using | Ptr = ReferenceCountedObjectPtr<MessageBase>
Protected Member Functions inherited from juce::ReferenceCountedObject
| ReferenceCountedObject ()=default
| ReferenceCountedObject (const ReferenceCountedObject &) noexcept
| ReferenceCountedObject (ReferenceCountedObject &&) noexcept
ReferenceCountedObject & | operator= (const ReferenceCountedObject &) noexcept
ReferenceCountedObject & | operator= (ReferenceCountedObject &&) noexcept
virtual | ~ReferenceCountedObject ()
void | resetReferenceCount () noexcept

## Detailed Description

A message that invokes a callback method when it gets delivered.

You can use this class to fire off actions that you want to be performed later on the message thread.

To use it, create a subclass of CallbackMessage which implements the messageCallback() method, then call post() to dispatch it. The event thread will then invoke your messageCallback() method later on, and will automatically delete the message object afterwards.

Always create a new instance of a CallbackMessage on the heap, as it will be deleted automatically after the message has been delivered.

Note that this class was essential back in the days before C++11, but in modern times you may prefer to use MessageManager::callAsync() with a lambda.

See also
  MessageManager::callAsync, MessageListener, ActionListener, ChangeListener

Definition at line 48 of file juce_CallbackMessage.h.

## Constructor & Destructor Documentation

## ~CallbackMessage()

juce::CallbackMessage::~CallbackMessage | ( |  | ) |

override default

Destructor.

## Member Function Documentation

## messageCallback()

void juce::CallbackMessage::messageCallback | ( |  | ) |

override pure virtual

Called when the message is delivered.

You should implement this method and make it do whatever action you want to perform.

Note that like all other messages, this object will be deleted immediately after this method has been invoked.

Implements juce::MessageManager::MessageBase.

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

- juce_CallbackMessage.h