Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef IVGUI_H
  8. #define IVGUI_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier1/interface.h"
  13. #include <vgui/vgui.h>
  14. #include "appframework/iappsystem.h"
  15. class KeyValues;
  16. namespace vgui
  17. {
  18. // safe handle to a panel - can be converted to and from a VPANEL
  19. typedef unsigned long HPanel;
  20. typedef int HContext;
  21. enum
  22. {
  23. DEFAULT_VGUI_CONTEXT = ((vgui::HContext)~0)
  24. };
  25. // safe handle to a panel - can be converted to and from a VPANEL
  26. typedef unsigned long HPanel;
  27. class IMessageContextIdHandler
  28. {
  29. public:
  30. virtual void SetMessageContextId( int id ) = 0;
  31. };
  32. //-----------------------------------------------------------------------------
  33. // Purpose: Interface to core vgui components
  34. //-----------------------------------------------------------------------------
  35. class IVGui : public IAppSystem
  36. {
  37. public:
  38. // activates vgui message pump
  39. virtual void Start() = 0;
  40. // signals vgui to Stop running
  41. virtual void Stop() = 0;
  42. // returns true if vgui is current active
  43. virtual bool IsRunning() = 0;
  44. // runs a single frame of vgui
  45. virtual void RunFrame() = 0;
  46. // broadcasts "ShutdownRequest" "id" message to all top-level panels in the app
  47. virtual void ShutdownMessage(unsigned int shutdownID) = 0;
  48. // panel allocation
  49. virtual VPANEL AllocPanel() = 0;
  50. virtual void FreePanel(VPANEL panel) = 0;
  51. // debugging prints
  52. virtual void DPrintf(PRINTF_FORMAT_STRING const char *format, ...) = 0;
  53. virtual void DPrintf2(PRINTF_FORMAT_STRING const char *format, ...) = 0;
  54. virtual void SpewAllActivePanelNames() = 0;
  55. // safe-pointer handle methods
  56. virtual HPanel PanelToHandle(VPANEL panel) = 0;
  57. virtual VPANEL HandleToPanel(HPanel index) = 0;
  58. virtual void MarkPanelForDeletion(VPANEL panel) = 0;
  59. // makes panel receive a 'Tick' message every frame (~50ms, depending on sleep times/framerate)
  60. // panel is automatically removed from tick signal list when it's deleted
  61. virtual void AddTickSignal(VPANEL panel, int intervalMilliseconds = 0 ) = 0;
  62. virtual void RemoveTickSignal(VPANEL panel) = 0;
  63. // message sending
  64. virtual void PostMessage(VPANEL target, KeyValues *params, VPANEL from, float delaySeconds = 0.0f) = 0;
  65. // Creates/ destroys vgui contexts, which contains information
  66. // about which controls have mouse + key focus, for example.
  67. virtual HContext CreateContext() = 0;
  68. virtual void DestroyContext( HContext context ) = 0;
  69. // Associates a particular panel with a vgui context
  70. // Associating NULL is valid; it disconnects the panel from the context
  71. virtual void AssociatePanelWithContext( HContext context, VPANEL pRoot ) = 0;
  72. // Activates a particular context, use DEFAULT_VGUI_CONTEXT
  73. // to get the one normally used by VGUI
  74. virtual void ActivateContext( HContext context ) = 0;
  75. // whether to sleep each frame or not, true = sleep
  76. virtual void SetSleep( bool state) = 0;
  77. // data accessor for above
  78. virtual bool GetShouldVGuiControlSleep() = 0;
  79. // Resets a particular context, use DEFAULT_VGUI_CONTEXT
  80. // to get the one normally used by VGUI
  81. virtual void ResetContext( HContext context ) = 0;
  82. };
  83. };
  84. #endif // IVGUI_H