aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vgui_controls/ImageList.h
blob: db9ec638fd4ea6e3512d3f02de867e68406ac1e4 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef IMAGELIST_H
#define IMAGELIST_H

#ifdef _WIN32
#pragma once
#endif

#include <utlvector.h>
#include <vgui/VGUI.h>
#include <vgui/IImage.h>

namespace vgui
{

//-----------------------------------------------------------------------------
// Purpose: holds a collection of images
//			used by controls so that images can be refered to by indices
//-----------------------------------------------------------------------------
class ImageList
{
public:
	ImageList(bool deleteImagesWhenDone);
	~ImageList();

	// adds a new image to the list, returning the index it was placed at
	int AddImage(vgui::IImage *image);

	// returns the number of images
	int GetImageCount();

	// returns true if an index is valid
	bool IsValidIndex(int imageIndex);

	// sets an image at a specified index, growing and adding NULL images if necessary
	void SetImageAtIndex(int index, vgui::IImage *image);

	// gets an image, imageIndex is of range [0, GetImageCount)
	// image index 0 is always the blank image
	vgui::IImage *GetImage(int imageIndex);

private:
	CUtlVector<vgui::IImage *> m_Images;
	bool m_bDeleteImagesWhenDone;
};


} // namespace vgui

#endif // IMAGELIST_H