1
0

ifc_deviceeventmanager.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #ifndef _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_INTERFACE_HEADER
  2. #define _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/platform/guid.h>
  7. // {C563C537-DFFC-4210-BB1E-E424426789E2}
  8. static const GUID IFC_DeviceEventManager =
  9. { 0xc563c537, 0xdffc, 0x4210, { 0xbb, 0x1e, 0xe4, 0x24, 0x42, 0x67, 0x89, 0xe2 } };
  10. #include <bfc/dispatch.h>
  11. class ifc_deviceevent;
  12. // supports AddRef(), Release(), QueryInterface()
  13. class __declspec(novtable) ifc_deviceeventmanager : public Dispatchable
  14. {
  15. protected:
  16. ifc_deviceeventmanager() {}
  17. ~ifc_deviceeventmanager() {}
  18. public:
  19. HRESULT Advise(ifc_deviceevent *handler);
  20. HRESULT Unadvise(ifc_deviceevent *handler);
  21. void Notify_IconChanged(ifc_device *device);
  22. void Notify_DisplayNameChanged(ifc_device *device, const wchar_t *displayName);
  23. void Notify_AttachmentChanged(ifc_device *device, BOOL attached);
  24. void Notify_VisibilityChanged(ifc_device *device, BOOL visible);
  25. void Notify_TotalSpaceChanged(ifc_device *device, uint64_t space);
  26. void Notify_UsedSpaceChanged(ifc_device *device, uint64_t space);
  27. void Notify_CommandChanged(ifc_device *device);
  28. void Notify_ActivityStarted(ifc_device *device, ifc_deviceactivity *activity);
  29. void Notify_ActivityFinished(ifc_device *device, ifc_deviceactivity *activity);
  30. void Notify_ActivityChanged(ifc_device *device, ifc_deviceactivity *activity);
  31. void Notify_ModelChanged(ifc_device *device, const wchar_t *model);
  32. void Notify_StatusChanged(ifc_device *device, const wchar_t *status);
  33. public:
  34. DISPATCH_CODES
  35. {
  36. API_ADVISE = 10,
  37. API_UNADVISE = 20,
  38. API_NOTIFY_ICONCHANGED = 30,
  39. API_NOTIFY_DISPLAYNAMECHANGED = 40,
  40. API_NOTIFY_ATTACHMENTCHANGED = 50,
  41. API_NOTIFY_VISIBILITYCHANGED = 60,
  42. API_NOTIFY_TOTALSPACECHANGED = 70,
  43. API_NOTIFY_USEDSPACECHANGED = 80,
  44. API_NOTIFY_COMMANDCHANGED = 90,
  45. API_NOTIFY_ACTIVITYSTARTED = 100,
  46. API_NOTIFY_ACTIVITYFINISHED = 110,
  47. API_NOTIFY_ACTIVITYCHANGED = 120,
  48. API_NOTIFY_MODELCHANGED = 130,
  49. API_NOTIFY_STATUSCHANGED = 140,
  50. };
  51. };
  52. inline HRESULT ifc_deviceeventmanager::Advise(ifc_deviceevent *handler)
  53. {
  54. return _call(API_ADVISE, (HRESULT)E_NOTIMPL, handler);
  55. }
  56. inline HRESULT ifc_deviceeventmanager::Unadvise(ifc_deviceevent *handler)
  57. {
  58. return _call(API_UNADVISE, (HRESULT)E_NOTIMPL, handler);
  59. }
  60. inline void ifc_deviceeventmanager::Notify_IconChanged(ifc_device *device)
  61. {
  62. _voidcall(API_NOTIFY_ICONCHANGED, device);
  63. }
  64. inline void ifc_deviceeventmanager::Notify_DisplayNameChanged(ifc_device *device, const wchar_t *displayName)
  65. {
  66. _voidcall(API_NOTIFY_DISPLAYNAMECHANGED, device, displayName);
  67. }
  68. inline void ifc_deviceeventmanager::Notify_AttachmentChanged(ifc_device *device, BOOL attached)
  69. {
  70. _voidcall(API_NOTIFY_ATTACHMENTCHANGED, device, attached);
  71. }
  72. inline void ifc_deviceeventmanager::Notify_VisibilityChanged(ifc_device *device, BOOL visible)
  73. {
  74. _voidcall(API_NOTIFY_VISIBILITYCHANGED, device, visible);
  75. }
  76. inline void ifc_deviceeventmanager::Notify_TotalSpaceChanged(ifc_device *device, uint64_t space)
  77. {
  78. _voidcall(API_NOTIFY_TOTALSPACECHANGED, device, space);
  79. }
  80. inline void ifc_deviceeventmanager::Notify_UsedSpaceChanged(ifc_device *device, uint64_t space)
  81. {
  82. _voidcall(API_NOTIFY_USEDSPACECHANGED, device, space);
  83. }
  84. inline void ifc_deviceeventmanager::Notify_CommandChanged(ifc_device *device)
  85. {
  86. _voidcall(API_NOTIFY_COMMANDCHANGED, device);
  87. }
  88. inline void ifc_deviceeventmanager::Notify_ActivityStarted(ifc_device *device, ifc_deviceactivity *activity)
  89. {
  90. _voidcall(API_NOTIFY_ACTIVITYSTARTED, device, activity);
  91. }
  92. inline void ifc_deviceeventmanager::Notify_ActivityFinished(ifc_device *device, ifc_deviceactivity *activity)
  93. {
  94. _voidcall(API_NOTIFY_ACTIVITYFINISHED, device, activity);
  95. }
  96. inline void ifc_deviceeventmanager::Notify_ActivityChanged(ifc_device *device, ifc_deviceactivity *activity)
  97. {
  98. _voidcall(API_NOTIFY_ACTIVITYCHANGED, device, activity);
  99. }
  100. inline void ifc_deviceeventmanager::Notify_ModelChanged(ifc_device *device, const wchar_t *model)
  101. {
  102. _voidcall(API_NOTIFY_MODELCHANGED, device, model);
  103. }
  104. inline void ifc_deviceeventmanager::Notify_StatusChanged(ifc_device *device, const wchar_t *status)
  105. {
  106. _voidcall(API_NOTIFY_STATUSCHANGED, device, status);
  107. }
  108. #endif //_NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_INTERFACE_HEADER