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.

97 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Handles loading/unloading of different vgui modules into a shared context
  4. //
  5. //=============================================================================//
  6. #ifndef VGUISYSTEMMODULELOADER_H
  7. #define VGUISYSTEMMODULELOADER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/PHandle.h"
  12. #include "UtlVector.h"
  13. #include "IVGuiModuleLoader.h"
  14. class IVGuiModule;
  15. class KeyValues;
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Handles loading/unloading of different vgui modules into a shared context
  18. //-----------------------------------------------------------------------------
  19. class CVGuiSystemModuleLoader : public IVGuiModuleLoader
  20. {
  21. public:
  22. CVGuiSystemModuleLoader();
  23. ~CVGuiSystemModuleLoader();
  24. // loads all the modules in the platform
  25. bool LoadPlatformModules(CreateInterfaceFn *factorylist, int factorycount, bool useSteamModules);
  26. // returns true if the module loader has loaded the modules
  27. bool IsPlatformReady();
  28. // needs to be called every frame - updates all the modules states
  29. void RunFrame();
  30. // returns number of modules loaded
  31. int GetModuleCount();
  32. // returns the string menu name (unlocalized) of a module
  33. // moduleIndex is of the range [0, GetModuleCount())
  34. const char *GetModuleLabel(int moduleIndex);
  35. bool IsModuleHidden(int moduleIndex);
  36. bool IsModuleVisible(int moduleIndex);
  37. // returns a modules interface factory
  38. CreateInterfaceFn GetModuleFactory(int moduleIndex);
  39. // brings the specified module to the foreground
  40. bool ActivateModule(int moduleIndex);
  41. bool ActivateModule(const char *moduleName);
  42. // Deactivates all the modules (puts them into in inactive but recoverable state)
  43. void DeactivatePlatformModules();
  44. // Reenables all the deactivated platform modules
  45. void ReactivatePlatformModules();
  46. // shuts down all the platform modules
  47. void ShutdownPlatformModules();
  48. // unload all active platform modules/dlls from memory
  49. void UnloadPlatformModules();
  50. // posts a message to all active modules
  51. void PostMessageToAllModules(KeyValues *message);
  52. // sets the the platform should update and restart when it quits
  53. void SetPlatformToRestart();
  54. // returns true if the platform should restart after exit
  55. bool ShouldPlatformRestart();
  56. private:
  57. // sets up all the modules for use
  58. bool InitializeAllModules(CreateInterfaceFn *factorylist, int factorycount);
  59. bool m_bModulesInitialized;
  60. bool m_bPlatformShouldRestartAfterExit;
  61. struct module_t
  62. {
  63. CSysModule *module;
  64. IVGuiModule *moduleInterface;
  65. KeyValues *data;
  66. };
  67. CUtlVector<module_t> m_Modules;
  68. KeyValues *m_pPlatformModuleData;
  69. };
  70. extern CVGuiSystemModuleLoader g_VModuleLoader;
  71. #endif // VGUISYSTEMMODULELOADER_H