OpenShot Library | OpenShotAudio 0.2.2
juce_MessageListener.cpp
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26Message::Message() noexcept {}
27Message::~Message() {}
28
29void Message::messageCallback()
30{
31 if (auto* r = recipient.get())
32 r->handleMessage (*this);
33}
34
35MessageListener::MessageListener() noexcept
36{
37 // Are you trying to create a messagelistener before or after juce has been initialised??
38 JUCE_ASSERT_MESSAGE_MANAGER_EXISTS
39}
40
42{
43 masterReference.clear();
44}
45
46void MessageListener::postMessage (Message* const message) const
47{
48 message->recipient = const_cast<MessageListener*> (this);
49 message->post();
50}
51
52} // namespace juce
MessageListener subclasses can post and receive Message objects.
virtual ~MessageListener()
Destructor.
void postMessage(Message *message) const
Sends a message to the message queue, for asynchronous delivery to this listener later on.
The base class for objects that can be sent to a MessageListener.
Definition: juce_Message.h:48
Message() noexcept
Creates an uninitialised message.