diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/public/vgui_controls/GraphPanel.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/public/vgui_controls/GraphPanel.h')
| -rw-r--r-- | mp/src/public/vgui_controls/GraphPanel.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/mp/src/public/vgui_controls/GraphPanel.h b/mp/src/public/vgui_controls/GraphPanel.h new file mode 100644 index 00000000..fbb1dc3e --- /dev/null +++ b/mp/src/public/vgui_controls/GraphPanel.h @@ -0,0 +1,81 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#ifndef GRAPHPANEL_H
+#define GRAPHPANEL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/Panel.h>
+#include "utllinkedlist.h"
+#include "utlvector.h"
+
+namespace vgui
+{
+
+//-----------------------------------------------------------------------------
+// Purpose: Holds and displays a chart
+//-----------------------------------------------------------------------------
+class GraphPanel : public Panel
+{
+ DECLARE_CLASS_SIMPLE( GraphPanel, Panel );
+
+public:
+ GraphPanel(Panel *parent, const char *name);
+
+ // domain settings (x-axis settings)
+ // sets the window of samples to display
+ void SetDisplayDomainSize(float size);
+ // sets the range of samples the graph should keep
+ // should be set to the max you would set the display domain size
+ void SetMaxDomainSize(float size);
+ // sets the minimum domain that will be displayed; used to collapse samples
+ void SetMinDomainSize(float size);
+
+ // range settings (y-axis settings)
+ void SetUseFixedRange(float lowRange, float highRange);
+ void SetUseDynamicRange(float *rangeList, int numRanges);
+ void GetDisplayedRange(float &lowRange, float &highRange);
+
+ // adds an item to the end of the list
+ // sampleEnd is assumed to be the trailing edge of the sample
+ // assumes that the samples are fairly evenly spaced (not much more work to do to fix this though)
+ void AddItem(float sampleEnd, float sampleValue);
+
+protected:
+ virtual void Paint();
+ virtual void PerformLayout();
+ virtual void ApplySchemeSettings(IScheme *pScheme);
+
+private:
+ int GetVisibleItemCount();
+
+ struct Sample_t
+ {
+ float sampleEnd;
+ float value;
+ };
+ CUtlLinkedList<Sample_t, int> m_Samples;
+
+ // the window to show
+ float m_flDomainSize;
+ float m_flMaxDomainSize, m_flMinDomainSize;
+ bool m_bMaxDomainSizeSet;
+
+ // range
+ float m_flLowRange, m_flHighRange;
+ bool m_bUseDynamicRange;
+ CUtlVector<float> m_RangeList;
+
+ // rendering
+ int m_iGraphBarWidth;
+ int m_iGraphBarGapWidth;
+};
+
+} // namespace vgui
+
+#endif // GRAPHPANEL_H
|