blob: 76493dbecba4de2c4521cddae232c7ce1e31c860 (
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Handles loading/unloading of different vgui modules into a shared context
//
//=============================================================================//
#ifndef VGUISYSTEMMODULELOADER_H
#define VGUISYSTEMMODULELOADER_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/PHandle.h"
#include "utlvector.h"
#include "IVGuiModuleLoader.h"
class IVGuiModule;
class KeyValues;
//-----------------------------------------------------------------------------
// Purpose: Handles loading/unloading of different vgui modules into a shared context
//-----------------------------------------------------------------------------
class CVGuiSystemModuleLoader : public IVGuiModuleLoader
{
public:
CVGuiSystemModuleLoader();
~CVGuiSystemModuleLoader();
// loads all the modules in the platform
bool LoadPlatformModules(CreateInterfaceFn *factorylist, int factorycount, bool useSteamModules);
// returns true if the module loader has loaded the modules
bool IsPlatformReady();
// needs to be called every frame - updates all the modules states
void RunFrame();
// returns number of modules loaded
int GetModuleCount();
// returns the string menu name (unlocalized) of a module
// moduleIndex is of the range [0, GetModuleCount())
const char *GetModuleLabel(int moduleIndex);
bool IsModuleHidden(int moduleIndex);
bool IsModuleVisible(int moduleIndex);
// returns a modules interface factory
CreateInterfaceFn GetModuleFactory(int moduleIndex);
// brings the specified module to the foreground
bool ActivateModule(int moduleIndex);
bool ActivateModule(const char *moduleName);
// Deactivates all the modules (puts them into in inactive but recoverable state)
void DeactivatePlatformModules();
// Reenables all the deactivated platform modules
void ReactivatePlatformModules();
// shuts down all the platform modules
void ShutdownPlatformModules();
// unload all active platform modules/dlls from memory
void UnloadPlatformModules();
// posts a message to all active modules
void PostMessageToAllModules(KeyValues *message);
// sets the the platform should update and restart when it quits
void SetPlatformToRestart();
// returns true if the platform should restart after exit
bool ShouldPlatformRestart();
private:
// sets up all the modules for use
bool InitializeAllModules(CreateInterfaceFn *factorylist, int factorycount);
bool m_bModulesInitialized;
bool m_bPlatformShouldRestartAfterExit;
struct module_t
{
CSysModule *module;
IVGuiModule *moduleInterface;
KeyValues *data;
};
CUtlVector<module_t> m_Modules;
KeyValues *m_pPlatformModuleData;
};
extern CVGuiSystemModuleLoader g_VModuleLoader;
#endif // VGUISYSTEMMODULELOADER_H
|