Initial Commit
This commit is contained in:
186
common/WINMSG.HPP
Normal file
186
common/WINMSG.HPP
Normal file
@@ -0,0 +1,186 @@
|
||||
#ifndef _COMMON_WINMSG_HPP_
|
||||
#define _COMMON_WINMSG_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_POINT_HPP_
|
||||
#include <common/point.hpp>
|
||||
#endif
|
||||
|
||||
class WinMsg : private MSG
|
||||
{
|
||||
public:
|
||||
WinMsg(void);
|
||||
WinMsg(const WinMsg &someWinMsg);
|
||||
WinMsg(const MSG &someMSG);
|
||||
~WinMsg();
|
||||
WinMsg &operator=(const WinMsg &someWinMsg);
|
||||
WinMsg &operator=(const MSG &someMSG);
|
||||
WORD operator==(const WinMsg &someWinMsg)const;
|
||||
operator MSG&(void);
|
||||
HWND hwnd(void)const;
|
||||
void hwnd(HWND hwnd);
|
||||
UINT message(void)const;
|
||||
void message(UINT message);
|
||||
WPARAM wParam(void)const;
|
||||
void wParam(WPARAM wParam);
|
||||
LPARAM lParam(void)const;
|
||||
void lParam(LPARAM lParam);
|
||||
DWORD time(void)const;
|
||||
void time(DWORD time);
|
||||
Point point(void)const;
|
||||
void point(const Point &somePoint);
|
||||
private:
|
||||
void zeroInit(void);
|
||||
};
|
||||
|
||||
inline
|
||||
WinMsg::WinMsg(void)
|
||||
{
|
||||
zeroInit();
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg::WinMsg(const WinMsg &someWinMsg)
|
||||
{
|
||||
*this=someWinMsg;
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg::WinMsg(const MSG &someMSG)
|
||||
{
|
||||
*this=someMSG;
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg::~WinMsg()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg &WinMsg::operator=(const WinMsg &someWinMsg)
|
||||
{
|
||||
hwnd(someWinMsg.hwnd());
|
||||
message(someWinMsg.message());
|
||||
wParam(someWinMsg.wParam());
|
||||
lParam(someWinMsg.lParam());
|
||||
time(someWinMsg.time());
|
||||
point(someWinMsg.point());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg &WinMsg::operator=(const MSG &someMSG)
|
||||
{
|
||||
hwnd(someMSG.hwnd);
|
||||
message(someMSG.message);
|
||||
wParam(someMSG.wParam);
|
||||
lParam(someMSG.lParam);
|
||||
time(someMSG.time);
|
||||
point(Point(someMSG.pt.x,someMSG.pt.y));
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
WORD WinMsg::operator==(const WinMsg &someWinMsg)const
|
||||
{
|
||||
return (hwnd()==someWinMsg.hwnd()&&
|
||||
message()==someWinMsg.message()&&
|
||||
wParam()==someWinMsg.wParam()&&
|
||||
lParam()==someWinMsg.lParam()&&
|
||||
time()==someWinMsg.time()&&
|
||||
point()==someWinMsg.point());
|
||||
}
|
||||
|
||||
inline
|
||||
WinMsg::operator MSG&(void)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
HWND WinMsg::hwnd(void)const
|
||||
{
|
||||
return MSG::hwnd;
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::hwnd(HWND hwnd)
|
||||
{
|
||||
MSG::hwnd=hwnd;
|
||||
}
|
||||
|
||||
inline
|
||||
UINT WinMsg::message(void)const
|
||||
{
|
||||
return MSG::message;
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::message(UINT message)
|
||||
{
|
||||
MSG::message=message;
|
||||
}
|
||||
|
||||
inline
|
||||
WPARAM WinMsg::wParam(void)const
|
||||
{
|
||||
return MSG::wParam;
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::wParam(WPARAM wParam)
|
||||
{
|
||||
MSG::wParam=wParam;
|
||||
}
|
||||
|
||||
inline
|
||||
LPARAM WinMsg::lParam(void)const
|
||||
{
|
||||
return MSG::lParam;
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::lParam(LPARAM lParam)
|
||||
{
|
||||
MSG::lParam=lParam;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD WinMsg::time(void)const
|
||||
{
|
||||
return MSG::time;
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::time(DWORD time)
|
||||
{
|
||||
MSG::time=time;
|
||||
}
|
||||
|
||||
inline
|
||||
Point WinMsg::point(void)const
|
||||
{
|
||||
return Point(MSG::pt.x,MSG::pt.y);
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::point(const Point &somePoint)
|
||||
{
|
||||
MSG::pt.x=somePoint.x();
|
||||
MSG::pt.y=somePoint.y();
|
||||
}
|
||||
|
||||
inline
|
||||
void WinMsg::zeroInit(void)
|
||||
{
|
||||
MSG::hwnd=0;
|
||||
MSG::message=0;
|
||||
MSG::wParam=0;
|
||||
MSG::lParam=0;
|
||||
MSG::time=0;
|
||||
MSG::pt.x=0;
|
||||
MSG::pt.y=0;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user