Team Fortress 2 Source Code as on 22/4/2020
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.

89 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef CHANNELGRAPHPANEL_H
  7. #define CHANNELGRAPHPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/Panel.h>
  12. #include <vgui_controls/Frame.h>
  13. #include "utllinkedlist.h"
  14. #include "utlvector.h"
  15. #include "movieobjects/dmechannel.h"
  16. #include "datamodel/dmehandle.h"
  17. namespace vgui
  18. {
  19. typedef DmeTime_t (*TimeAccessor_t)();
  20. //-----------------------------------------------------------------------------
  21. // Purpose: Holds and displays a chart of dmechannel data
  22. //-----------------------------------------------------------------------------
  23. class CChannelGraphPanel : public Panel
  24. {
  25. DECLARE_CLASS_SIMPLE( CChannelGraphPanel, Panel );
  26. public:
  27. CChannelGraphPanel( Panel *parent, const char *name );
  28. void SetChannel( CDmeChannel *pChannel );
  29. // input messages
  30. virtual void OnCursorMoved( int mx, int my );
  31. virtual void OnMousePressed( MouseCode code );
  32. virtual void OnMouseReleased( MouseCode code );
  33. virtual void OnMouseWheeled( int delta );
  34. virtual void OnSizeChanged( int newWide, int newTall ); // called after the size of a panel has been changed
  35. protected:
  36. virtual void Paint();
  37. virtual void PerformLayout();
  38. virtual void ApplySchemeSettings( IScheme *pScheme );
  39. int TimeToPixel( DmeTime_t time );
  40. int ValueToPixel( float flValue );
  41. private:
  42. CDmeHandle< CDmeChannel > m_hChannel;
  43. HFont m_font;
  44. TimeAccessor_t m_timeFunc;
  45. DmeTime_t m_graphMinTime, m_graphMaxTime;
  46. float m_graphMinValue, m_graphMaxValue;
  47. int m_nMouseStartX, m_nMouseStartY;
  48. int m_nMouseLastX, m_nMouseLastY;
  49. int m_nTextBorder;
  50. int m_nGraphOriginX;
  51. int m_nGraphOriginY;
  52. float m_flTimeToPixel;
  53. float m_flValueToPixel;
  54. };
  55. //-----------------------------------------------------------------------------
  56. // CChannelGraphFrame
  57. //-----------------------------------------------------------------------------
  58. class CChannelGraphFrame : public Frame
  59. {
  60. DECLARE_CLASS_SIMPLE( CChannelGraphFrame, Frame );
  61. public:
  62. CChannelGraphFrame( Panel *parent, const char *pTitle );
  63. void SetChannel( CDmeChannel *pChannel );
  64. virtual void OnCommand( const char *cmd );
  65. virtual void PerformLayout();
  66. protected:
  67. CChannelGraphPanel *m_pChannelGraph;
  68. };
  69. } // namespace vgui
  70. #endif // CHANNELGRAPHPANEL_H