summaryrefslogtreecommitdiff
path: root/src/T2DLL/LListener.h
blob: c4a6360e63733cdf304318c5d5d79fe8898aca7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef T2DLL_LLISTENER_H
#define T2DLL_LLISTENER_H
#include "../common.h"
#include "LArray.h"

class AFX_CLASS_EXPORT LListener {
public:
	LListener();
	LListener(const LListener& other);
	virtual ~LListener();

	void StartListening() { mListening = true; }
	void StopListening() { mListening = false; }
	BOOL IsListening() const { return mListening; }
	virtual void ListenToMessage(unsigned int msg, void* data) {}

protected:
	friend class LBroadcaster;
	void AddBroadcaster(LBroadcaster* broadcaster);
	void RemoveBroadcaster(LBroadcaster* broadcaster);

private:
	LArray mBroadcasters;
	BOOL mListening;
};
#endif