aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/vgui_bitmapbutton.h
blob: a52e766718f61203fe80401d9f8c75c75670949c (plain) (blame)
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: This is a panel which is rendered image on top of an entity
//
// $Revision: $
// $NoKeywords: $
//=============================================================================//

#ifndef VGUI_BITMAPBUTTON_H
#define VGUI_BITMAPBUTTON_H

#ifdef _WIN32
#pragma once
#endif

#include <vgui_controls/Button.h>
#include "vgui_bitmapimage.h"

//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------
class KeyValues;

//-----------------------------------------------------------------------------
// A button that renders images instead of standard vgui stuff...
//-----------------------------------------------------------------------------
class CBitmapButton : public vgui::Button
{
	typedef vgui::Button BaseClass;

public:
	enum ButtonImageType_t
	{
		BUTTON_ENABLED = 0,
		BUTTON_ENABLED_MOUSE_OVER,
		BUTTON_PRESSED,
		BUTTON_DISABLED,

		BUTTON_STATE_COUNT
	};

	// constructor
	CBitmapButton( vgui::Panel *pParent, const char *pName, const char *pText );
	~CBitmapButton();

	// initialization
	bool Init( KeyValues* pInitData );

	void SetImage( ButtonImageType_t type, const char *pMaterialName, color32 color );
	bool IsImageLoaded( ButtonImageType_t type ) const;

	// initialization from build-mode dialog style .res files
	virtual void ApplySettings(KeyValues *inResourceData);

	virtual void Paint( void );
	virtual void PaintBackground( void ) {}

private:

	BitmapImage	m_pImage[BUTTON_STATE_COUNT];
	bool m_bImageLoaded[BUTTON_STATE_COUNT];
};


#endif //  VGUI_BITMAPBUTTON_H