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
3.7 KiB

  1. /*****************************************************************************************************************
  2. FILENAME: DiskDisp.hpp
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. */
  5. #ifndef _DISKDISP_H
  6. #define _DISKDISP_H
  7. #include "windows.h"
  8. #include "tchar.h"
  9. #define BLACK 0
  10. #define RED 1
  11. #define GREEN 2
  12. #define YELLOW 3
  13. #define BLUE 4
  14. #define PURPLE 5
  15. #define LIGHTBLUE 6
  16. #define WHITE 7
  17. #define LIGHTGRAY 8
  18. #define GRAPHIC_WELL_HEIGHT 20
  19. #define SPACER_HEIGHT 10
  20. #define INDENTED_BORDER 1
  21. #define RAISED_BORDER 2
  22. #define SystemFileColor 0
  23. #define PageFileColor 1
  24. #define FragmentColor 2
  25. #define UsedSpaceColor 3
  26. #define FreeSpaceColor 4
  27. #define DirectoryColor 5
  28. #define MftZoneFreeSpaceColor 6
  29. #define NUM_COLORS 7
  30. /*****************************************************************************************************************
  31. m_hCurrentPen - The pen selected into the DC last time DrawLine was called (used so we don't keep reselecting the same pen into the same DC).
  32. m_hCurrentBrush - The brush last selected.
  33. m_PenArray - An array of pens of different colors that we use to draw the lines.
  34. m_BrushArray - An array of brushes we also use to draw the lines.
  35. m_ColorArray - An array of colors for our lines.
  36. m_Clusters - The number of clusters on this drive.
  37. m_NumLines - How many lines we have in m_LineArray.
  38. m_LineArray - The array of bytes that store the color code for each line to display.
  39. INPUT + OUTPUT:
  40. hInstance - Passed in value for m_hInst.
  41. InClusters - Passed in value for m_Clusters.
  42. xInMax - Passed in value for m_xMax.
  43. yInMax - Passed in value for m_yMax.
  44. DiskSize - Passed in value for m_DiskMegs.
  45. cInDrive - Passed in value for cDrive.
  46. RETURN:
  47. None.
  48. */
  49. class DiskDisplay
  50. {
  51. private:
  52. RECT m_Rect; // rectangle that bounds the entire graphics area
  53. int m_NumGraphicsRows; // number of graphics wells (calculated)
  54. int m_SpacerHeight; // space between graphics wells
  55. int m_GraphicWellHeight; // calculated height of graphic wells
  56. int m_GraphicWellWidth; // width of wells (usually the rectangle width)
  57. int m_NumLines; // number of lines (stripes) in the display (includes all graphic wells)
  58. char * m_LineArray; // array of lines - stores the colors
  59. HPEN * m_PenArray; // array of pens
  60. HBRUSH * m_BrushArray; // array of brushes
  61. int * m_ColorArray; // array of colors of the lines
  62. HPEN m_hCurrentPen; // set to the current pen
  63. HBRUSH m_hCurrentBrush; // set to the current brush
  64. TCHAR m_Label[MAX_PATH * 2];
  65. BOOL m_bReadyToDraw;
  66. BOOL m_bStripeMftZone;
  67. public:
  68. DiskDisplay::DiskDisplay();
  69. ~DiskDisplay();
  70. DiskDisplay& DiskDisplay::operator=(DiskDisplay&);
  71. void SetOutputArea(RECT rect, BOOL isSingleRow=TRUE, UINT spacerHeight = SPACER_HEIGHT);
  72. void ChangeLineColor(int, int);
  73. void SetNewLineColor(int, int);
  74. void StripeMftZoneFreeSpace(BOOL);
  75. void DrawLinesInHDC(HDC);
  76. inline void DiskDisplay::DrawLine(HDC, char, int, int, int);
  77. int GetLineCount() {return m_NumLines;}
  78. void SetLineArray(char*, int);
  79. void SetReadyToDraw(BOOL);
  80. void SetDiskSize(int inClusters, int inDiskMegs);
  81. void UpdateOutputDimensions();
  82. void DeleteAllData();
  83. BOOL NoGraphicsMemory() {return (m_LineArray == NULL || m_PenArray == NULL || m_ColorArray == NULL || m_BrushArray == NULL);}
  84. void SetLabel(PTCHAR InLabel);
  85. };
  86. #endif // #define _DISKDISP_H