svc_wndcreate.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef _SVC_WNDCREATE_H
  2. #define _SVC_WNDCREATE_H
  3. #include <bfc/dispatch.h>
  4. #include <api/service/services.h>
  5. #define BUCKETITEM L"buck"
  6. #define PLAYLISTSIDECAR L"plsc"
  7. class ifc_window;
  8. class NOVTABLE svc_windowCreate : public Dispatchable
  9. {
  10. public:
  11. static FOURCC getServiceType() { return WaSvc::WINDOWCREATE; }
  12. int testGuid(GUID g);
  13. ifc_window *createWindowByGuid(GUID g, ifc_window *parent);
  14. int testType(const wchar_t *windowtype);
  15. ifc_window *createWindowOfType(const wchar_t *windowtype, ifc_window *parent, int n = 0);
  16. int destroyWindow(ifc_window *w);
  17. int refcount(); // how many windows created
  18. enum {
  19. TESTGUID = 100,
  20. CREATEWINDOWBYGUID = 200,
  21. TESTTYPE = 301,
  22. CREATEWINDOWOFTYPE = 402,
  23. DESTROYWINDOW = 500,
  24. REFCOUNT = 600,
  25. };
  26. };
  27. inline int svc_windowCreate::testGuid(GUID g)
  28. {
  29. return _call(TESTGUID, 0, g);
  30. }
  31. inline ifc_window *svc_windowCreate::createWindowByGuid(GUID g, ifc_window *parent)
  32. {
  33. return _call(CREATEWINDOWBYGUID, (ifc_window*)0, g, parent);
  34. }
  35. inline int svc_windowCreate::destroyWindow(ifc_window *w)
  36. {
  37. return _call(DESTROYWINDOW, 0, w);
  38. }
  39. inline int svc_windowCreate::testType(const wchar_t *windowtype)
  40. {
  41. return _call(TESTTYPE, 0, windowtype);
  42. }
  43. inline ifc_window *svc_windowCreate::createWindowOfType(const wchar_t * windowtype, ifc_window *parent, int n)
  44. {
  45. return _call(CREATEWINDOWOFTYPE, (ifc_window*)0, windowtype, parent, n);
  46. }
  47. inline int svc_windowCreate::refcount()
  48. {
  49. return _call(REFCOUNT, -1);
  50. }
  51. class NOVTABLE svc_windowCreateI : public svc_windowCreate
  52. {
  53. public:
  54. virtual ~svc_windowCreateI() { }
  55. virtual int testGuid(GUID g) { return 0; }
  56. virtual ifc_window *createWindowByGuid(GUID g, ifc_window *parent) { return NULL; }
  57. virtual int testType(const wchar_t *windowtype) { return 0; }
  58. virtual ifc_window *createWindowOfType(const wchar_t *windowtype, ifc_window *parent, int n) { return NULL; }
  59. virtual int destroyWindow(ifc_window *w) = 0;
  60. virtual int refcount() { return -1; } // FUCKO: make pure abstract
  61. protected:
  62. RECVS_DISPATCH;
  63. };
  64. #include <api/service/servicei.h>
  65. template <class T>
  66. class WndCreateCreator : public waServiceFactoryT<svc_windowCreate, T> {};
  67. template <class T>
  68. class WndCreateCreatorSingle : public waServiceFactoryTSingle<svc_windowCreate, T> {};
  69. #include <api/service/svc_enum.h>
  70. #include <bfc/string/StringW.h>
  71. class WindowCreateByGuidEnum : public SvcEnumT<svc_windowCreate>
  72. {
  73. public:
  74. WindowCreateByGuidEnum(GUID _g) : targetguid(_g) { }
  75. protected:
  76. virtual int testService(svc_windowCreate *svc)
  77. {
  78. return svc->testGuid(targetguid);
  79. }
  80. private:
  81. GUID targetguid;
  82. };
  83. class WindowCreateByTypeEnum : public SvcEnumT<svc_windowCreate>
  84. {
  85. public:
  86. WindowCreateByTypeEnum(const wchar_t *_wtype) : wtype(_wtype) { }
  87. protected:
  88. virtual int testService(svc_windowCreate *svc)
  89. {
  90. return svc->testType(wtype);
  91. }
  92. private:
  93. StringW wtype;
  94. };
  95. #endif