apiinit.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. #ifndef __API_INIT_H
  2. #define __API_INIT_H
  3. #include <bfc/platform/platform.h>
  4. #include <api/skin/widgets.h>
  5. #include <bfc/string/bfcstring.h>
  6. #include <api/syscb/api_syscbi.h>
  7. #include <api/service/service.h>
  8. class api_configI;
  9. class SkinApi;
  10. class api_makiI;
  11. class MemMgrApi;
  12. class TimerApi;
  13. class WndApi;
  14. class ForeignWnd;
  15. class ClickWnd;
  16. class ImgLdrApi;
  17. #ifdef WASABI_COMPILE_FONTS
  18. class FontApi;
  19. #endif
  20. #ifdef WASABI_COMPILE_WNDMGR
  21. class WndMgrApi;
  22. #endif
  23. #ifdef WASABI_COMPILE_MAKIDEBUG
  24. class MakiDebuggerApi;
  25. #endif
  26. #ifdef WASABI_COMPILE_FILEREADER
  27. class FileReaderApi;
  28. #endif
  29. #ifdef WASABI_COMPILE_LOCALES
  30. class api_localesI;
  31. #endif
  32. #ifndef WA3COMPATIBILITY
  33. #ifdef WASABI_COMPILE_MEDIACORE
  34. class Core;
  35. #endif
  36. #endif
  37. #include <api/syscb/api_syscb.h>
  38. #ifdef WASABI_COMPILE_MEDIACORE
  39. #include <api/core/api_core.h>
  40. class CoreApiService : public waServiceBase<api_core, CoreApiService> {
  41. public:
  42. CoreApiService() : waServiceBase<api_core, CoreApiService>(coreApiServiceGuid) {}
  43. static const char *getServiceName() { return "Core API"; }
  44. virtual api_core *getService() { return coreApi; }
  45. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  46. };
  47. #endif // WASABI_COMPILE_MEDIACORE
  48. #ifdef WASABI_COMPILE_FILEREADER
  49. #include <api/filereader/api_filereader.h>
  50. class FileReaderApiService : public waServiceBase<api_fileReader, FileReaderApiService> {
  51. public:
  52. FileReaderApiService() : waServiceBase<api_fileReader, FileReaderApiService>(fileReaderApiServiceGuid) {}
  53. static const char *getServiceName() { return "FileReader API"; }
  54. virtual api_fileReader *getService() { return fileApi; }
  55. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  56. };
  57. #endif // WASABI_COMPILE_FILEREADER
  58. #ifdef WASABI_COMPILE_CONFIG
  59. #include <api/config/api_config.h>
  60. class ConfigApiService : public waServiceBase<api_config, ConfigApiService> {
  61. public:
  62. ConfigApiService() : waServiceBase<api_config, ConfigApiService>(configApiServiceGuid) {}
  63. static const char *getServiceName() { return "Config API"; }
  64. virtual api_config *getService() { return configApi; }
  65. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  66. };
  67. #endif // WASABI_COMPILE_CONFIG
  68. #ifdef WASABI_COMPILE_IMGLDR
  69. #include <api/imgldr/api_imgldr.h>
  70. class ImgLdrApiService: public waServiceBase<imgldr_api, ImgLdrApiService> {
  71. public:
  72. ImgLdrApiService() : waServiceBase<imgldr_api, ImgLdrApiService>(imgLdrApiServiceGuid) {}
  73. static const char *getServiceName() { return "Image Loading API"; }
  74. virtual imgldr_api *getService() { return imgLoaderApi; }
  75. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  76. };
  77. #endif // WASABI_COMPILE_IMGLDR
  78. #ifdef WASABI_COMPILE_FONTS
  79. #include <api/font/api_font.h>
  80. class FontApiService : public waServiceBase<api_font, FontApiService> {
  81. public:
  82. FontApiService() : waServiceBase<api_font, FontApiService>(fontApiServiceGuid) {}
  83. static const char *getServiceName() { return "Font Rendering API"; }
  84. virtual api_font *getService() { return fontApi; }
  85. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  86. };
  87. #endif // WASABI_COMPILE_FONT
  88. #include <api/locales/api_locales.h>
  89. class LocalesApiService : public waServiceBase<api_locales, LocalesApiService> {
  90. public:
  91. LocalesApiService() : waServiceBase<api_locales, LocalesApiService>(localesApiServiceGuid) {}
  92. static const char *getServiceName() { return "Locales API"; }
  93. virtual api_locales *getService() { return localesApi; }
  94. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  95. };
  96. #include <api/wnd/api_wnd.h>
  97. class WndApiService : public waServiceBase<wnd_api, WndApiService> {
  98. public:
  99. WndApiService() : waServiceBase<wnd_api, WndApiService>(wndApiServiceGuid) {}
  100. static const char *getServiceName() { return "Windowing API"; }
  101. virtual wnd_api *getService() { return wndApi; }
  102. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  103. };
  104. #include <api/wndmgr/api_wndmgr.h>
  105. class WndMgrApiService : public waServiceBase<wndmgr_api, WndMgrApiService> {
  106. public:
  107. WndMgrApiService() : waServiceBase<wndmgr_api, WndMgrApiService>(wndMgrApiServiceGuid) {}
  108. static const char *getServiceName() { return "Window Manager API"; }
  109. virtual wndmgr_api *getService() { return wndManagerApi; }
  110. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  111. };
  112. #include <api/skin/api_skin.h>
  113. class SkinApiService : public waServiceBase<api_skin, SkinApiService> {
  114. public:
  115. SkinApiService() : waServiceBase<api_skin, SkinApiService>(skinApiServiceGuid) {}
  116. static const char *getServiceName() { return "Skinning API"; }
  117. virtual api_skin *getService() { return skinApi; }
  118. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  119. };
  120. #include <api/script/api_maki.h>
  121. class MakiApiService : public waServiceBase<api_maki, MakiApiService> {
  122. public:
  123. MakiApiService() : waServiceBase<api_maki, MakiApiService>(makiApiServiceGuid) {}
  124. static const char *getServiceName() { return "MAKI Scripting API"; }
  125. virtual api_maki *getService() { return makiApi; }
  126. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  127. };
  128. #ifdef WASABI_COMPILE_MAKIDEBUG
  129. #include <api/script/debugger/api_makidebug.h>
  130. class MakiDebugApiService : public waServiceBase<api_makiDebugger, MakiDebugApiService> {
  131. public:
  132. MakiDebugApiService() : waServiceBase<api_makiDebugger, MakiDebugApiService>(makiDebugApiServiceGuid) {}
  133. static const char *getServiceName() { return "MAKI Debugger API"; }
  134. virtual api_makiDebugger *getService() { return debugApi; }
  135. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  136. };
  137. #endif // WASABI_COMPILE_SKIN
  138. class ApiInit
  139. {
  140. public:
  141. static int init(OSMODULEHANDLE hinstance, OSWINDOWHANDLE mainwnd, api_service *wa5_svc); // 0 == error, 1 == success
  142. static int shutdown(); // 0 == error, 1 == success
  143. static int getInitCount(); // if you do init / shutdown more than once in the session, this may be useful to invalid some caches
  144. private:
  145. #ifdef WASABI_COMPILE_SKIN
  146. #ifdef WASABI_COMPILE_COMPONENTS
  147. static waServiceFactoryI * groupcreate;
  148. #endif //WASABI_COMPILE_COMPONENTS
  149. #endif //WASABI_COMPILE_SKIN
  150. static waServiceFactoryI * win32Font;
  151. static FontApiService *fontapisvc;
  152. public:
  153. static Widgets * widgets;
  154. private:
  155. static SkinApiService *skinapisvc;
  156. static api_configI * cfg;
  157. static ConfigApiService *cfgapisvc;
  158. static ImgLdrApi * img;
  159. static ImgLdrApiService *imgldrapisvc;
  160. #ifdef WASABI_COMPILE_FONTS
  161. static FontApi * font;
  162. #endif
  163. #ifdef WASABI_COMPILE_FILEREADER
  164. static FileReaderApi * fr;
  165. #ifdef WASABI_COMPILE_ZIPREADER
  166. static waServiceFactoryI * zipRead;
  167. #endif
  168. static FileReaderApiService *frapisvc;
  169. #endif
  170. static api_localesI *loc;
  171. static LocalesApiService *localesapisvc;
  172. static WndApi * wnd;
  173. static ForeignWnd * mainWnd;
  174. static ClickWnd * default_mainWnd;
  175. static WndApiService *wndapisvc;
  176. static WndMgrApi * wndmgr;
  177. static WndMgrApiService *wndmgrapisvc;
  178. static api_makiI * maki;
  179. static MakiApiService *makiapisvc;
  180. static SkinApi * skin;
  181. #ifdef WASABI_COMPILE_MAKIDEBUG
  182. static MakiDebuggerApi * debug;
  183. static MakiDebugApiService *makidebugapisvc;
  184. #endif
  185. #ifdef WASABI_COMPILE_MEDIACORE
  186. static CoreApiService *coreapisvc;
  187. #endif
  188. static int initcount;
  189. };
  190. #endif