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.

117 lines
4.9 KiB

  1. #pragma once
  2. #include "datasrc.h"
  3. #include "util.h"
  4. class CDlgApp
  5. {
  6. private:
  7. HINSTANCE m_hInstance; // application instance
  8. HWND m_hwnd; // window handle
  9. CDataSource m_DataSrc; // info from ini and registry about display items
  10. HFONT m_hfontTitle;
  11. HFONT m_hfontHeader;
  12. HFONT m_hfontMenu;
  13. HBRUSH m_hbrTopPanel;
  14. HBRUSH m_hbrCenterPanel;
  15. HBRUSH m_hbrBottomPanel;
  16. COLORREF m_crTitleText;
  17. COLORREF m_crHeaderText;
  18. COLORREF m_crShadow;
  19. COLORREF m_crDisabledText;
  20. COLORREF m_crNormalText;
  21. COLORREF m_crCenterPanel; // Color of the center panel - only used for background colors behind text
  22. COLORREF m_crBottomPanel; // Color of the bottom panel - only used for background colors behind text
  23. HCURSOR m_hcurHand;
  24. int m_cxClient; // width of the client area (changes on maximize / restore)
  25. int m_cyClient; // height of the client area (changes on maximize / restore)
  26. int m_cxTopPanel; // height of the top band of color
  27. int m_cyBottomPanel; // height of the bottom band of color
  28. int m_cTitleFontHeight;
  29. int m_cHeaderFontHeight;
  30. int m_cMenuFontHeight;
  31. HDC m_hdcFlag;
  32. HDC m_hdcHeader;
  33. HDC m_hdcHeaderSub;
  34. HDC m_hdcGradientTop;
  35. HDC m_hdcGradientTop256;
  36. HDC m_hdcGradientBottom;
  37. HDC m_hdcGradientBottom256;
  38. HDC m_hdcCloudsFlag;
  39. HDC m_hdcCloudsFlag256;
  40. HDC m_hdcCloudsFlagRTL;
  41. HDC m_hdcCloudsFlagRTL256;
  42. HDC m_rghdcArrows[2][4][3]; // {hicolor x locolor} x {yellow, red, green, blue} x {normal, hover, disabled}
  43. TCHAR m_szTitle[MAX_PATH]; // string displayed at top, usually "Welcome to Microsoft Windows"
  44. TCHAR m_szHeader[MAX_PATH]; // string displayed above menu, usually "What do you want to do?"
  45. BOOL m_f8by6; // true if we're 800x600, false if we're 640x480
  46. DWORD m_dwScreen; // screen we're on
  47. BOOL m_fHighContrast; // true if high contrast options should be used
  48. BOOL m_fLowColor; // true if we are in 256 or less color mode.
  49. HPALETTE m_hpal; // palette to use if in palette mode
  50. int m_iColors; // -1, 16, or 256 depending on the color mode we are in.
  51. int m_cDesktopWidth; // width of desktop at app initialization
  52. int m_cDesktopHeight; // height of desktop at app initialization
  53. BOOL m_fTaskRunning; // true when we have a running task open
  54. int m_iSelectedItem; // the index of the selected menu
  55. public:
  56. CDlgApp();
  57. ~CDlgApp();
  58. void Register(HINSTANCE hInstance);
  59. BOOL InitializeData(LPSTR pszCmdLine);
  60. void Create(int nCmdShow);
  61. void MessageLoop();
  62. private:
  63. static LRESULT CALLBACK s_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  64. static LRESULT CALLBACK s_ButtonWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  65. // Window Messages
  66. LRESULT OnCreate(HWND hwnd);
  67. LRESULT OnDestroy();
  68. LRESULT OnActivate(WPARAM wParam);
  69. LRESULT OnPaint(HDC hdc);
  70. LRESULT OnEraseBkgnd(HDC hdc);
  71. LRESULT OnLButtonUp(int x, int y, DWORD fwKeys);
  72. LRESULT OnMouseMove(int x, int y, DWORD fwKeys);
  73. LRESULT OnSetCursor(HWND hwnd, int nHittest, int wMouseMsg);
  74. LRESULT OnCommand(int wID);
  75. LRESULT OnQueryNewPalette();
  76. LRESULT OnPaletteChanged(HWND hwnd);
  77. LRESULT OnDrawItem(UINT iCtlID, LPDRAWITEMSTRUCT pdis);
  78. LRESULT OnChangeScreen(DWORD dwScreen);
  79. // helper functions
  80. void _InvalidateRectIntl(HWND hwnd, RECT* pRect, BOOL fBackgroundClear);
  81. BOOL _SetColorTable();
  82. BOOL _CreateFonts(HDC hdc);
  83. BOOL _CreateBitmaps();
  84. BOOL _CreateArrowBitmaps();
  85. BOOL _CreateGradientBitmaps();
  86. BOOL _GetLargestStringWidth(HDC hdc, SIZE* psize);
  87. BOOL _AdjustToFitFonts();
  88. BOOL _DrawMenuIcon(HWND hwnd);
  89. BOOL _DrawMenuIcons(BOOL fEraseBackground);
  90. void _PaintHeaderBitmap();
  91. void _CreateMenu();
  92. void _RedrawMenu();
  93. };