AxibugEmuOnline/virtuanessrc097-master/Wnd.h

205 lines
12 KiB
C
Raw Normal View History

<EFBFBD><EFBFBD>//
// x0j0a0<EFBFBD>0S0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//
// <EFBFBD>}bW0j0D0h0asTL0!qD0^^;
//
#ifndef __CWND_INCLUDED__
#define __CWND_INCLUDED__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string>
#include <list>
using namespace std;
// prototype
class CWnd;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>N<EFBFBD>0<EFBFBD>QtY0<EFBFBD>0<EFBFBD>pn0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
class CWndList
{
public:
CWndList();
~CWndList();
static void Add( CWnd* pWnd ); // <EFBFBD>0<EFBFBD>0<EFBFBD>0k0<EFBFBD>RH0<EFBFBD>0
static void Del( CWnd* pWnd ); // <EFBFBD>0<EFBFBD>0<EFBFBD>0K0<EFBFBD>0JRd<EFBFBD>Y0<EFBFBD>0
static BOOL IsDialogMessage( LPMSG msg );
protected:
private:
static list<CWnd*> m_WndPtrList;
};
// nf<EFBFBD>n0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
class CWnd
{
public:
CWnd();
virtual ~CWnd();
HWND m_hWnd;
HMENU m_hMenu;
// Override
virtual BOOL Create( HWND hWndParent ) { return FALSE; };
virtual void Destroy() {};
// Override for ModalDialog
virtual INT DoModal( HWND hWndParent ) { return 0; }
// For message filtering
virtual BOOL PreTranslateMessage( MSG* pMsg ) { return FALSE; }
protected:
void SetThis();
// Static
static LRESULT CALLBACK g_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
static BOOL CALLBACK g_DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
// Override
virtual LRESULT DispatchWnd( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{ return ::DefWindowProc( hWnd, msg, wParam, lParam ); }
virtual BOOL DispatchDlg( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{ return FALSE; }
private:
};
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0(u
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>[<EFBFBD><EFBFBD>0<EFBFBD>0<EFBFBD>0
#define WND_MESSAGE_MAP() HRESULT DispatchWnd( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
#define WNDMSG BOOL
#define WNDCMD void
#define WNDNOTIFY void
#define WNDMSGPARAM HWND hWnd, WPARAM wParam, LPARAM lParam, HRESULT& hResult
#define WNDCMDPARAM HWND hWnd, UINT uID
#define WNDNOTIFYPARAM HWND hWnd, UINT uID, NMHDR* pNMHDR, LRESULT& hResult
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
#define WND_MESSAGE_BEGIN(cls) \
HRESULT cls::DispatchWnd( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {\
HRESULT hResult = 0L;\
switch( msg ) {
#define WND_ON_MESSAGE(msg,fnc) \
case (msg): {\
if( fnc( hWnd, wParam, lParam, hResult ) )\
return hResult;\
}\
break;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0o0COMMAND_BEGIN() 0 COMMAND_END()n0-Nk0<EFBFBD><EFBFBD><EFBFBD>Y0<EFBFBD>0(XSj0<EFBFBD>0ifj0n0g0(^^;)
#define WND_COMMAND_BEGIN() \
case WM_COMMAND: {
#define WND_ON_COMMAND(id,fnc) \
if( LOWORD(wParam) == (id) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define WND_ON_COMMAND_RANGE(id,idend,fnc) \
if( LOWORD(wParam) >= (id) && LOWORD(wParam) <= (idend) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
// Notify commands
#define WND_ON_COMMAND_NOTIFY(id,nfy,fnc) \
if( LOWORD(wParam) == (id) && HIWORD(wParam) == (nfy) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define WND_ON_COMMAND_NOTIFY_RANGE(id,idend,nfy,fnc) \
if( LOWORD(wParam) >= (id) && LOWORD(wParam) <= (idend) && HIWORD(wParam) == (nfy) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define WND_COMMAND_END() \
return 0L; }; break;
// WM_NOTIFYo0NOTIFY_BEGIN() 0 NOTIFY_END()n0-Nk0<EFBFBD><EFBFBD><EFBFBD>Y0<EFBFBD>0(XSj0<EFBFBD>0ifj0n0g0^^;)
#define WND_NOTIFY_BEGIN() \
case WM_NOTIFY: { \
LRESULT hResult = 0L;
#define WND_ON_NOTIFY(id,msg,fnc) \
if( (UINT)wParam == (id) && ((NMHDR*)lParam)->code == (msg) ) {\
fnc( ((NMHDR*)lParam)->hwndFrom, (UINT)wParam, (NMHDR*)lParam, hResult );\
return (BOOL)hResult; }
#define WND_ON_NOTIFY_RANGE(id,idend,msg,fnc) \
if( (UINT)wParam >= (id) && (UINT)wParam <= (idend) && ((NMHDR*)lParam)->code == (msg) ) {\
fnc( ((NMHDR*)lParam)->hwndFrom, (UINT)wParam, (NMHDR*)lParam, hResult );\
return (BOOL)hResult; }
#define WND_NOTIFY_END() \
return FALSE; }; break;
#define WND_MESSAGE_END() \
default: break; }\
return ::DefWindowProc( hWnd, msg, wParam, lParam );\
}
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0(u
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>[<EFBFBD><EFBFBD>0<EFBFBD>0<EFBFBD>0
#define DLG_MESSAGE_MAP() BOOL DispatchDlg( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
#define DLGMSG BOOL
#define DLGCMD void
#define DLGNOTIFY void
#define DLGMSGPARAM HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL& bResult
#define DLGCMDPARAM HWND hWnd, UINT uID
#define DLGNOTIFYPARAM HWND hWnd, UINT uID, NMHDR* pNMHDR, LRESULT& hResult
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
#define DLG_MESSAGE_BEGIN(cls) \
BOOL cls::DispatchDlg( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {\
BOOL bResult = TRUE;\
switch( msg ) {
#define DLG_ON_MESSAGE(msg,fnc) \
case (msg): {\
if( fnc( hWnd, wParam, lParam, bResult ) )\
return bResult;\
}\
break;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0o0COMMAND_BEGIN() 0 COMMAND_END()n0-Nk0<EFBFBD><EFBFBD><EFBFBD>Y0<EFBFBD>0(XSj0<EFBFBD>0ifj0n0g0^^;)
#define DLG_COMMAND_BEGIN() \
case WM_COMMAND: {
#define DLG_ON_COMMAND(id,fnc) \
if( LOWORD(wParam) == (id) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define DLG_ON_COMMAND_RANGE(id,idend,fnc) \
if( LOWORD(wParam) >= (id) && LOWORD(wParam) <= (idend) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
// Notify commands
#define DLG_ON_COMMAND_NOTIFY(id,nfy,fnc) \
if( LOWORD(wParam) == (id) && HIWORD(wParam) == (nfy) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define DLG_ON_COMMAND_NOTIFY_RANGE(id,idend,nfy,fnc) \
if( LOWORD(wParam) >= (id) && LOWORD(wParam) <= (idend) && HIWORD(wParam) == (nfy) ) \
fnc( (HWND)lParam, LOWORD(wParam) );
#define DLG_COMMAND_END() \
return FALSE; }; break;
// WM_NOTIFYo0NOTIFY_BEGIN() 0 NOTIFY_END()n0-Nk0<EFBFBD><EFBFBD><EFBFBD>Y0<EFBFBD>0(XSj0<EFBFBD>0ifj0n0g0^^;)
#define DLG_NOTIFY_BEGIN() \
case WM_NOTIFY: { \
LRESULT hResult = 0L;
#define DLG_ON_NOTIFY(id,msg,fnc) \
if( (UINT)wParam == (id) && ((NMHDR*)lParam)->code == (msg) ) {\
fnc( ((NMHDR*)lParam)->hwndFrom, (UINT)wParam, (NMHDR*)lParam, hResult );\
return (BOOL)hResult; }
#define DLG_ON_NOTIFY_RANGE(id,idend,msg,fnc) \
if( (UINT)wParam >= (id) && (UINT)wParam <= (idend) && ((NMHDR*)lParam)->code == (msg) ) {\
fnc( ((NMHDR*)lParam)->hwndFrom, (UINT)wParam, (NMHDR*)lParam, hResult );\
return (BOOL)hResult; }
#define DLG_NOTIFY_END() \
return FALSE; }; break;
#define DLG_MESSAGE_END() \
default: break; }\
return FALSE;\
}
//
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>Q<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//
#define BTNCHECK(ctrlid,check) ::CheckDlgButton(m_hWnd,(ctrlid),(check)?BST_CHECKED:BST_UNCHECKED)
#define IsBTNCHECK(ctrlid) ((::IsDlgButtonChecked(m_hWnd,(ctrlid))==BST_CHECKED)?TRUE:FALSE)
#define CTRLENABLE(ctrlid,enable) ::EnableWindow(::GetDlgItem(m_hWnd,(ctrlid)),enable);
#endif // !__CWND_INCLUDED__