summaryrefslogtreecommitdiff
path: root/public/vgui_controls/ImageList.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/vgui_controls/ImageList.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/vgui_controls/ImageList.h')
-rw-r--r--public/vgui_controls/ImageList.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/public/vgui_controls/ImageList.h b/public/vgui_controls/ImageList.h
new file mode 100644
index 0000000..db9ec63
--- /dev/null
+++ b/public/vgui_controls/ImageList.h
@@ -0,0 +1,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