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.

135 lines
3.7 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. legend.h
  5. Abstract:
  6. Header file for the legend control.
  7. --*/
  8. #ifndef _LEGEND_H_
  9. #define _LEGEND_H_
  10. #include <commctrl.h>
  11. #include "toolbar.h" // include here to define _WIN32_IE
  12. #define iLabelLen 30
  13. #define iLegendNumCols 7
  14. #define LEGEND_DATA_VERSION 2
  15. class CSysmonControl;
  16. typedef struct LEGENDCOLSTRUCT {
  17. INT32 xWidth ;
  18. INT32 xPos ;
  19. INT32 iOrientation ;
  20. } LEGENDCOL ;
  21. typedef LEGENDCOL *PLEGENDCOL ;
  22. typedef struct {
  23. INT32 xColWidth[iLegendNumCols];
  24. INT32 iSortCol;
  25. INT32 iSortDir;
  26. } LEGEND_DATA;
  27. class CLegend
  28. {
  29. friend LRESULT APIENTRY GraphLegendWndProc (HWND hWnd,
  30. UINT uiMsg,
  31. WPARAM wParam,
  32. LPARAM lParam);
  33. friend LRESULT APIENTRY HdrWndProc (HWND hWnd,
  34. UINT uiMsg,
  35. WPARAM wParam,
  36. LPARAM lParam);
  37. private:
  38. CSysmonControl *m_pCtrl;
  39. HWND m_hWnd;
  40. RECT m_Rect;
  41. HWND m_hWndItems ;
  42. HWND m_hWndHeader ;
  43. WNDPROC m_DefaultWndProc;
  44. HFONT m_hFontItems ;
  45. HFONT m_hFontLabels ;
  46. INT m_xMinWidth ;
  47. INT m_yHeaderHeight ;
  48. INT m_yItemHeight ;
  49. INT m_iNumItemsVisible ;
  50. INT m_xEllipses;
  51. INT m_iSortCol;
  52. INT m_iSortDir;
  53. BOOL m_fLoaded;
  54. LEGENDCOL m_aCols [iLegendNumCols] ;
  55. DOUBLE* m_parrColWidthFraction ;
  56. class CGraphItem *m_pCurrentItem ;
  57. BOOL m_fMetafile;
  58. void DrawLabels ( HDC hDC ) ;
  59. void DrawColorCol ( PCGraphItem pItem, INT iCol, HDC hDC, HDC hAttribDC, INT yPos) ;
  60. void DrawCol ( INT iCol, HDC hDC, HDC hAttribDC, INT yPos, LPCTSTR lpszValue) ;
  61. void DrawItem ( PCGraphItem pItem, INT yPos, HDC hDC, HDC hAttribDC) ;
  62. void DrawColHeader (
  63. INT iCol,
  64. HDC hDC,
  65. HDC hAttribDC,
  66. RECT& rRect,
  67. BOOL bItemState ) ;
  68. void DrawHeader ( HDC hDC, HDC hAttribDC, RECT& rRect ) ;
  69. void OnPaint ( void );
  70. void OnDrawItem ( LPDRAWITEMSTRUCT lpDI ) ;
  71. void OnDrawHeader ( LPDRAWITEMSTRUCT lpDI ) ;
  72. void OnMeasureItem ( LPMEASUREITEMSTRUCT lpMI ) ;
  73. void OnDblClick ( void ) ;
  74. void OnSelectionChanged ( void ) ;
  75. void OnColumnWidthChanged ( HD_NOTIFY *phdn );
  76. void OnColumnClicked( HD_NOTIFY *phdn );
  77. void AdjustColumnWidths ( INT iCol = 0 );
  78. INT GetItemIndex ( PCGraphItem pItem ) ;
  79. LPCTSTR GetSortKey ( PCGraphItem pItem ) ;
  80. HRESULT GetNextValue ( TCHAR*& pszNext, DOUBLE& rdValue );
  81. public:
  82. CLegend ( void );
  83. ~CLegend ( void );
  84. HRESULT LoadFromStream ( LPSTREAM pIStream );
  85. HRESULT SaveToStream ( LPSTREAM pIStream );
  86. HRESULT SaveToPropertyBag ( IPropertyBag*, BOOL fClearDirty, BOOL fSaveAllProps );
  87. HRESULT LoadFromPropertyBag ( IPropertyBag*, IErrorLog* );
  88. void Render ( HDC hDC, HDC hAttribDC, BOOL fMetafile, BOOL fEntire, LPRECT pRect );
  89. void ChangeFont ( HDC hDC );
  90. BOOL Init ( CSysmonControl *pCtrl, HWND hWndParent ) ;
  91. INT MinHeight ( INT yMaxHeight ) ;
  92. INT Height ( INT yMaxHeight ) ;
  93. INT MinWidth ( void ) ;
  94. void SizeComponents ( LPRECT pRect);
  95. BOOL AddItem ( PCGraphItem pItem ) ;
  96. void DeleteItem ( PCGraphItem pItem ) ;
  97. BOOL SelectItem ( PCGraphItem pItem );
  98. void Clear ( void ) ;
  99. PCGraphItem CurrentItem ( void ) ;
  100. HWND Window ( void ) ;
  101. };
  102. typedef CLegend *PLEGEND;
  103. #endif