browserObject.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef NULLSOFT_WINAMP_OMBROWSER_OBJECT_HEADER
  2. #define NULLSOFT_WINAMP_OMBROWSER_OBJECT_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./obj_ombrowser.h"
  7. #include "./ifc_ombrowserwndmngr.h"
  8. #include "./ifc_ombrowsereventmngr.h"
  9. #include <bfc/multipatch.h>
  10. #include <vector>
  11. #define MPIID_OMBROWSER 10
  12. #define MPIID_OMBROWSERWNDMNGR 20
  13. #define MPIID_OMBROWSEREVENTMNGR 30
  14. class OmBrowserWndRecord;
  15. class OmBrowserObject : public MultiPatch<MPIID_OMBROWSER, obj_ombrowser>,
  16. public MultiPatch<MPIID_OMBROWSERWNDMNGR, ifc_ombrowserwndmngr>,
  17. public MultiPatch<MPIID_OMBROWSEREVENTMNGR, ifc_ombrowsereventmngr>
  18. {
  19. public:
  20. typedef enum
  21. {
  22. flagFinishing = 0x0001,
  23. } Falgs;
  24. protected:
  25. OmBrowserObject();
  26. ~OmBrowserObject();
  27. public:
  28. static HRESULT CreateInstance(OmBrowserObject **instance);
  29. public:
  30. /* Dispatchable */
  31. size_t AddRef();
  32. size_t Release();
  33. int QueryInterface(GUID interface_guid, void **object);
  34. /* obj_ombrowser */
  35. HRESULT Initialize(LPCWSTR pszName, HWND hwndWinamp);
  36. HRESULT Finish(void);
  37. HRESULT RegisterWinampHook(ifc_winamphook *hook, UINT *cookieOut);
  38. HRESULT UnregisterWinampHook(UINT cookie);
  39. HRESULT GetConfig(const GUID *configIfc, void **configOut);
  40. HRESULT GetSessionId(LPWSTR pszBuffer, INT cchBufferMax);
  41. HRESULT GetClientId(LPWSTR pszBuffer, INT cchBufferMax);
  42. HRESULT GetRegistry(ifc_ombrowserregistry **registryOut);
  43. HRESULT CreateView(ifc_omservice *service, HWND hParent, LPCWSTR forceUrl, UINT viewStyle, HWND *hView);
  44. HRESULT CreatePopup(ifc_omservice *service, INT x, INT y, INT cx, INT cy, HWND hOwner, LPCWSTR forceUrl, UINT viewStyle, HWND *hWindow);
  45. HRESULT ShowOptions(HWND hOwner, UINT style, BROWSEROPTIONSCALLBACK callback, ULONG_PTR user);
  46. HRESULT IsFinishing(void);
  47. HRESULT GetClass(ifc_ombrowserclass **instance);
  48. HRESULT GetVersion(int *major, int *minor);
  49. HRESULT GetIEVersion(int *major, int *minor, int *build, int *subbuild);
  50. /* ifc_ombrowserwndmngr */
  51. HRESULT RegisterWindow(HWND hwnd, const GUID *windowType);
  52. HRESULT UnregisterWindow(HWND hwnd);
  53. HRESULT Enumerate(const GUID *windowType, UINT *serviceIdFilter, ifc_ombrowserwndenum **enumerator);
  54. /* ifc_ombrowsereventmngr */
  55. HRESULT RegisterEventHandler(ifc_ombrowserevent *eventHandler);
  56. HRESULT UnregisterEventHandler(ifc_ombrowserevent *eventHandler);
  57. HRESULT Signal_WindowCreate(HWND hwnd, const GUID *windowType);
  58. HRESULT Signal_WindowClose(HWND hwnd, const GUID *windowType);
  59. protected:
  60. LPCWSTR GetConfigFileInt(void);
  61. protected:
  62. typedef struct __WindowRecord
  63. {
  64. HWND hwnd;
  65. GUID type;
  66. } WindowRecord;
  67. typedef std::vector<OmBrowserWndRecord*> WindowList;
  68. typedef std::vector<ifc_ombrowserevent*> EventList;
  69. protected:
  70. ULONG ref;
  71. UINT flags;
  72. WindowList windowList;
  73. ifc_ombrowserclass *browserClass;
  74. EventList eventList;
  75. CRITICAL_SECTION lock;
  76. protected:
  77. RECVS_MULTIPATCH;
  78. };
  79. #endif //NULLSOFT_WINAMP_OMBROWSER_OBJECT_HEADER