diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/devices/deviceEventManager.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/devices/deviceEventManager.h')
-rw-r--r-- | Src/devices/deviceEventManager.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Src/devices/deviceEventManager.h b/Src/devices/deviceEventManager.h new file mode 100644 index 00000000..c5790fe9 --- /dev/null +++ b/Src/devices/deviceEventManager.h @@ -0,0 +1,64 @@ +#ifndef _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER +#define _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include "./ifc_deviceevent.h" +#include "./ifc_deviceeventmanager.h" +#include <vector> + +class DeviceEventManager : public ifc_deviceeventmanager +{ + +protected: + DeviceEventManager(); + ~DeviceEventManager(); + +public: + static HRESULT CreateInstance(DeviceEventManager **instance); + +public: + /* Dispatchable */ + size_t AddRef(); + size_t Release(); + int QueryInterface(GUID interface_guid, void **object); + + /* ifc_deviceeventmanager */ + HRESULT Advise(ifc_deviceevent *handler); + HRESULT Unadvise(ifc_deviceevent *handler); + + void Notify_IconChanged(ifc_device *device); + void Notify_DisplayNameChanged(ifc_device *device, const wchar_t *displayName); + void Notify_AttachmentChanged(ifc_device *device, BOOL attached); + void Notify_VisibilityChanged(ifc_device *device, BOOL visible); + void Notify_TotalSpaceChanged(ifc_device *device, uint64_t space); + void Notify_UsedSpaceChanged(ifc_device *device, uint64_t space); + void Notfiy_CommandChanged(ifc_device *device); + void Notify_ActivityStarted(ifc_device *device, ifc_deviceactivity *activity); + void Notify_ActivityFinished(ifc_device *device, ifc_deviceactivity *activity); + void Notify_ActivityChanged(ifc_device *device, ifc_deviceactivity *activity); + void Notify_ModelChanged(ifc_device *device, const wchar_t *model); + void Notify_StatusChanged(ifc_device *device, const wchar_t *status); + +public: + void Lock(); + void Unlock(); + +protected: + typedef std::vector<ifc_deviceevent*> HandlerList; + +protected: + size_t ref; + HandlerList handlerList; + CRITICAL_SECTION lock; + +protected: + RECVS_DISPATCH; + + + +}; + +#endif // _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER
\ No newline at end of file |