summaryrefslogtreecommitdiff
path: root/game/client/tf2/hintitembase.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf2/hintitembase.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf2/hintitembase.h')
-rw-r--r--game/client/tf2/hintitembase.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/game/client/tf2/hintitembase.h b/game/client/tf2/hintitembase.h
new file mode 100644
index 0000000..78878ea
--- /dev/null
+++ b/game/client/tf2/hintitembase.h
@@ -0,0 +1,113 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef HINTITEMBASE_H
+#define HINTITEMBASE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/Panel.h>
+#include "itfhintitem.h"
+
+class C_TFBaseHint;
+class CHintItemBase;
+
+namespace vgui
+{
+ class Label;
+}
+
+#define DECLARE_HINTITEMFACTORY( className ) \
+ CHintItemBase *Create_##className##( vgui::Panel *parent, const char *panelName ) \
+ { return new className( parent, panelName ); }
+
+#define GET_HINTITEMFACTORY_NAME( className ) Create_##className
+
+#define DECLARE_HINTFACTORY( className ) \
+ C_TFBaseHint *Create_##className##( int id, int entity ) \
+ { return new className( id, 0, entity, NULL ); }
+
+#define GET_HINTFACTORY_NAME( className ) Create_##className
+
+//-----------------------------------------------------------------------------
+// Purpose: A hint that shows up as a single line o text
+//-----------------------------------------------------------------------------
+class CHintItemBase : public vgui::Panel, public ITFHintItem
+{
+ DECLARE_CLASS_GAMEROOT( CHintItemBase, vgui::Panel );
+
+public:
+ CHintItemBase( vgui::Panel *parent, const char *panelName );
+
+ // Draw some extra stuff in the Bg
+ virtual void PaintBackground();
+ virtual void OnSizeChanged( int newWide, int newTall );
+ virtual void SetText( const char *text );
+
+ virtual void SetFormatString( const char *fmt );
+ virtual const char *GetFormatString( void );
+ // If using format string
+ virtual bool CheckKeyAndValue( const char *instring, int* keylength, const char **ppOutstring );
+ virtual void ComputeTitle( void );
+
+ virtual void SetAutoComplete( float elapsed_time );
+
+ // Scheme settings
+ virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
+
+ // Helper
+ virtual const char *GetKeyNameForBinding( const char *binding );
+
+ // Implement ITFHintItem
+ virtual void ParseItem( KeyValues *pKeyValues );
+ virtual bool GetCompleted( void );
+ virtual void SetActive( bool active );
+ virtual bool GetActive( void );
+ virtual void Think( void );
+ virtual int GetHeight( void );
+ virtual void SetPosition( int x, int y );
+ virtual void DeleteThis( void );
+ virtual void SetItemNumber( int index );
+ virtual void SetVisible( bool visible );
+ virtual void SetHintTarget( vgui::Panel *panel );
+ virtual bool ShouldRenderPanelEffects( void );
+ virtual void SetKeyValue( const char *key, const char *value );
+protected:
+ enum
+ {
+ MAX_TEXT_LENGTH = 256,
+ };
+
+ // Has the hint item been completed
+ bool m_bCompleted;
+ // Is the hint item active
+ bool m_bActive;
+ // Text of hint
+ vgui::Label *m_pLabel;
+ // Depends on type of hint
+ vgui::Panel *m_pObject;
+ // Time the hint was activated
+ float m_flActivateTime;
+
+ // vgui::Label *m_pIndex;
+ // Index of hint
+ //int m_nIndex;
+
+ bool m_bUseFormatString;
+ char m_szFormatString[ MAX_TEXT_LENGTH ];
+
+ bool m_bAutoComplete;
+ float m_flAutoCompleteTime;
+
+ vgui::HFont m_hSmallFont;
+ vgui::HFont m_hMarlettFont;
+};
+
+CHintItemBase *CreateHintItem( vgui::Panel *parent, const char *name );
+
+#endif // HINTITEMBASE_H