Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.6 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgWnd.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LgWnd.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __LG__WND__H__INCLUDED__
  15. #define __LG__WND__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. //------------------------------- CDC LITE ------------------------------------
  20. class CLgWnd;
  21. class CLgDC
  22. {
  23. public:
  24. CLgDC();
  25. virtual ~CLgDC();
  26. public:
  27. BOOL Attach( HDC hDC );
  28. HDC Detach();
  29. public:
  30. virtual BOOL CreateCompatibleDC( CLgDC* );
  31. virtual BOOL DeleteDC();
  32. public:
  33. HDC GetSafeHdc();
  34. public:
  35. HDC m_hDC;
  36. enum
  37. {
  38. LGDCCM_NONE,
  39. LGDCCM_ATTACH,
  40. LGDCCM_CREATECOMPATIBLEDC,
  41. }m_nCreationMode;
  42. };
  43. class CLgClientDC :
  44. public CLgDC
  45. {
  46. public:
  47. CLgClientDC( CLgWnd* );
  48. virtual ~CLgClientDC();
  49. private:
  50. CLgWnd *m_pWnd;
  51. };
  52. class CLgPaintDC :
  53. public CLgDC
  54. {
  55. public:
  56. CLgPaintDC( CLgWnd* );
  57. virtual ~CLgPaintDC();
  58. private:
  59. PAINTSTRUCT m_PaintStruct;
  60. CLgWnd *m_pWnd;
  61. };
  62. //------------------------------- CWnd LITE ------------------------------------
  63. class CLgDC;
  64. class CLgWnd
  65. {
  66. public:
  67. CLgWnd();
  68. virtual ~CLgWnd();
  69. public:
  70. operator HWND() { return m_hWnd; }
  71. HWND GetSafeHwnd() { return m_hWnd; }
  72. public:
  73. CLgDC *GetDC();
  74. BOOL ReleaseDC( CLgDC* );
  75. public:
  76. virtual BOOL Create( HWND, INT, INT, INT, INT );
  77. virtual BOOL DestroyWindow();
  78. protected:
  79. void OnDestroy();
  80. protected:
  81. LRESULT WindowProc( HWND, UINT, WPARAM, LPARAM );
  82. private:
  83. static LRESULT CALLBACK WindowProc_( HWND, UINT, WPARAM, LPARAM );
  84. private:
  85. HWND m_hWnd;
  86. CLgDC m_DC;
  87. };
  88. #define DECLARE_MESSAGE_MAP() \
  89. protected: \
  90. virtual LRESULT WindowProc( HWND, UINT, WPARAM, LPARAM );
  91. #define BEGIN_MESSAGE_MAP( CLASS, BASE_CLASS ) \
  92. LRESULT CLASS::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) \
  93. { \
  94. switch( uMsg ) \
  95. { \
  96. default: \
  97. return BASE_CLASS::WindowProc( hWnd, uMsg, wParam, lParam );
  98. #define END_MESSAGE_MAP() \
  99. } \
  100. return DefWindowProc( hWnd, uMsg, wParam, lParam ); \
  101. }
  102. #define ON_WM_DESTROY() case WM_DESTROY: OnDestroy(); return 0;
  103. #define ON_WM_SIZE() case WM_SIZE: OnSize( wParam, LOWORD(lParam), HIWORD(lParam) ); return 0;
  104. #define ON_WM_PAINT() case WM_PAINT: OnPaint(); return 0;
  105. #endif