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