forked from sears2424/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImagePanel.h
92 lines (72 loc) · 2.32 KB
/
ImagePanel.h
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
83
84
85
86
87
88
89
90
91
92
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IMAGEPANEL_H
#define IMAGEPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui/VGUI.h>
#include <vgui_controls/Panel.h>
namespace vgui
{
class IImage;
//-----------------------------------------------------------------------------
// Purpose: Panel that holds a single image
//-----------------------------------------------------------------------------
class ImagePanel : public Panel
{
DECLARE_CLASS_SIMPLE( ImagePanel, Panel );
public:
ImagePanel(Panel *parent, const char *name);
~ImagePanel();
virtual void SetImage(IImage *image);
virtual void SetImage(const char *imageName);
virtual IImage *GetImage();
char *GetImageName();
void SetShouldCenterImage( bool state ) { m_bCenterImage = state; }
bool GetShouldCenterImage() const { return m_bCenterImage; }
// sets whether or not the image should scale to fit the size of the ImagePanel (defaults to false)
void SetShouldScaleImage( bool state );
bool GetShouldScaleImage();
void SetScaleAmount( float scale );
float GetScaleAmount( void );
void SetTileImage( bool bTile ) { m_bTileImage = bTile; }
// set the color to fill with, if no image is specified
void SetFillColor( Color col );
Color GetFillColor();
virtual Color GetDrawColor( void );
virtual void SetDrawColor( Color drawColor );
virtual void ApplySettings(KeyValues *inResourceData);
// unhooks and evicts image if possible, caller must re-establish
bool EvictImage();
int GetNumFrames();
void SetFrame( int nFrame );
void SetRotation( int iRotation ) { m_iRotation = iRotation; }
protected:
virtual void PaintBackground();
virtual void GetSettings(KeyValues *outResourceData);
virtual const char *GetDescription();
virtual void OnSizeChanged(int newWide, int newTall);
virtual void ApplySchemeSettings( IScheme *pScheme );
private:
IImage *m_pImage;
char *m_pszImageName;
char *m_pszFillColorName;
char *m_pszDrawColorName;
bool m_bPositionImage;
bool m_bCenterImage;
bool m_bScaleImage;
bool m_bTileImage;
bool m_bTileHorizontally;
bool m_bTileVertically;
float m_fScaleAmount;
Color m_FillColor;
Color m_DrawColor;
int m_iRotation;
};
} // namespace vgui
#endif // IMAGEPANEL_H