forked from valve/halflife-sdk
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
|
/***
|
||
|
*
|
||
|
* WastedFX Tool chain
|
||
|
*
|
||
|
* Author: Joshua Coyne
|
||
|
* Copyright (C) 2003 The Wastes Project, All Rights Reserved.
|
||
|
*
|
||
|
***/
|
||
|
#if !defined( __WINDOW_H_ )
|
||
|
#define __WINDOW_H_
|
||
|
|
||
|
// Error codes
|
||
|
enum error_codes_e {
|
||
|
ERR_ALERT,
|
||
|
ERR_INFO,
|
||
|
ERR_FATAL,
|
||
|
};
|
||
|
|
||
|
// Base window class
|
||
|
class CWindow
|
||
|
{
|
||
|
public:
|
||
|
CWindow( char *pszClassname, HINSTANCE hInstance );
|
||
|
virtual ~CWindow();
|
||
|
|
||
|
virtual void Update();
|
||
|
|
||
|
BOOL RegisterWindow( int style, void *WndProc,
|
||
|
HICON hIcon, HICON hIconSm,
|
||
|
HCURSOR hCursor,
|
||
|
HBRUSH hBrush,
|
||
|
HMENU hMenu );
|
||
|
|
||
|
BOOL InstanceWindow( char *pszTitle, int style, HWND hWndParent,
|
||
|
int x, int y, int w, int h );
|
||
|
|
||
|
static void Error( CWindow *pWindow, char *pszCaption, char *pszMsg, int iErrMode );
|
||
|
|
||
|
char *m_pszClassname;
|
||
|
HWND m_hWnd;
|
||
|
HWND m_hWndParent;
|
||
|
HMENU m_hMenu;
|
||
|
HINSTANCE m_hInstance;
|
||
|
};
|
||
|
|
||
|
// Support functions
|
||
|
template<class T> T *GetClassFromUserData( HWND hWnd )
|
||
|
{
|
||
|
T *pRet = (T*)(GetWindowLong( hWnd, GWL_USERDATA ));
|
||
|
|
||
|
// if( pRet == NULL )
|
||
|
// CWindow::Error( NULL, "GetClassFromUserData", "Unable to resolve class pointer", ERR_ALERT );
|
||
|
|
||
|
return pRet;
|
||
|
}
|
||
|
|
||
|
#endif
|