OpenShot Library | libopenshot-audio 0.2.0
juce_MessageListener.h
1
2/** @weakgroup juce_events-messages
3 * @{
4 */
5/*
6 ==============================================================================
7
8 This file is part of the JUCE library.
9 Copyright (c) 2017 - ROLI Ltd.
10
11 JUCE is an open source library subject to commercial or open-source
12 licensing.
13
14 The code included in this file is provided under the terms of the ISC license
15 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16 To use, copy, modify, and/or distribute this software for any purpose with or
17 without fee is hereby granted provided that the above copyright notice and
18 this permission notice appear in all copies.
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27namespace juce
28{
29
30//==============================================================================
31/**
32 MessageListener subclasses can post and receive Message objects.
33
34 @see Message, MessageManager, ActionListener, ChangeListener
35
36 @tags{Events}
37*/
39{
40public:
41 //==============================================================================
42 MessageListener() noexcept;
43
44 /** Destructor. */
45 virtual ~MessageListener();
46
47 //==============================================================================
48 /** This is the callback method that receives incoming messages.
49
50 This is called by the MessageManager from its dispatch loop.
51
52 @see postMessage
53 */
54 virtual void handleMessage (const Message& message) = 0;
55
56 //==============================================================================
57 /** Sends a message to the message queue, for asynchronous delivery to this listener
58 later on.
59
60 This method can be called safely by any thread.
61
62 @param message the message object to send - this will be deleted
63 automatically by the message queue, so make sure it's
64 allocated on the heap, not the stack!
65 @see handleMessage
66 */
67 void postMessage (Message* message) const;
68
69private:
71 friend class WeakReference<MessageListener>;
72};
73
74} // namespace juce
75
76/** @}*/
MessageListener subclasses can post and receive Message objects.
virtual void handleMessage(const Message &message)=0
This is the callback method that receives incoming messages.
The base class for objects that can be sent to a MessageListener.
This class is embedded inside an object to which you want to attach WeakReference pointers.
This class acts as a pointer which will automatically become null if the object to which it points is...
#define JUCE_API
This macro is added to all JUCE public class declarations.