aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vgui_controls/AnalogBar.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /mp/src/public/vgui_controls/AnalogBar.h
downloadsource-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/AnalogBar.h')
-rw-r--r--mp/src/public/vgui_controls/AnalogBar.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/mp/src/public/vgui_controls/AnalogBar.h b/mp/src/public/vgui_controls/AnalogBar.h
new file mode 100644
index 00000000..a5f68fbb
--- /dev/null
+++ b/mp/src/public/vgui_controls/AnalogBar.h
@@ -0,0 +1,109 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef ANALOGBAR_H
+#define ANALOGBAR_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui/VGUI.h>
+#include <vgui_controls/Panel.h>
+
+namespace vgui
+{
+
+//-----------------------------------------------------------------------------
+// Purpose: Status bar that visually displays discrete analogValue in the form
+// of a segmented strip
+//-----------------------------------------------------------------------------
+class AnalogBar : public Panel
+{
+ DECLARE_CLASS_SIMPLE( AnalogBar, Panel );
+
+public:
+ AnalogBar(Panel *parent, const char *panelName);
+ ~AnalogBar();
+
+ // 'analogValue' is in the range [0.0f, 1.0f]
+ MESSAGE_FUNC_FLOAT( SetAnalogValue, "SetAnalogValue", analogValue );
+ float GetAnalogValue();
+ virtual void SetSegmentInfo( int gap, int width );
+
+ // utility function for calculating a time remaining string
+ static bool ConstructTimeRemainingString(OUT_Z_BYTECAP(outputBufferSizeInBytes) wchar_t *output, int outputBufferSizeInBytes, float startTime, float currentTime, float currentAnalogValue, float lastAnalogValueUpdateTime, bool addRemainingSuffix);
+
+ void SetBarInset( int pixels );
+ int GetBarInset( void );
+
+ virtual void ApplySettings(KeyValues *inResourceData);
+ virtual void GetSettings(KeyValues *outResourceData);
+ virtual const char *GetDescription();
+
+ // returns the number of segment blocks drawn
+ int GetDrawnSegmentCount();
+ int GetTotalSegmentCount();
+
+ enum AnalogValueDir_e
+ {
+ PROGRESS_EAST,
+ PROGRESS_WEST,
+ PROGRESS_NORTH,
+ PROGRESS_SOUTH
+ };
+
+ int GetAnalogValueDirection() const { return m_iAnalogValueDirection; }
+ void SetAnalogValueDirection( int val ) { m_iAnalogValueDirection = val; }
+
+ void SetHomeValue( float val ) { m_fHomeValue = val; }
+
+ const Color& GetHomeColor( void ) { return m_HomeColor; }
+ void SetHomeColor( const Color &color ) { m_HomeColor = color; }
+
+protected:
+ virtual void Paint();
+ void PaintSegment( int &x, int &y, int tall, int wide, Color color, bool bHome );
+ virtual void PaintBackground();
+ virtual void ApplySchemeSettings(IScheme *pScheme);
+ MESSAGE_FUNC_PARAMS( OnDialogVariablesChanged, "DialogVariables", dialogVariables );
+ /* CUSTOM MESSAGE HANDLING
+ "SetAnalogValue"
+ input: "analogValue" - float value of the analogValue to set
+ */
+
+protected:
+ int m_iAnalogValueDirection;
+ float _analogValue;
+
+private:
+ int _segmentCount;
+ int _segmentGap;
+ int _segmentWide;
+ int m_iBarInset;
+ char *m_pszDialogVar;
+
+ float m_fHomeValue;
+ Color m_HomeColor;
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Non-segmented analogValue bar
+//-----------------------------------------------------------------------------
+class ContinuousAnalogBar : public AnalogBar
+{
+ DECLARE_CLASS_SIMPLE( ContinuousAnalogBar, AnalogBar );
+
+public:
+ ContinuousAnalogBar(Panel *parent, const char *panelName);
+
+ virtual void Paint();
+};
+
+} // namespace vgui
+
+#endif // ANALOGBAR_H