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