Leaked source code of windows server 2003
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.

263 lines
4.1 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) const;
  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. /*
  81. virtual BOOL
  82. _OnSetFocus(
  83. HWND hwndLosingFocus);
  84. */
  85. virtual void
  86. _OnDestroy();
  87. //
  88. // Utility functions
  89. //
  90. HWND
  91. _hCtrl(
  92. ULONG iddControl) const;
  93. void
  94. _GetChildWindowRect(
  95. HWND hwndChild,
  96. RECT *prc);
  97. HWND m_hwnd;
  98. };
  99. //+--------------------------------------------------------------------------
  100. //
  101. // Member: CDlg::_hCtrl
  102. //
  103. // Synopsis: Return window handle of dialog control [iddControl].
  104. //
  105. // History: 12-14-1996 DavidMun Created
  106. //
  107. //---------------------------------------------------------------------------
  108. inline HWND
  109. CDlg::_hCtrl(ULONG iddControl) const
  110. {
  111. HWND hwndControl = GetDlgItem(m_hwnd, iddControl);
  112. //ASSERT(IsWindow(hwndControl));
  113. return hwndControl;
  114. }
  115. //+--------------------------------------------------------------------------
  116. //
  117. // Member: CDlg::GetHwnd
  118. //
  119. // Synopsis: Return dialog handle, NULL if dialog not opened
  120. //
  121. // History: 09-18-1997 DavidMun Created
  122. //
  123. //---------------------------------------------------------------------------
  124. inline HWND
  125. CDlg::GetHwnd()
  126. {
  127. return m_hwnd;
  128. }
  129. //
  130. // Default do-nothing implementations
  131. //
  132. inline void
  133. CDlg::_OnHelp(
  134. UINT message,
  135. WPARAM wParam,
  136. LPARAM lParam)
  137. {
  138. }
  139. inline HRESULT
  140. CDlg::_OnInit(
  141. BOOL *pfSetFocus)
  142. {
  143. return S_OK;
  144. }
  145. inline BOOL
  146. CDlg::_OnCommand(
  147. WPARAM wParam,
  148. LPARAM lParam)
  149. {
  150. return TRUE;
  151. }
  152. inline BOOL
  153. CDlg::_OnMinMaxInfo(
  154. LPMINMAXINFO lpmmi)
  155. {
  156. return TRUE;
  157. }
  158. inline BOOL
  159. CDlg::_OnSize(
  160. WPARAM wParam,
  161. LPARAM lParam)
  162. {
  163. return TRUE;
  164. }
  165. inline BOOL
  166. CDlg::_OnDrawItem(
  167. WPARAM wParam,
  168. LPARAM lParam)
  169. {
  170. return FALSE;
  171. }
  172. inline BOOL
  173. CDlg::_OnNotify(
  174. WPARAM wParam,
  175. LPARAM lParam)
  176. {
  177. return FALSE;
  178. }
  179. inline void
  180. CDlg::_OnSysColorChange()
  181. {
  182. }
  183. /*
  184. inline BOOL
  185. CDlg::_OnSetFocus(
  186. HWND hwndLosingFocus)
  187. {
  188. return TRUE; // not processed
  189. }
  190. */
  191. inline void
  192. CDlg::_OnDestroy()
  193. {
  194. }
  195. inline INT_PTR
  196. CDlg::_OnStaticCtlColor(
  197. HDC hdcStatic,
  198. HWND hwndStatic)
  199. {
  200. return FALSE;
  201. }
  202. #endif // __DLG_HXX_