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.

69 lines
1.9 KiB

  1. //========= Copyright � 1996-2005, 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_BITMAPBUTTON_H
  9. #define VGUI_BITMAPBUTTON_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <vgui_controls/Button.h>
  14. #include "vgui_bitmapimage.h"
  15. //-----------------------------------------------------------------------------
  16. // forward declarations
  17. //-----------------------------------------------------------------------------
  18. class KeyValues;
  19. //-----------------------------------------------------------------------------
  20. // A button that renders images instead of standard vgui stuff...
  21. //-----------------------------------------------------------------------------
  22. class CBitmapButton : public vgui::Button
  23. {
  24. typedef vgui::Button BaseClass;
  25. public:
  26. enum ButtonImageType_t
  27. {
  28. BUTTON_ENABLED = 0,
  29. BUTTON_ENABLED_MOUSE_OVER,
  30. BUTTON_PRESSED,
  31. BUTTON_DISABLED,
  32. BUTTON_STATE_COUNT
  33. };
  34. // constructor
  35. CBitmapButton( vgui::Panel *pParent, const char *pName, const char *pText );
  36. ~CBitmapButton();
  37. // initialization
  38. bool Init( KeyValues* pInitData );
  39. void SetImage( ButtonImageType_t type, const char *pMaterialName, color32 color );
  40. bool IsImageLoaded( ButtonImageType_t type ) const;
  41. // initialization from build-mode dialog style .res files
  42. virtual void ApplySettings(KeyValues *inResourceData);
  43. virtual void Paint( void );
  44. virtual void PaintBackground( void ) {}
  45. virtual void OnMouseDoublePressed( vgui::MouseCode code );
  46. void SetDoublePressedCommand( const char *command );
  47. void SetDoublePressedCommand( KeyValues *message );
  48. private:
  49. BitmapImage m_pImage[BUTTON_STATE_COUNT];
  50. bool m_bImageLoaded[BUTTON_STATE_COUNT];
  51. KeyValues *_doublePressedActionMessage;
  52. };
  53. #endif // VGUI_BITMAPBUTTON_H