diff options
Diffstat (limited to 'tools/toolutils/vgui_tools.cpp')
| -rw-r--r-- | tools/toolutils/vgui_tools.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/toolutils/vgui_tools.cpp b/tools/toolutils/vgui_tools.cpp new file mode 100644 index 0000000..f60c1e5 --- /dev/null +++ b/tools/toolutils/vgui_tools.cpp @@ -0,0 +1,67 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#include "toolutils/vgui_tools.h" +#include "ienginevgui.h" +#include <vgui/ISurface.h> +#include <vgui/IVGui.h> +#include <vgui/IInput.h> +#include "tier0/vprof.h" +#include <vgui_controls/Panel.h> +#include <KeyValues.h> +#include <dme_controls/dmeControls.h> + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +using namespace vgui; + +//----------------------------------------------------------------------------- +// Purpose: +// Input : appSystemFactory - +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool VGui_Startup( CreateInterfaceFn appSystemFactory ) +{ + // All of the various tools .dlls expose GetVGuiControlsModuleName() to us to make sure we don't have communication across .dlls + if ( !vgui::VGui_InitDmeInterfacesList( GetVGuiControlsModuleName(), &appSystemFactory, 1 ) ) + return false; + + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : - +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool VGui_PostInit() +{ + // Create any root panels for .dll + VGUI_CreateToolRootPanel(); + + // Make sure we have a panel + VPANEL root = VGui_GetToolRootPanel(); + if ( !root ) + { + return false; + } + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : - +//----------------------------------------------------------------------------- +void VGui_Shutdown() +{ + VGUI_DestroyToolRootPanel(); + + // Make sure anything "marked for deletion" + // actually gets deleted before this dll goes away + vgui::ivgui()->RunFrame(); +} |