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.

97 lines
2.1 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. statbar.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #ifndef _STATBAR_H_
  9. #define _STATBAR_H_
  10. #define SZ_HRTIME_FORMAT TEXT("%1d%s%02d%s%02d")
  11. #define SZ_MINTIME_FORMAT TEXT("%1d%s%02d")
  12. #define SZ_DAYTIME_FORMAT TEXT("%1dD %1d%s%02d")
  13. #define E_MEDIUM_VALUE 999999.999
  14. #define E_LARGE_VALUE 9999999999.0
  15. #define E_TOO_LARGE_VALUE 1.0E+20
  16. #define SZ_VALUE_TOO_HIGH TEXT("+ + + +")
  17. #define SZ_VALUE_TOO_LOW TEXT("- - - -")
  18. #define LABEL_MARGIN 12
  19. #define VALUE_MARGIN 4
  20. #define RECT_BORDER 1
  21. #define LINE_SPACING (2 * RECT_BORDER + 4)
  22. #define STAT_LAST 0
  23. #define STAT_AVG 1
  24. #define STAT_MIN 2
  25. #define STAT_MAX 3
  26. #define STAT_TIME 4
  27. #define STAT_ITEM_CNT 5
  28. // Structure for one item
  29. typedef struct _STAT_ITEM {
  30. INT xPos ;
  31. INT yPos ;
  32. INT xLabelWidth;
  33. double dNewValue;
  34. double dValue ;
  35. INT iInitialized ;
  36. DWORD dwCounterType;
  37. } STAT_ITEM, *PSTAT_ITEM ;
  38. class CSysmonControl;
  39. class CGraphItem;
  40. class CStatsBar
  41. {
  42. private:
  43. enum eStatFormat {
  44. eMinimumWidth = 10,
  45. eSmallPrecision = 3,
  46. eMediumPrecision = 0,
  47. eLargePrecision = 4,
  48. eIntegerPrecision = 0
  49. };
  50. void DrawValues (HDC hDC, BOOL bForce);
  51. CSysmonControl *m_pCtrl;
  52. STAT_ITEM m_StatItem[STAT_ITEM_CNT];
  53. RECT m_Rect;
  54. INT m_iFontHeight;
  55. INT m_iValueWidth;
  56. PCGraphItem m_pGraphItemToInit;
  57. public:
  58. CStatsBar (void);
  59. ~CStatsBar (void);
  60. BOOL Init (CSysmonControl *pCtrl, HWND hWnd);
  61. void SizeComponents(LPRECT pRect);
  62. void SetTimeSpan(double dSeconds);
  63. INT Height (INT iMaxHeight, INT iMaxWidth);
  64. void ChangeFont(HDC hDC);
  65. void Draw (HDC hDC, HDC hAttribDC, PRECT prcUpdate);
  66. void Update(HDC hDC, CGraphItem* pGraphItem);
  67. void Clear( void );
  68. void GetUpdateRect( PRECT pRect ) { *pRect = m_Rect; }
  69. };
  70. typedef CStatsBar *PSTATSBAR;
  71. #endif // _STATBAR_H_