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.

82 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #if !defined( VGUI_BASEPANEL_H )
  9. #define VGUI_BASEPANEL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <stdarg.h>
  14. #include <vgui_controls/Panel.h>
  15. #include <vgui_controls/Label.h>
  16. #include <vgui_controls/Controls.h>
  17. #include <vgui/ISurface.h>
  18. //-----------------------------------------------------------------------------
  19. // Global interface allowing various rendering
  20. //-----------------------------------------------------------------------------
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Base Panel for engine vgui panels ( can handle some drawing stuff )
  23. //-----------------------------------------------------------------------------
  24. class CBasePanel : public vgui::Panel
  25. {
  26. public:
  27. DECLARE_CLASS_GAMEROOT( CBasePanel, vgui::Panel );
  28. CBasePanel( vgui::Panel *pParent, const char *panelName );
  29. CBasePanel( vgui::Panel *pParent, const char *panelName, int x, int y, int w, int h );
  30. virtual ~CBasePanel( void );
  31. // should this panel be drawn this frame?
  32. virtual bool ShouldDraw( void ) { return true;}
  33. virtual void PaintBackground( void );
  34. virtual void SetTexture( const char *texname, bool tiled = false );
  35. virtual void SetReflectMouse( bool reflect );
  36. // If reflect mouse is true, then pass these up to parent
  37. virtual void OnCursorMoved(int x,int y);
  38. virtual void OnMousePressed(vgui::MouseCode code);
  39. virtual void OnMouseDoublePressed(vgui::MouseCode code);
  40. virtual void OnMouseReleased(vgui::MouseCode code);
  41. virtual void OnMouseWheeled(int delta);
  42. virtual void OnTick( void );
  43. protected:
  44. bool m_bTexturedBackground;
  45. int m_nBackgroundMaterial;
  46. char m_szBgTexture[ 256 ];
  47. bool m_bTiled;
  48. int m_nTextureSize[ 2 ];
  49. bool m_bReflectMouse;
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Purpose: Hud labels that use HUD scheme colors
  53. //-----------------------------------------------------------------------------
  54. class CHudLabel : public vgui::Label
  55. {
  56. typedef vgui::Label BaseClass;
  57. public:
  58. CHudLabel( vgui::Panel *parent, const char *panelName, const char *text );
  59. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  60. // Selection highlight
  61. void SetSelected( bool bSelected );
  62. bool m_bSelected;
  63. private:
  64. CHudLabel( const CHudLabel & ); // not defined, not accessible
  65. };
  66. #endif // VGUI_BASEPANEL_H