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.

112 lines
4.6 KiB

  1. #pragma once
  2. #include "util.h"
  3. #define WINDOW_CLASS TEXT("_WindowsUpgradeAdvisor_")
  4. class CDlgApp
  5. {
  6. private:
  7. HINSTANCE m_hInstance; // application instance
  8. HWND m_hwnd; // window handle
  9. HFONT m_hfontTitle;
  10. HFONT m_hfontHeader;
  11. HFONT m_hfontMenu;
  12. HFONT m_hfontText;
  13. HBRUSH m_hbrPanel;
  14. HBRUSH m_hbrCenter;
  15. COLORREF m_crTitleText;
  16. COLORREF m_crHeaderText;
  17. COLORREF m_crShadow;
  18. COLORREF m_crNormalText;
  19. COLORREF m_crCenterPanel; // Color of the center panel - only used for background colors behind text
  20. COLORREF m_crBottomPanel; // Color of the bottom panel - only used for background colors behind text
  21. HCURSOR m_hcurHand;
  22. int m_cxClient; // width of the client area (changes on maximize / restore)
  23. int m_cyClient; // height of the client area (changes on maximize / restore)
  24. int m_cxTopPanel; // height of the top band of color
  25. int m_cyBottomPanel; // height of the bottom band of color
  26. int m_cTitleFontHeight;
  27. int m_cHeaderFontHeight;
  28. int m_cMenuFontHeight;
  29. int m_cTextFontHeight;
  30. HDC m_hdcFlag;
  31. HDC m_hdcFlagRTL;
  32. HDC m_hdcGradientTop;
  33. HDC m_hdcGradientTop256;
  34. HDC m_hdcGradientBottom;
  35. HDC m_hdcGradientBottom256;
  36. HDC m_rghdcArrows[2][6][2]; // {hicolor x locolor} x {back, next, finish, cancel, radio-on, radio-off} x {normal, hover}
  37. BOOL m_f8by6; // true if we're 800x600, false if we're 640x480
  38. DWORD m_dwScreen; // screen we're on
  39. BOOL m_fHighContrast; // true if high contrast options should be used
  40. BOOL m_fLowColor; // true if we are in 256 or less color mode.
  41. HPALETTE m_hpal; // palette to use if in palette mode
  42. int m_iColors; // -1, 16, or 256 depending on the color mode we are in.
  43. int m_cDesktopWidth; // width of desktop at app initialization
  44. int m_cDesktopHeight; // height of desktop at app initialization
  45. int m_iSelectedItem; // the index of the selected menu
  46. BOOL m_fDynamicUpdate; // does user want to connect to the internet?
  47. public:
  48. CDlgApp();
  49. ~CDlgApp();
  50. void Register(HINSTANCE hInstance);
  51. BOOL InitializeData(LPSTR pszCmdLine);
  52. void Create(int nCmdShow);
  53. void MessageLoop();
  54. private:
  55. static LRESULT CALLBACK s_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  56. static LRESULT CALLBACK s_ButtonWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  57. static LRESULT CALLBACK s_WaitWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  58. // Window Messages
  59. LRESULT OnCreate(HWND hwnd);
  60. LRESULT OnDestroy();
  61. LRESULT OnActivate(WPARAM wParam);
  62. LRESULT OnPaint(HDC hdc);
  63. LRESULT OnEraseBkgnd(HDC hdc);
  64. LRESULT OnLButtonUp(int x, int y, DWORD fwKeys);
  65. LRESULT OnMouseMove(int x, int y, DWORD fwKeys);
  66. LRESULT OnSetCursor(HWND hwnd, int nHittest, int wMouseMsg);
  67. LRESULT OnCommand(int wID);
  68. LRESULT OnQueryNewPalette();
  69. LRESULT OnPaletteChanged(HWND hwnd);
  70. LRESULT OnDrawItem(UINT iCtlID, LPDRAWITEMSTRUCT pdis);
  71. LRESULT OnChangeScreen(DWORD dwScreen);
  72. LRESULT OnLaunchApp();
  73. LRESULT OnNextButton();
  74. // helper functions
  75. void _InvalidateRectIntl(HWND hwnd, RECT* pRect, BOOL fBackgroundClear);
  76. BOOL _SetColorTable();
  77. BOOL _CreateFonts(HDC hdc);
  78. BOOL _CreateBitmaps();
  79. BOOL _CreateArrowBitmaps();
  80. BOOL _CreateGradientBitmaps();
  81. void _DrawText(HDC hdc);
  82. void _PaintFlagBitmap();
  83. BOOL _AdjustIconPlacement();
  84. BOOL _GetButtonIntersect(int x, int y, UINT* pidMenuItem);
  85. UINT _StringWidth(HDC hdc, UINT idString, INT iLogPixelSx);
  86. UINT _StringHeight(HDC hdc, UINT idString, INT iLogPixelSx);
  87. BOOL _AdjustToFitFonts();
  88. BOOL _DrawMenuIcon(HWND hwnd);
  89. BOOL _DrawMenuIcons(BOOL fEraseBackground);
  90. void _CreateMenu();
  91. void _RedrawMenu();
  92. };