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.

98 lines
3.6 KiB

  1. //////////////////////////////////////////////////////////////////////////
  2. //
  3. // dlgapp.h
  4. //
  5. // This file contains the specification of the DlgApp class.
  6. //
  7. // (C) Copyright 1997 by Microsoft Corporation. All rights reserved.
  8. //
  9. //////////////////////////////////////////////////////////////////////////
  10. #pragma once
  11. #include "autorun.h"
  12. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  13. class CDlgApp
  14. {
  15. private:
  16. HINSTANCE m_hInstance; // application instance
  17. HWND m_hwnd; // window handle
  18. CDataSource m_DataSrc; // info from ini and registry about display items
  19. HFONT m_hfontTitle; // Font used to draw the title
  20. HFONT m_hfontMenu; // Font used to draw the menu items
  21. HFONT m_hfontBody; // Font used to draw the body
  22. HBRUSH m_hbrMenuItem; // Brush used to draw background of menu items
  23. HBRUSH m_hbrMenuBorder; // Brush used to draw the dark area behind the menu items
  24. HBRUSH m_hbrRightPanel; // Brush used to draw the background of the right panel
  25. COLORREF m_crMenuText; // Color of text on non-selected menu items (ususally the same as m_crNormalText)
  26. COLORREF m_crNormalText; // Color of text in right panel body and selected menu items
  27. COLORREF m_crTitleText; // Color of the title text
  28. COLORREF m_crSelectedText; // Color of menu items that have been previouly launched.
  29. HCURSOR m_hcurHand;
  30. int m_cxClient;
  31. int m_cyClient;
  32. int m_cxLeftPanel;
  33. int m_cyBottomOfMenuItems;
  34. int m_iItems;
  35. HDC m_hdcTop; // Memory DC used for storing and painting the top image
  36. TCHAR m_szDefTitle[MAX_PATH];
  37. TCHAR m_szDefBody[1024];
  38. TCHAR m_szCheckText[MAX_PATH];
  39. bool m_bHighContrast; // true if high contrast options should be used
  40. bool m_bLowColor; // 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. struct tagBkgndInfo {
  44. HBITMAP hbm;
  45. int cx;
  46. int cy;
  47. } m_aBkgnd[4];
  48. public:
  49. CDlgApp();
  50. ~CDlgApp();
  51. void Register(HINSTANCE hInstance);
  52. bool InitializeData();
  53. void Create(int nCmdShow);
  54. void MessageLoop();
  55. private:
  56. static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  57. // Window Messages
  58. LRESULT OnCreate(HWND hwnd);
  59. LRESULT OnDestroy();
  60. LRESULT OnActivate(WPARAM wParam);
  61. LRESULT OnPaint(HDC hdc);
  62. LRESULT OnEraseBkgnd(HDC hdc);
  63. LRESULT OnLButtonDown(int x, int y, DWORD fwKeys);
  64. LRESULT OnMouseMove(int x, int y, DWORD fwKeys);
  65. LRESULT OnSetCursor(HWND hwnd, int nHittest, int wMouseMsg);
  66. LRESULT OnCommand(int wID);
  67. LRESULT OnQueryNewPalette();
  68. LRESULT OnPaletteChanged(HWND hwnd);
  69. LRESULT OnDrawItem(UINT iCtlID, LPDRAWITEMSTRUCT pdis);
  70. LRESULT _OnChangeScreen();
  71. // helper functions
  72. BOOL SetColorTable();
  73. BOOL CreateWelcomeFonts(HDC hdc);
  74. BOOL CreateBrandingBanner();
  75. BOOL LoadBkgndImages();
  76. BOOL AdjustToFitFonts();
  77. void _CreateMenu();
  78. void _DestroyMenu();
  79. };