summaryrefslogtreecommitdiff
path: root/engine/vgui_drawtreepanel.cpp
blob: e0bd1a052bcae5672058586b51ad3129ed13f4ac (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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//===========================================================================//

#include "client_pch.h"

#include <vgui/IClientPanel.h>
#include <vgui_controls/TreeView.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/Frame.h>
#include <vgui_controls/CheckButton.h>
#include <vgui_controls/Button.h>
#include <vgui/IInput.h>
#include "../vgui2/src/VPanel.h"
#include "convar.h"
#include "tier0/vprof.h"
#include "vgui_baseui_interface.h"
#include "vgui_helpers.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

bool g_bForceRefresh = true;

void ChangeCallback_RefreshDrawTree( IConVar *var, const char *pOldString, float flValue )
{
	g_bForceRefresh = true;
}

// Bunch of vgui debugging stuff
static ConVar vgui_drawtree( "vgui_drawtree", "0", FCVAR_CHEAT, "Draws the vgui panel hiearchy to the specified depth level." );
static ConVar vgui_drawtree_visible( "vgui_drawtree_visible", "1", 0, "Draw the visible panels.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_hidden( "vgui_drawtree_hidden", "0", 0, "Draw the hidden panels.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_popupsonly( "vgui_drawtree_popupsonly", "0", 0, "Draws the vgui popup list in hierarchy(1) or most recently used(2) order.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_freeze( "vgui_drawtree_freeze", "0", 0, "Set to 1 to stop updating the vgui_drawtree view.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_panelptr( "vgui_drawtree_panelptr", "0", 0, "Show the panel pointer values in the vgui_drawtree view.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_panelalpha( "vgui_drawtree_panelalpha", "0", 0, "Show the panel alpha values in the vgui_drawtree view.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_render_order( "vgui_drawtree_render_order", "0", 0, "List the vgui_drawtree panels in render order.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_bounds( "vgui_drawtree_bounds", "0", 0, "Show panel bounds.", ChangeCallback_RefreshDrawTree );
static ConVar vgui_drawtree_draw_selected( "vgui_drawtree_draw_selected", "0", 0, "Highlight the selected panel", ChangeCallback_RefreshDrawTree );
extern ConVar vgui_drawfocus;


void vgui_drawtree_on_f()
{
	vgui_drawtree.SetValue( 1 );
}
void vgui_drawtree_off_f()
{
	vgui_drawtree.SetValue( 0 );
}
ConCommand vgui_drawtree_on( "+vgui_drawtree", vgui_drawtree_on_f );
ConCommand vgui_drawtree_off( "-vgui_drawtree", vgui_drawtree_off_f );


extern CUtlVector< vgui::VPANEL > g_FocusPanelList;
extern vgui::VPanelHandle g_DrawTreeSelectedPanel;


class CVGuiTree : public vgui::TreeView
{
public:
	typedef vgui::TreeView BaseClass;	


	CVGuiTree( vgui::Panel *parent, const char *pName ) : 
		BaseClass( parent, pName )
	{
		
	}

	virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
	{
		BaseClass::ApplySchemeSettings( pScheme );

		SetFont( pScheme->GetFont( "ConsoleText", false ) );
		//SetBgColor( Color( 0, 0, 0, 175 ) );
		SetPaintBackgroundEnabled( false );
	}
};


class CDrawTreeFrame : public vgui::Frame
{
public:
	DECLARE_CLASS_SIMPLE( CDrawTreeFrame, vgui::Frame );
	
	CDrawTreeFrame( vgui::Panel *parent, const char *pName ) : 
		BaseClass( parent, pName )
	{
		// Init the frame.
		SetTitle( "VGUI Hierarchy", false );
		SetMenuButtonVisible( false );
		
		// Create the tree control itself.
		m_pTree = vgui::SETUP_PANEL( new CVGuiTree( this, "Tree view" ) );
		m_pTree->SetVisible( true );

		// Init the buttons.
		m_pShowVisible = vgui::SETUP_PANEL( new CConVarCheckButton( this, "show visible", "Show Visible" ) );
		m_pShowVisible->SetVisible( true );
		m_pShowVisible->SetConVar( &vgui_drawtree_visible );

		m_pShowHidden = vgui::SETUP_PANEL( new CConVarCheckButton( this, "show hidden", "Show Hidden" ) );
		m_pShowHidden->SetVisible( true );
		m_pShowHidden->SetConVar( &vgui_drawtree_hidden );

		m_pPopupsOnly = vgui::SETUP_PANEL( new CConVarCheckButton( this, "popups only", "Popups Only" ) );
		m_pPopupsOnly->SetVisible( true );
		m_pPopupsOnly->SetConVar( &vgui_drawtree_popupsonly );

		m_pDrawFocus = vgui::SETUP_PANEL( new CConVarCheckButton( this, "draw focus", "Highlight MouseOver" ) );
		m_pDrawFocus->SetVisible( true );
		m_pDrawFocus->SetConVar( &vgui_drawfocus );

		m_pFreeze = vgui::SETUP_PANEL( new CConVarCheckButton( this, "freeze option", "Freeze" ) );
		m_pFreeze->SetVisible( true );
		m_pFreeze->SetConVar( &vgui_drawtree_freeze );

		m_pShowPanelPtr = vgui::SETUP_PANEL( new CConVarCheckButton( this, "panel ptr option", "Show Addresses" ) );
		m_pShowPanelPtr->SetVisible( true );
		m_pShowPanelPtr->SetConVar( &vgui_drawtree_panelptr );

		m_pShowPanelAlpha = vgui::SETUP_PANEL( new CConVarCheckButton( this, "panel alpha option", "Show Alpha" ) );
		m_pShowPanelAlpha->SetVisible( true );
		m_pShowPanelAlpha->SetConVar( &vgui_drawtree_panelalpha );

		m_pRenderOrder = vgui::SETUP_PANEL( new CConVarCheckButton( this, "render order option", "In Render Order" ) );
		m_pRenderOrder->SetVisible( true );
		m_pRenderOrder->SetConVar( &vgui_drawtree_render_order );

		m_pShowBounds = vgui::SETUP_PANEL( new CConVarCheckButton( this, "show panel bounds", "Show Panel Bounds" ) );
		m_pShowBounds->SetVisible( true );
		m_pShowBounds->SetConVar( &vgui_drawtree_bounds );

		m_pHighlightSelected = vgui::SETUP_PANEL( new CConVarCheckButton( this, "highlight selected", "Highlight Selected" ) );
		m_pHighlightSelected->SetVisible( true );
		m_pHighlightSelected->SetConVar( &vgui_drawtree_draw_selected );

		m_pPerformLayoutBtn = vgui::SETUP_PANEL( new vgui::Button( this, "performlayout", "Perform Layout (Highlighted)", this, "performlayout" ) );
		m_pPerformLayoutBtn->SetVisible( true );
		
		m_pReloadSchemeBtn = vgui::SETUP_PANEL( new vgui::Button( this, "reloadscheme", "Reload Scheme (Highlighted)", this, "reloadscheme" ) );
		m_pReloadSchemeBtn->SetVisible( true );
		
		int r,g,b,a;
		GetBgColor().GetColor( r, g, b, a );
		a = 128;
		SetBgColor( Color( r, g, b, a ) );
	}


	virtual void PerformLayout()
	{
		BaseClass::PerformLayout();

		int x, y, w, t;
		GetClientArea( x, y, w, t );
		
		int yOffset = y;

		// Align the check boxes.
		m_pShowVisible->SetPos( x, yOffset );
		m_pShowVisible->SetWide( w/2 );
		yOffset += m_pShowVisible->GetTall();

		m_pShowHidden->SetPos( x, yOffset );
		m_pShowHidden->SetWide( w/2 );
		yOffset += m_pShowHidden->GetTall();

		m_pPopupsOnly->SetPos( x, yOffset );
		m_pPopupsOnly->SetWide( w/2 );
		yOffset += m_pPopupsOnly->GetTall();

		m_pDrawFocus->SetPos( x, yOffset );
		m_pDrawFocus->SetWide( w/2 );
		yOffset += m_pDrawFocus->GetTall();

		m_pShowBounds->SetPos( x, yOffset );
		m_pShowBounds->SetWide( w/2 );
		yOffset += m_pShowBounds->GetTall();

		// Next column..
		yOffset = y;

		m_pFreeze->SetPos( x + w/2, yOffset );
		m_pFreeze->SetWide( w/2 );
		yOffset += m_pFreeze->GetTall();

		m_pShowPanelPtr->SetPos( x + w/2, yOffset );
		m_pShowPanelPtr->SetWide( w/2 );
		yOffset += m_pShowPanelPtr->GetTall();

		m_pShowPanelAlpha->SetPos( x + w/2, yOffset );
		m_pShowPanelAlpha->SetWide( w/2 );
		yOffset += m_pShowPanelAlpha->GetTall();
			   
		m_pRenderOrder->SetPos( x + w/2, yOffset );
		m_pRenderOrder->SetWide( w/2 );
		yOffset += m_pRenderOrder->GetTall();

		m_pHighlightSelected->SetPos( x + w/2, yOffset );
		m_pHighlightSelected->SetWide( w/2 );
		yOffset += m_pHighlightSelected->GetTall();

		// buttons

		m_pPerformLayoutBtn->SetPos( x , yOffset );
		m_pPerformLayoutBtn->SizeToContents();
		m_pPerformLayoutBtn->SetWide( w );
		yOffset += m_pPerformLayoutBtn->GetTall();

		m_pReloadSchemeBtn->SetPos( x , yOffset );
		m_pReloadSchemeBtn->SizeToContents();
		m_pReloadSchemeBtn->SetWide( w );
		yOffset += m_pReloadSchemeBtn->GetTall();

		// the tree control
		m_pTree->SetBounds( x, yOffset, w, t - (yOffset - y) );
	}

	virtual void OnCommand( const char *command )
	{
		if ( !Q_stricmp( command, "performlayout" ) )
		{
			if ( g_DrawTreeSelectedPanel )
			{
				vgui::ipanel()->SendMessage( g_DrawTreeSelectedPanel, new KeyValues("Command", "command", "performlayout"), GetVPanel() );
			}
		}
		else if ( !Q_stricmp( command, "reloadscheme" ) )
		{
			if ( g_DrawTreeSelectedPanel )
			{
				vgui::ipanel()->SendMessage( g_DrawTreeSelectedPanel, new KeyValues("Command", "command", "reloadscheme"), GetVPanel() );
			}
		}
		else
		{
			BaseClass::OnCommand( command );
		}
	}

	MESSAGE_FUNC( OnItemSelected, "TreeViewItemSelected" )
	{
		RecalculateSelectedHighlight();
	}

	void RecalculateSelectedHighlight( void )
	{
		Assert( m_pTree );

		if ( !vgui_drawtree_draw_selected.GetBool() || m_pTree->GetSelectedItemCount() != 1 )
		{
			// clear the selection
			g_DrawTreeSelectedPanel = 0;
		}
		else
		{
			CUtlVector< int > list;
			m_pTree->GetSelectedItems( list );

			Assert( list.Count() == 1 );

			KeyValues *data = m_pTree->GetItemData( list.Element(0) );

			if ( data )
			{
				g_DrawTreeSelectedPanel = (data) ? (vgui::VPANEL)data->GetInt( "PanelPtr", 0 ) : 0;
			}
			else
			{
				g_DrawTreeSelectedPanel = 0;
			}
		}
	}

	virtual void OnClose()
	{
		vgui_drawtree.SetValue( 0 );
		g_DrawTreeSelectedPanel = 0;

		// fixme - g_DrawTreeSelectedPanel has a potential crash if you hilight a panel, and then spam hud_reloadscheme
		// you will sometimes end up on a different panel or on garbage.
	}

	virtual void OnThink() OVERRIDE
	{
		BaseClass::OnThink();

		vgui::VPANEL focus = 0;
		if ( vgui::input() )
		{
			focus = vgui::input()->GetFocus();
		}

		MoveToFront();

		if ( vgui::input() && focus )
		{
			OnRequestFocus(focus, NULL);
		}
	}

public:
	CVGuiTree *m_pTree;	
	CConVarCheckButton *m_pShowVisible;
	CConVarCheckButton *m_pShowHidden;
	CConVarCheckButton *m_pPopupsOnly;
	CConVarCheckButton *m_pFreeze;
	CConVarCheckButton *m_pShowPanelPtr;
	CConVarCheckButton *m_pShowPanelAlpha;
	CConVarCheckButton *m_pRenderOrder;
	CConVarCheckButton *m_pDrawFocus;
	CConVarCheckButton *m_pShowBounds;
	CConVarCheckButton *m_pHighlightSelected;
	vgui::Button	   *m_pPerformLayoutBtn;
	vgui::Button	   *m_pReloadSchemeBtn;
};


CDrawTreeFrame *g_pDrawTreeFrame = 0;


void VGui_RecursivePrintTree( 
	vgui::VPANEL current, 
	KeyValues *pCurrentParent,
	int popupDepthCounter )
{
	if ( !current )
		return;

	vgui::IPanel *ipanel = vgui::ipanel();

	if ( !vgui_drawtree_visible.GetInt() && ipanel->IsVisible( current ) )
		return;
	else if ( !vgui_drawtree_hidden.GetInt() && !ipanel->IsVisible( current ) )
		return;
	else if ( popupDepthCounter <= 0 && ipanel->IsPopup( current ) )
		return;	
	
	KeyValues *pNewParent = pCurrentParent;
	KeyValues *pVal = pCurrentParent->CreateNewKey();
		
	// Bind data to pVal.
	char name[1024];
	const char *pInputName = ipanel->GetName( current );
	if ( pInputName && pInputName[0] != 0 )
		Q_snprintf( name, sizeof( name ), "%s", pInputName );
	else
		Q_snprintf( name, sizeof( name ), "%s", "(no name)" );

	if ( ipanel->IsMouseInputEnabled( current ) )
	{
		Q_strncat( name, ", +m", sizeof( name ), COPY_ALL_CHARACTERS );
	}

	if ( ipanel->IsKeyBoardInputEnabled( current ) )
	{
		Q_strncat( name, ", +k", sizeof( name ), COPY_ALL_CHARACTERS );
	}

	if ( vgui_drawtree_bounds.GetBool() )
	{
		int x, y, w, h;
		vgui::ipanel()->GetPos( current, x, y );
		vgui::ipanel()->GetSize( current, w, h );
		char b[ 128 ];
		Q_snprintf( b, sizeof( b ), "[%-4i %-4i %-4i %-4i]", x, y, w, h );

		Q_strncat( name, ", ", sizeof( name ), COPY_ALL_CHARACTERS );
		Q_strncat( name, b, sizeof( name ), COPY_ALL_CHARACTERS );
	}

	char str[1024];
	if ( vgui_drawtree_panelptr.GetInt() )
		Q_snprintf( str, sizeof( str ), "%s - [0x%x]", name, current );
	else if (vgui_drawtree_panelalpha.GetInt() )
	{
		KeyValues *kv = new KeyValues("alpha");
		vgui::ipanel()->RequestInfo(current, kv);
		Q_snprintf( str, sizeof( str ), "%s - [%d]", name, kv->GetInt("alpha") );
		kv->deleteThis();
	}
	else
		Q_snprintf( str, sizeof( str ), "%s", name );

	pVal->SetString( "Text", str );
	pVal->SetInt( "PanelPtr", current );

	pNewParent = pVal;

	
	// Don't recurse past the tree itself because the tree control uses a panel for each
	// panel inside itself, and it'll infinitely create panels.
	if ( current == g_pDrawTreeFrame->m_pTree->GetVPanel() )
		return;


	int count = ipanel->GetChildCount( current );
	for ( int i = 0; i < count ; i++ )
	{
		vgui::VPANEL panel = ipanel->GetChild( current, i );
		VGui_RecursivePrintTree( panel, pNewParent, popupDepthCounter-1 );
	}
}


bool UpdateItemState(
	vgui::TreeView *pTree, 
	int iChildItemId, 
	KeyValues *pSub )
{
	bool bRet = false;
	vgui::IPanel *ipanel = vgui::ipanel();

	KeyValues *pItemData = pTree->GetItemData( iChildItemId );
	if ( pItemData->GetInt( "PanelPtr" ) != pSub->GetInt( "PanelPtr" ) ||
		Q_stricmp( pItemData->GetString( "Text" ), pSub->GetString( "Text" ) ) != 0 )
	{
		pTree->ModifyItem( iChildItemId, pSub );
		bRet = true;
	}

	// Ok, this is a new panel.
	vgui::VPANEL vPanel = pSub->GetInt( "PanelPtr" );

	int iBaseColor[3] = { 255, 255, 255 };
	if ( ipanel->IsPopup( vPanel ) )
	{
		iBaseColor[0] = 255;	iBaseColor[1] = 255;	iBaseColor[2] = 0;
	}

	if ( g_FocusPanelList.Find( vPanel ) != -1 )
	{
		iBaseColor[0] = 0;		iBaseColor[1] = 255;	iBaseColor[2] = 0;
		pTree->ExpandItem( iChildItemId, true );
	}

	if ( !ipanel->IsVisible( vPanel ) )
	{
		iBaseColor[0] >>= 1;	iBaseColor[1] >>= 1;	iBaseColor[2] >>= 1;
	}

	pTree->SetItemFgColor( iChildItemId, Color( iBaseColor[0], iBaseColor[1], iBaseColor[2], 255 ) );
	return bRet;
}


void IncrementalUpdateTree( 
	vgui::TreeView *pTree, 
	KeyValues *pValues )
{
	if ( !g_bForceRefresh && vgui_drawtree_freeze.GetInt() )
		return;

	g_bForceRefresh = false;

	bool bInvalidateLayout = IncrementalUpdateTree( pTree, pValues, UpdateItemState, -1 );
	
	pTree->ExpandItem( pTree->GetRootItemIndex(), true );

	if ( g_pDrawTreeFrame )
		g_pDrawTreeFrame->RecalculateSelectedHighlight();
	
	if ( bInvalidateLayout )
		pTree->InvalidateLayout();
}


bool WillPanelBeVisible( vgui::VPANEL hPanel )
{
	while ( hPanel )
	{
		if ( !vgui::ipanel()->IsVisible( hPanel ) )
			return false;

		hPanel = vgui::ipanel()->GetParent( hPanel );
	}
	return true;
}


void VGui_AddPopupsToKeyValues( KeyValues *pCurrentParent )
{
	// 'twould be nice if we could get the Panel* from the VPANEL, but we can't.
	int count = vgui::surface()->GetPopupCount();
	for ( int i=0; i < count; i++ )
	{
		vgui::VPANEL vPopup = vgui::surface()->GetPopup( i );
		if ( vgui_drawtree_hidden.GetInt() || WillPanelBeVisible( vPopup ) )
		{
			VGui_RecursivePrintTree( 
				vPopup, 
				pCurrentParent,
				1 );
		}
	}
}


void VGui_FillKeyValues( KeyValues *pCurrentParent )
{
	if ( !EngineVGui()->IsInitialized() )
		return;

	// Figure out the root panel to start at. 
	// If they specified a name for a root panel, then use that one.
	vgui::VPANEL hBase = vgui::surface()->GetEmbeddedPanel();

	if ( vgui_drawtree_popupsonly.GetInt() )
	{
		VGui_AddPopupsToKeyValues( pCurrentParent );
	}
	else if ( vgui_drawtree_render_order.GetInt() )
	{
		VGui_RecursivePrintTree( 
			hBase, 
			pCurrentParent,
			0 );

		VGui_AddPopupsToKeyValues( pCurrentParent );
	}
	else
	{
		VGui_RecursivePrintTree( 
			hBase, 
			pCurrentParent,
			99999 );
	}
}


void VGui_DrawHierarchy( void )
{
	VPROF( "VGui_DrawHierarchy" );

	if ( IsX360() )
		return;

	if ( vgui_drawtree.GetInt() <= 0 )
	{
		g_pDrawTreeFrame->SetVisible( false );
		return;
	}

	g_pDrawTreeFrame->SetVisible( true );

	// Now reconstruct the tree control.
	KeyValues *pRoot = new KeyValues("");
	pRoot->SetString( "Text", "<shouldn't see this>" );
	
	VGui_FillKeyValues( pRoot );

	// Now incrementally update the tree control so we can preserve which nodes are open.
	IncrementalUpdateTree( g_pDrawTreeFrame->m_pTree, pRoot );

	// Delete the keyvalues.
	pRoot->deleteThis();
}


void VGui_CreateDrawTreePanel( vgui::Panel *parent )
{
	int widths = 300;
	
	g_pDrawTreeFrame = vgui::SETUP_PANEL( new CDrawTreeFrame( parent, "DrawTreeFrame" ) );
	g_pDrawTreeFrame->SetVisible( false );
	g_pDrawTreeFrame->SetBounds( parent->GetWide() - widths, 0, widths, parent->GetTall() - 10 );
	
	g_pDrawTreeFrame->MakePopup( false, false );
	g_pDrawTreeFrame->SetKeyBoardInputEnabled( true );
	g_pDrawTreeFrame->SetMouseInputEnabled( true );
}


void VGui_MoveDrawTreePanelToFront()
{
	if ( g_pDrawTreeFrame )
		g_pDrawTreeFrame->MoveToFront();
}


void VGui_UpdateDrawTreePanel()
{
	VGui_DrawHierarchy();
}


void vgui_drawtree_clear_f()
{
	if ( g_pDrawTreeFrame && g_pDrawTreeFrame->m_pTree )
		g_pDrawTreeFrame->m_pTree->RemoveAll();
}

ConCommand vgui_drawtree_clear( "vgui_drawtree_clear", vgui_drawtree_clear_f );