sqwarmed/sdk_src/public/vgui/IVGui.h

114 lines
3.3 KiB
C
Raw Normal View History

2024-08-29 19:18:30 -04:00
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#ifndef IVGUI_H
#define IVGUI_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/interface.h"
#include <vgui/VGUI.h>
#include "appframework/IAppSystem.h"
class KeyValues;
namespace vgui
{
// safe handle to a panel - can be converted to and from a VPANEL
typedef unsigned long HPanel;
typedef int HContext;
enum
{
DEFAULT_VGUI_CONTEXT = ((vgui::HContext)~0)
};
// safe handle to a panel - can be converted to and from a VPANEL
typedef unsigned long HPanel;
class IMessageContextIdHandler
{
public:
virtual void SetMessageContextId( int id ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface to core vgui components
//-----------------------------------------------------------------------------
class IVGui : public IAppSystem
{
public:
// activates vgui message pump
virtual void Start() = 0;
// signals vgui to Stop running
virtual void Stop() = 0;
// returns true if vgui is current active
virtual bool IsRunning() = 0;
// runs a single frame of vgui
virtual void RunFrame() = 0;
// broadcasts "ShutdownRequest" "id" message to all top-level panels in the app
virtual void ShutdownMessage(unsigned int shutdownID) = 0;
// panel allocation
virtual VPANEL AllocPanel() = 0;
virtual void FreePanel(VPANEL panel) = 0;
// debugging prints
virtual void DPrintf(const char *format, ...) = 0;
virtual void DPrintf2(const char *format, ...) = 0;
virtual void SpewAllActivePanelNames() = 0;
// safe-pointer handle methods
virtual HPanel PanelToHandle(VPANEL panel) = 0;
virtual VPANEL HandleToPanel(HPanel index) = 0;
virtual void MarkPanelForDeletion(VPANEL panel) = 0;
// makes panel receive a 'Tick' message every frame (~50ms, depending on sleep times/framerate)
// panel is automatically removed from tick signal list when it's deleted
virtual void AddTickSignal(VPANEL panel, int intervalMilliseconds = 0 ) = 0;
virtual void RemoveTickSignal(VPANEL panel) = 0;
// message sending
virtual void PostMessage(VPANEL target, KeyValues *params, VPANEL from, float delaySeconds = 0.0f) = 0;
// Creates/ destroys vgui contexts, which contains information
// about which controls have mouse + key focus, for example.
virtual HContext CreateContext() = 0;
virtual void DestroyContext( HContext context ) = 0;
// Associates a particular panel with a vgui context
// Associating NULL is valid; it disconnects the panel from the context
virtual void AssociatePanelWithContext( HContext context, VPANEL pRoot ) = 0;
// Activates a particular context, use DEFAULT_VGUI_CONTEXT
// to get the one normally used by VGUI
virtual void ActivateContext( HContext context ) = 0;
// whether to sleep each frame or not, true = sleep
virtual void SetSleep( bool state) = 0;
// data accessor for above
virtual bool GetShouldVGuiControlSleep() = 0;
// Resets a particular context, use DEFAULT_VGUI_CONTEXT
// to get the one normally used by VGUI
virtual void ResetContext( HContext context ) = 0;
};
};
#endif // IVGUI_H