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.

103 lines
5.0 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: TurnOffDialog.h
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // Class that implements presentation of the Turn Off Computer dialog.
  7. //
  8. // History: 2000-04-18 vtan created
  9. // 2000-05-17 vtan updated with new dialog
  10. // --------------------------------------------------------------------------
  11. #ifndef _TurnOffDialog_
  12. #define _TurnOffDialog_
  13. #include "Tooltip.h"
  14. // --------------------------------------------------------------------------
  15. // CTurnOffDialog::CTurnOffDialog
  16. //
  17. // Purpose: Implements the "Turn Off Dialog" feature.
  18. //
  19. // History: 2000-04-18 vtan created
  20. // 2000-05-17 vtan updated with new dialog
  21. // 2001-01-19 vtan updated with more new visuals
  22. // --------------------------------------------------------------------------
  23. class CTurnOffDialog
  24. {
  25. private:
  26. enum
  27. {
  28. BUTTON_STATE_REST = 0,
  29. BUTTON_STATE_DOWN,
  30. BUTTON_STATE_HOVER,
  31. BUTTON_STATE_MAX,
  32. BUTTON_GROUP_TURNOFF = 0,
  33. BUTTON_GROUP_STANDBY,
  34. BUTTON_GROUP_RESTART,
  35. BUTTON_GROUP_MAX
  36. };
  37. static const int MAGIC_NUMBER = 48517;
  38. private:
  39. CTurnOffDialog (void);
  40. CTurnOffDialog (const CTurnOffDialog& copyObject);
  41. const CTurnOffDialog& operator = (const CTurnOffDialog& assignObject);
  42. public:
  43. CTurnOffDialog (HINSTANCE hInstance);
  44. ~CTurnOffDialog (void);
  45. DWORD Show (HWND hwndParent);
  46. void Destroy (void);
  47. static DWORD ShellCodeToGinaCode (DWORD dwShellCode);
  48. static DWORD GinaCodeToExitWindowsFlags (DWORD dwGinaCode);
  49. private:
  50. bool IsShiftKeyDown (void) const;
  51. void PaintBitmap (HDC hdcDestination, const RECT *prcDestination, HBITMAP hbmSource, const RECT *prcSource);
  52. bool IsStandByButtonEnabled (void) const;
  53. void RemoveTooltip (void);
  54. void FilterMetaCharacters (TCHAR *pszText);
  55. void EndDialog (HWND hwnd, INT_PTR iResult);
  56. void Handle_BN_CLICKED (HWND hwnd, WORD wID);
  57. void Handle_WM_INITDIALOG (HWND hwnd);
  58. void Handle_WM_DESTROY (HWND hwnd);
  59. void Handle_WM_ERASEBKGND (HWND hwnd, HDC hdcErase);
  60. void Handle_WM_PRINTCLIENT (HWND hwnd, HDC hdcPrint, DWORD dwOptions);
  61. void Handle_WM_ACTIVATE (HWND hwnd, DWORD dwState);
  62. void Handle_WM_DRAWITEM (HWND hwnd, const DRAWITEMSTRUCT *pDIS);
  63. void Handle_WM_COMMAND (HWND hwnd, WPARAM wParam);
  64. void Handle_WM_TIMER (HWND hwnd);
  65. void Handle_WM_MOUSEMOVE (HWND hwnd, UINT uiID);
  66. void Handle_WM_MOUSEHOVER (HWND hwnd, UINT uiID);
  67. void Handle_WM_MOUSELEAVE (HWND hwnd);
  68. static INT_PTR CALLBACK CB_DialogProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  69. static LRESULT CALLBACK ButtonSubClassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uiID, DWORD_PTR dwRefData);
  70. private:
  71. const HINSTANCE _hInstance;
  72. HBITMAP _hbmBackground;
  73. HBITMAP _hbmFlag;
  74. HBITMAP _hbmButtons;
  75. HFONT _hfntTitle;
  76. HFONT _hfntButton;
  77. HPALETTE _hpltShell;
  78. RECT _rcBackground;
  79. RECT _rcFlag;
  80. RECT _rcButtons;
  81. LONG _lButtonHeight;
  82. HWND _hwndDialog;
  83. INT_PTR _iStandByButtonResult;
  84. UINT _uiHoverID;
  85. UINT _uiFocusID;
  86. UINT _uiTimerID;
  87. bool _fSuccessfulInitialization;
  88. bool _fSupportsStandBy;
  89. bool _fSupportsHibernate;
  90. bool _fShiftKeyDown;
  91. bool _fDialogEnded;
  92. CTooltip* _pTooltip;
  93. };
  94. #endif /* _TurnOffDialog_ */