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.

86 lines
2.3 KiB

  1. //
  2. // MyPrSht.h
  3. //
  4. #pragma once
  5. #include "CWnd.h"
  6. // Public functions
  7. //
  8. INT_PTR MyPropertySheet(LPCPROPSHEETHEADER pHeader);
  9. HPROPSHEETPAGE MyCreatePropertySheetPage(LPPROPSHEETPAGE psp);
  10. // CMyPropSheet -- used internally by MyPrSht.cpp
  11. //
  12. class CMyPropSheet : public CWnd
  13. {
  14. public:
  15. CMyPropSheet();
  16. void Release() { CWnd::Release(); };
  17. BOOL Attach(HWND hwnd) {return CWnd::Attach(hwnd); };
  18. INT_PTR DoPropSheet(LPCPROPSHEETHEADER pHeader);
  19. LPPROPSHEETPAGE GetCurrentPropSheetPage();
  20. // Message handler for WM_CTLCOLOR* messages - public so prop pages
  21. // can call it directly.
  22. HBRUSH OnCtlColor(UINT message, HDC hdc, HWND hwndControl);
  23. inline void OnSetActivePage(HWND hwnd)
  24. { m_hwndActive = hwnd; }
  25. inline HWND GetActivePage()
  26. { return m_hwndActive; }
  27. protected:
  28. ~CMyPropSheet();
  29. // Virtual function overrides
  30. LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  31. // Implementation
  32. static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
  33. void PaintHeader(HDC hdc, LPPROPSHEETPAGE ppsp);
  34. void PaintWatermark(HDC hdc, LPPROPSHEETPAGE ppsp);
  35. void InitColorSettings();
  36. void LoadBitmaps();
  37. public:
  38. void SetHeaderFonts();
  39. int ComputeHeaderHeight(int dxMax);
  40. int WriteHeaderTitle(HDC hdc, LPRECT prc, LPCTSTR pszTitle, BOOL bTitle, DWORD dwDrawFlags);
  41. protected:
  42. LPPROPSHEETHEADER m_pRealHeader;
  43. HHOOK m_hHook;
  44. HBRUSH m_hbrWindow;
  45. HBRUSH m_hbrDialog;
  46. HWND m_hwndActive;
  47. HBITMAP m_hbmWatermark;
  48. HBITMAP m_hbmHeader;
  49. HPALETTE m_hpalWatermark;
  50. HFONT m_hFontBold;
  51. int m_ySubTitle;
  52. };
  53. // Note: we can't subclass from CWnd because the wizard property pages
  54. // are already CWnd's, and we can't have 2 CWnd's for a single HWND.
  55. class CMyPropPage : public CWnd
  56. {
  57. public:
  58. void Release() { CWnd::Release(); };
  59. BOOL Attach(HWND hwnd) {return CWnd::Attach(hwnd); };
  60. static CMyPropPage* FromHandle(HWND hwnd);
  61. LPPROPSHEETPAGE GetPropSheetPage();
  62. protected:
  63. LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  64. LPPROPSHEETPAGE m_ppspOriginal;
  65. };