A message that calls a custom function when it gets delivered. More...
Inherits Message.
Public Member Functions | |
| CallbackMessage () noexcept | |
| ~CallbackMessage () | |
| Destructor. | |
| virtual void | messageCallback ()=0 |
| Called when the message is delivered. | |
| void | post () |
| Instead of sending this message to a MessageListener, just call this method to post it to the event queue. | |
A message that calls a custom function when it gets delivered.
You can use this class to fire off actions that you want to be performed later on the message thread.
Unlike other Message objects, these don't get sent to a MessageListener, you just call the post() method to send them, and when they arrive, your messageCallback() method will automatically be invoked.
Always create an instance of a CallbackMessage on the heap, as it will be deleted automatically after the message has been delivered.
| CallbackMessage::CallbackMessage | ( | ) |
| CallbackMessage::~CallbackMessage | ( | ) |
Destructor.
| virtual void CallbackMessage::messageCallback | ( | ) | [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.
| void CallbackMessage::post | ( | ) |
Instead of sending this message to a MessageListener, just call this method to post it to the event queue.
After you've called this, this object will belong to the MessageManager, which will delete it later. So make sure you don't delete the object yourself, call post() more than once, or call post() on a stack-based obect!