Counter Strike : Global Offensive Source Code
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.

83 lines
1.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: This is a panel which is rendered on top of an entity
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef VGUI_ENTITYPANEL_H
  9. #define VGUI_ENTITYPANEL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "C_BaseEntity.h"
  14. #include <vgui/MouseCode.h>
  15. #include "VGUI_basepanel.h"
  16. // forward declarations
  17. class KeyValues;
  18. //-----------------------------------------------------------------------------
  19. // This is a base class for a panel which always is rendered on top of an entity
  20. //-----------------------------------------------------------------------------
  21. class CEntityPanel : public CBasePanel
  22. {
  23. public:
  24. DECLARE_CLASS( CEntityPanel, CBasePanel );
  25. // constructor
  26. CEntityPanel( vgui::Panel *pParent, const char *panelName );
  27. virtual void ComputeParent( void );
  28. virtual void ComputeAndSetSize( void );
  29. // Initialize from key values
  30. bool Init( KeyValues* pKeyValues, C_BaseEntity* pEntity );
  31. // Determine where our entity is in screen space.
  32. void GetEntityPosition( int& sx, int& sy );
  33. // Base implementation of ShouldDraw
  34. bool ShouldDraw();
  35. // called when we're ticked (updates our position)...
  36. virtual void OnTick( void );
  37. virtual void OnCursorEntered();
  38. virtual void OnCursorExited();
  39. const char *GetMouseOverText( void );
  40. C_BaseEntity* GetEntity() { return (C_BaseEntity*)m_pBaseEntity; }
  41. // Attach to a new entity
  42. void SetEntity( C_BaseEntity* pEntity );
  43. public:
  44. enum
  45. {
  46. MAX_ENTITY_MOUSEOVER = 256
  47. };
  48. // Offset from entity that we should draw
  49. int m_OffsetX, m_OffsetY;
  50. char m_szMouseOverText[ MAX_ENTITY_MOUSEOVER ];
  51. bool m_bShowInNormal;
  52. int m_iOrgWidth;
  53. int m_iOrgHeight;
  54. int m_iOrgOffsetX;
  55. int m_iOrgOffsetY;
  56. float m_flScale;
  57. private:
  58. // This is the entity to which we're attached
  59. EHANDLE m_pBaseEntity;
  60. };
  61. #endif // VGUI_ENTITYPANEL_H