blob: c86fb841a8999776e5069a8f41193c386304e807 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef VGUI_HELPERS_H
#define VGUI_HELPERS_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/TreeView.h>
#include <vgui_controls/CheckButton.h>
class KeyValues;
class ConVar;
// This control keeps a ConVar's value updated with a CheckButton's value.
class CConVarCheckButton : public vgui::CheckButton
{
public:
typedef vgui::CheckButton BaseClass;
CConVarCheckButton( vgui::Panel *parent, const char *panelName, const char *text );
// Call this to initialize it with a cvar. The CheckButton will be set to the current
// value of the ConVar.
void SetConVar( ConVar *pVar );
virtual void SetSelected( bool state );
public:
ConVar *m_pConVar;
};
// Return true if the state was changed at all (in any way that would require an InvalidateLayout on the control).
typedef bool (*UpdateItemStateFn)(
vgui::TreeView *pTree,
int iChildItemId,
KeyValues *pSub );
// This function takes a bunch of KeyValues entries and incrementally updates
// a tree control. This can be a lot more efficient than clearing the whole tree
// control and re-adding all the elements if most of the elements don't usually change.
//
// NOTE: Only KeyValues nodes with a string named "Text" will be treated as items
// that should be added to the tree.
//
// If iRoot is -1, then it uses GetRootItemIndex().
//
// Returns true if any elements were added or changed.
bool IncrementalUpdateTree(
vgui::TreeView *pTree,
KeyValues *pValues,
UpdateItemStateFn fn,
int iRoot = -1
);
// Copy the contents of the list panel to the clipboard in tab-delimited form for Excel.
void CopyListPanelToClipboard( vgui::ListPanel *pListPanel );
#endif // VGUI_HELPERS_H
|