Source code of Windows XP (NT5)
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.

241 lines
3.6 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1997.
  5. //
  6. // File: dlg.hxx
  7. //
  8. // Contents: Simple windows modeless dialog wrapper base class.
  9. //
  10. // History: 1-29-1997 DavidMun Created
  11. //
  12. //---------------------------------------------------------------------------
  13. #ifndef __DLG_HXX_
  14. #define __DLG_HXX_
  15. //+--------------------------------------------------------------------------
  16. //
  17. // Class: CDlg (dlg)
  18. //
  19. // Purpose: Abstract base class that invokes a modeless or modal dialog
  20. //
  21. // History: 4-22-1997 DavidMun Created
  22. //
  23. //---------------------------------------------------------------------------
  24. class CDlg
  25. {
  26. public:
  27. CDlg();
  28. virtual
  29. ~CDlg();
  30. static INT_PTR
  31. _DlgProc(
  32. HWND hwnd,
  33. UINT message,
  34. WPARAM wParam,
  35. LPARAM lParam);
  36. HWND
  37. GetHwnd();
  38. protected:
  39. INT_PTR
  40. _DoModalDlg(
  41. HWND hwndParent,
  42. INT idd);
  43. HWND
  44. _DoModelessDlg(
  45. HWND hwndParent,
  46. INT idd);
  47. virtual void
  48. _OnHelp(
  49. UINT message,
  50. WPARAM wParam,
  51. LPARAM lParam);
  52. virtual HRESULT
  53. _OnInit(
  54. bool *pfSetFocus);
  55. virtual bool
  56. _OnCommand(
  57. WPARAM wParam,
  58. LPARAM lParam);
  59. virtual bool
  60. _OnMinMaxInfo(
  61. LPMINMAXINFO lpmmi);
  62. virtual INT_PTR
  63. _OnStaticCtlColor(
  64. HDC hdcStatic,
  65. HWND hwndStatic);
  66. virtual bool
  67. _OnNotify(
  68. WPARAM wParam,
  69. LPARAM lParam);
  70. virtual bool
  71. _OnSize(
  72. WPARAM wParam,
  73. LPARAM lParam);
  74. virtual void
  75. _OnSysColorChange();
  76. virtual bool
  77. _OnDrawItem(
  78. WPARAM wParam,
  79. LPARAM lParam);
  80. virtual void
  81. _OnDestroy();
  82. //
  83. // Utility functions
  84. //
  85. HWND
  86. _hCtrl(
  87. ULONG iddControl);
  88. void
  89. _GetChildWindowRect(
  90. HWND hwndChild,
  91. RECT *prc);
  92. HWND m_hwnd;
  93. };
  94. //+--------------------------------------------------------------------------
  95. //
  96. // Member: CDlg::_hCtrl
  97. //
  98. // Synopsis: Return window handle of dialog control [iddControl].
  99. //
  100. // History: 12-14-1996 DavidMun Created
  101. //
  102. //---------------------------------------------------------------------------
  103. inline HWND
  104. CDlg::_hCtrl(ULONG iddControl)
  105. {
  106. HWND hwndControl = GetDlgItem(m_hwnd, iddControl);
  107. //ASSERT(IsWindow(hwndControl));
  108. return hwndControl;
  109. }
  110. //+--------------------------------------------------------------------------
  111. //
  112. // Member: CDlg::GetHwnd
  113. //
  114. // Synopsis: Return dialog handle, NULL if dialog not opened
  115. //
  116. // History: 09-18-1997 DavidMun Created
  117. //
  118. //---------------------------------------------------------------------------
  119. inline HWND
  120. CDlg::GetHwnd()
  121. {
  122. return m_hwnd;
  123. }
  124. //
  125. // Default do-nothing implementations
  126. //
  127. inline void
  128. CDlg::_OnHelp(
  129. UINT message,
  130. WPARAM wParam,
  131. LPARAM lParam)
  132. {
  133. }
  134. inline HRESULT
  135. CDlg::_OnInit(
  136. bool *pfSetFocus)
  137. {
  138. return S_OK;
  139. }
  140. inline bool
  141. CDlg::_OnCommand(
  142. WPARAM wParam,
  143. LPARAM lParam)
  144. {
  145. return true;
  146. }
  147. inline bool
  148. CDlg::_OnMinMaxInfo(
  149. LPMINMAXINFO lpmmi)
  150. {
  151. return true;
  152. }
  153. inline bool
  154. CDlg::_OnSize(
  155. WPARAM wParam,
  156. LPARAM lParam)
  157. {
  158. return true;
  159. }
  160. inline bool
  161. CDlg::_OnDrawItem(
  162. WPARAM wParam,
  163. LPARAM lParam)
  164. {
  165. return false;
  166. }
  167. inline bool
  168. CDlg::_OnNotify(
  169. WPARAM wParam,
  170. LPARAM lParam)
  171. {
  172. return false;
  173. }
  174. inline void
  175. CDlg::_OnSysColorChange()
  176. {
  177. }
  178. inline void
  179. CDlg::_OnDestroy()
  180. {
  181. }
  182. inline INT_PTR
  183. CDlg::_OnStaticCtlColor(
  184. HDC hdcStatic,
  185. HWND hwndStatic)
  186. {
  187. return FALSE;
  188. }
  189. #endif // __DLG_HXX_