sl@0
|
1 |
//------------------------------------------------------------------------------
|
sl@0
|
2 |
#ifndef EVENT_H_INCLUDED
|
sl@0
|
3 |
#define EVENT_H_INCLUDED
|
sl@0
|
4 |
//------------------------------------------------------------------------------
|
sl@0
|
5 |
#include <windows.h>
|
sl@0
|
6 |
//------------------------------------------------------------------------------
|
sl@0
|
7 |
class Event
|
sl@0
|
8 |
{
|
sl@0
|
9 |
public:
|
sl@0
|
10 |
Event();
|
sl@0
|
11 |
virtual ~Event();
|
sl@0
|
12 |
|
sl@0
|
13 |
private:
|
sl@0
|
14 |
Event(const Event& other) {}
|
sl@0
|
15 |
Event& operator=(const Event& other) { return *this; }
|
sl@0
|
16 |
|
sl@0
|
17 |
public:
|
sl@0
|
18 |
void Signal() const;
|
sl@0
|
19 |
void Reset() const;
|
sl@0
|
20 |
void Await() const;
|
sl@0
|
21 |
|
sl@0
|
22 |
private:
|
sl@0
|
23 |
HANDLE m_hEvent;
|
sl@0
|
24 |
};
|
sl@1
|
25 |
|
sl@1
|
26 |
|
sl@1
|
27 |
/**
|
sl@1
|
28 |
*/
|
sl@1
|
29 |
class WindowEvent: public Event
|
sl@1
|
30 |
{
|
sl@1
|
31 |
public:
|
sl@1
|
32 |
WindowEvent(HWND aWnd, UINT aMsg):Event(),iWnd(aWnd),iMsg(aMsg){}
|
sl@1
|
33 |
|
sl@1
|
34 |
BOOL Post(){return PostMessage(iWnd, iMsg, (WPARAM)this, (LPARAM)NULL);}
|
sl@1
|
35 |
virtual LRESULT Execute(UINT aMsg);
|
sl@1
|
36 |
virtual LRESULT DoExecute() = 0;
|
sl@1
|
37 |
|
sl@1
|
38 |
protected:
|
sl@1
|
39 |
HWND iWnd;
|
sl@1
|
40 |
UINT iMsg;
|
sl@1
|
41 |
};
|
sl@1
|
42 |
|
sl@0
|
43 |
//------------------------------------------------------------------------------
|
sl@0
|
44 |
#endif
|
sl@0
|
45 |
//------------------------------------------------------------------------------
|