|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LgWnd.h
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Header file of LgWnd.h
//----------------------------------------------------------------------------
#ifndef __LG__WND__H__INCLUDED__
#define __LG__WND__H__INCLUDED__
#if _MSC_VER > 1000
#pragma once
#endif
//------------------------------- CDC LITE ------------------------------------
class CLgWnd;
class CLgDC{public: CLgDC(); virtual ~CLgDC();
public: BOOL Attach( HDC hDC ); HDC Detach();
public: virtual BOOL CreateCompatibleDC( CLgDC* ); virtual BOOL DeleteDC();
public: HDC GetSafeHdc();
public: HDC m_hDC; enum { LGDCCM_NONE, LGDCCM_ATTACH, LGDCCM_CREATECOMPATIBLEDC, }m_nCreationMode;};
class CLgClientDC : public CLgDC{public: CLgClientDC( CLgWnd* ); virtual ~CLgClientDC();
private: CLgWnd *m_pWnd;};
class CLgPaintDC : public CLgDC{public: CLgPaintDC( CLgWnd* ); virtual ~CLgPaintDC();
private: PAINTSTRUCT m_PaintStruct; CLgWnd *m_pWnd;};
//------------------------------- CWnd LITE ------------------------------------
class CLgDC;
class CLgWnd {public: CLgWnd(); virtual ~CLgWnd();
public: operator HWND() { return m_hWnd; } HWND GetSafeHwnd() { return m_hWnd; }
public: CLgDC *GetDC(); BOOL ReleaseDC( CLgDC* );
public: virtual BOOL Create( HWND, INT, INT, INT, INT ); virtual BOOL DestroyWindow();
protected: void OnDestroy();
protected: LRESULT WindowProc( HWND, UINT, WPARAM, LPARAM );
private: static LRESULT CALLBACK WindowProc_( HWND, UINT, WPARAM, LPARAM );
private: HWND m_hWnd; CLgDC m_DC;};
#define DECLARE_MESSAGE_MAP() \
protected: \ virtual LRESULT WindowProc( HWND, UINT, WPARAM, LPARAM );
#define BEGIN_MESSAGE_MAP( CLASS, BASE_CLASS ) \
LRESULT CLASS::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) \ { \ switch( uMsg ) \ { \ default: \ return BASE_CLASS::WindowProc( hWnd, uMsg, wParam, lParam );
#define END_MESSAGE_MAP() \
} \ return DefWindowProc( hWnd, uMsg, wParam, lParam ); \ }
#define ON_WM_DESTROY() case WM_DESTROY: OnDestroy(); return 0;
#define ON_WM_SIZE() case WM_SIZE: OnSize( wParam, LOWORD(lParam), HIWORD(lParam) ); return 0;
#define ON_WM_PAINT() case WM_PAINT: OnPaint(); return 0;
#endif
|