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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef PANELEFFECT_H
#define PANELEFFECT_H
#ifdef _WIN32
#pragma once
#endif
namespace vgui
{
class Panel;
}
class ITFHintItem;
#include <vgui_controls/PHandle.h>
// Serial under of effect, for safe lookup
typedef unsigned int EFFECT_HANDLE;
#define EFFECT_INVALID_HANDLE (EFFECT_HANDLE)(~0)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CPanelEffect
{
public:
DECLARE_CLASS_NOBASE( CPanelEffect );
enum
{
UNKNOWN = 0,
FLASHBORDER,
ARROW,
};
enum
{
ENDPOINT_UNKNOWN = 0,
ENDPOINT_PANEL,
ENDPOINT_POINT,
ENDPOINT_RECTANGLE,
ENDPOINT_ENTITY,
};
CPanelEffect( ITFHintItem *owner );
virtual ~CPanelEffect();
virtual void doPaint( vgui::Panel *panel );
virtual void Think( void );
virtual bool ShouldRemove( void );
virtual void SetShouldRemove( bool remove );
virtual EFFECT_HANDLE GetHandle( void );
virtual void SetType( int type );
virtual int GetType( void );
virtual void SetPanel( vgui::Panel *panel );
virtual vgui::Panel *GetPanel( void );
virtual void SetPanelOther( vgui::Panel *panel );
virtual vgui::Panel *GetPanelOther( void );
virtual void SetTargetPoint( int x, int y );
virtual void SetTargetRect( int x, int y, int w, int h );
virtual void SetColor( int r, int g, int b, int a );
virtual void GetColor( int& r, int& g, int& b, int& a );
virtual void SetEndTime( float time );
virtual float GetEndTime( void );
virtual void SetOwner( ITFHintItem *owner );
virtual ITFHintItem *GetOwner( void );
virtual void SetUsingOffset( bool active, int x, int y );
virtual bool GetUsingOffset( void );
virtual void GetOffset( int& x, int& y );
virtual int GetTargetType( void );
virtual void SetTargetType( int type );
virtual bool GetTargetRectangle( vgui::Panel *outpanel, int&x, int&y, int&w, int&h );
virtual void SetVisible( bool visible );
virtual bool GetVisible( void );
private:
static EFFECT_HANDLE m_nHandleCount;
protected:
virtual bool IsVisibleIncludingParent( vgui::Panel *panel );
EFFECT_HANDLE m_Handle;
ITFHintItem *m_pOwner;
// Data
// type of effect
int m_nType;
// effect targets
vgui::PHandle m_hPanel;
vgui::PHandle m_hOtherPanel;
// effect color
int m_r, m_g, m_b, m_a;
float m_flEndTime;// 0.0f for no end time
// true if we should offset endpoint of arrow/lines into m_hOtherPanel by m_nOffset amount
bool m_bEndpointIsCoordinate;
// x, y offset into destination panel
int m_nOffset[ 2 ];
bool m_bShouldRemove;
int m_TargetType;
int m_ptX;
int m_ptY;
int m_rectX;
int m_rectY;
int m_rectW;
int m_rectH;
bool m_bVisible;
};
#define EFFECT_FLASH_TIME 0.7f
#define EFFECT_R 100
#define EFFECT_G 150
#define EFFECT_B 220
#define EFFECT_A 255
#define ARROW_R 130
#define ARROW_G 190
#define ARROW_B 240
#define ARROW_A 255
#define AXIALLINE_R 220
#define AXIALLINE_G 220
#define AXIALLINE_B 255
#define AXIALLINE_A 255
// Panel effect APIs
void DestroyPanelEffects( ITFHintItem *owner );
EFFECT_HANDLE CreateFlashEffect( ITFHintItem *owner, vgui::Panel *target );
EFFECT_HANDLE CreateArrowEffect( ITFHintItem *owner, vgui::Panel *from, vgui::Panel *to );
EFFECT_HANDLE CreateAxialLineEffect( ITFHintItem *owner, vgui::Panel *from, vgui::Panel *to );
EFFECT_HANDLE CreateArrowEffectToPoint( ITFHintItem *owner, vgui::Panel *from, int x, int y );
EFFECT_HANDLE CreateAxialLineEffectToPoint( ITFHintItem *owner, vgui::Panel *from, int x, int y );
EFFECT_HANDLE CreateArrowEffectToRect( ITFHintItem *owner, vgui::Panel *from, int x, int y, int w, int h );
EFFECT_HANDLE CreateAxialLineEffectToRect( ITFHintItem *owner, vgui::Panel *from, int x, int y, int w, int h );
#endif // PANELEFFECT_H
|