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.

71 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: This is a panel which is rendered image on top of an entity
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef VGUI_BITMAPPANEL_H
  9. #define VGUI_BITMAPPANEL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <vgui_controls/Panel.h>
  14. //-----------------------------------------------------------------------------
  15. // forward declarations
  16. //-----------------------------------------------------------------------------
  17. class KeyValues;
  18. class BitmapImage;
  19. struct Bitmap_t;
  20. //-----------------------------------------------------------------------------
  21. // This is a base class for a panel which always is rendered on top of an entity
  22. //-----------------------------------------------------------------------------
  23. class CBitmapPanel : public vgui::Panel
  24. {
  25. typedef vgui::Panel BaseClass;
  26. public:
  27. // constructor
  28. CBitmapPanel( );
  29. CBitmapPanel( vgui::Panel *pParent, const char *pName );
  30. ~CBitmapPanel();
  31. // initialization
  32. bool Init( KeyValues* pInitData );
  33. // initialization from build-mode dialog style .res files
  34. virtual void ApplySettings(KeyValues *inResourceData);
  35. virtual void Paint( void );
  36. virtual void PaintBackground( void ) {}
  37. virtual void OnCursorEntered();
  38. virtual void OnCursorExited();
  39. // Setup for panels that aren't created by the commander overlay factory (i.e. aren't parsed from a keyvalues file)
  40. virtual void SetImage( BitmapImage *pImage );
  41. /// Set bitmap data directly
  42. virtual void SetBitmap( const Bitmap_t &bitmap );
  43. const char *GetMouseOverText( void );
  44. private:
  45. enum
  46. {
  47. MAX_ENTITY_MOUSEOVER = 256
  48. };
  49. // The bitmap to render
  50. BitmapImage *m_pImage;
  51. int m_r, m_g, m_b, m_a;
  52. bool m_bOwnsImage;
  53. char m_szMouseOverText[ MAX_ENTITY_MOUSEOVER ];
  54. };
  55. #endif // VGUI_BITMAPPANEL_H