summaryrefslogtreecommitdiff
path: root/vgui2/src/ScalableImageBorder.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 /vgui2/src/ScalableImageBorder.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'vgui2/src/ScalableImageBorder.h')
-rw-r--r--vgui2/src/ScalableImageBorder.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/vgui2/src/ScalableImageBorder.h b/vgui2/src/ScalableImageBorder.h
new file mode 100644
index 0000000..d1df631
--- /dev/null
+++ b/vgui2/src/ScalableImageBorder.h
@@ -0,0 +1,78 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Core implementation of vgui
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SCALABLE_IMAGE_BORDER_H
+#define SCALABLE_IMAGE_BORDER_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui/VGUI.h>
+#include <vgui/IBorder.h>
+#include <vgui/IScheme.h>
+#include <vgui/IPanel.h>
+#include <Color.h>
+
+class KeyValues;
+
+//-----------------------------------------------------------------------------
+// Purpose: Custom border that renders itself with images
+//-----------------------------------------------------------------------------
+class ScalableImageBorder : public vgui::IBorder
+{
+public:
+ ScalableImageBorder();
+ ~ScalableImageBorder();
+
+ virtual void Paint(vgui::VPANEL panel);
+ virtual void Paint(int x0, int y0, int x1, int y1);
+ virtual void Paint(int x0, int y0, int x1, int y1, int breakSide, int breakStart, int breakStop);
+ virtual void SetInset(int left, int top, int right, int bottom);
+ virtual void GetInset(int &left, int &top, int &right, int &bottom);
+
+ virtual void ApplySchemeSettings(vgui::IScheme *pScheme, KeyValues *inResourceData);
+
+ virtual const char *GetName();
+ virtual void SetName(const char *name);
+ virtual backgroundtype_e GetBackgroundType();
+
+ virtual bool PaintFirst( void ) { return m_bPaintFirst; }
+
+protected:
+ void SetImage(const char *imageName);
+
+protected:
+ int _inset[4];
+
+private:
+ // protected copy constructor to prevent use
+ ScalableImageBorder(ScalableImageBorder&);
+
+ char *_name;
+
+ backgroundtype_e m_eBackgroundType;
+
+ friend class VPanel;
+
+ int m_iSrcCornerHeight; // in pixels, how tall is the corner inside the image
+ int m_iSrcCornerWidth; // same for width
+ int m_iCornerHeight; // output size of the corner height in pixels
+ int m_iCornerWidth; // same for width
+
+ int m_iTextureID;
+
+ float m_flCornerWidthPercent; // corner width as percentage of image width
+ float m_flCornerHeightPercent; // same for height
+
+ char *m_pszImageName;
+ bool m_bPaintFirst;
+
+ Color m_Color;
+};
+
+#endif // SCALABLE_IMAGE_BORDER_H