ifc_omutility.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef NULLSOFT_WINAMP_OMUTILITY_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMUTILITY_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/dispatch.h>
  7. // {14E8C9B6-1BA4-4e8d-AD26-FA848813CC5B}
  8. static const GUID IFC_OmUtility =
  9. { 0x14e8c9b6, 0x1ba4, 0x4e8d, { 0xad, 0x26, 0xfa, 0x84, 0x88, 0x13, 0xcc, 0x5b } };
  10. #define RESPATH_TARGETIE 0x0001 // IE safe path
  11. #define RESPATH_COMPACT 0x0002 // compact path relative to winamp location if possible
  12. class ifc_omcachemanager;
  13. class ifc_mlnavigationhelper;
  14. class ifc_omimageloader;
  15. class ifc_omgraphics;
  16. class ifc_omstoragehelper;
  17. class __declspec(novtable) ifc_omutility : public Dispatchable
  18. {
  19. public:
  20. typedef void ( CALLBACK *ThreadCallback )( ULONG_PTR /*param*/ );
  21. typedef void ( CALLBACK *ThreadCallback2 )( Dispatchable *object, ULONG_PTR /*param1*/, ULONG_PTR /*param2*/ );
  22. protected:
  23. ifc_omutility() {}
  24. ~ifc_omutility() {}
  25. public:
  26. HRESULT EnsurePathExist( const wchar_t *directory );
  27. HRESULT MakeResourcePath( wchar_t *buffer, unsigned int bufferMax, HINSTANCE instance, const wchar_t *type, const wchar_t *name, unsigned int flags );
  28. HRESULT GetCacheManager( ifc_omcachemanager **cacheManager );
  29. HRESULT GetMlNavigationHelper( HWND hLibrary, ifc_mlnavigationhelper **helper );
  30. HRESULT QueryImageLoader( HINSTANCE hInstance, LPCWSTR pszName, BOOL fPremultiply, ifc_omimageloader **imageLoader );
  31. HRESULT GetGraphics( ifc_omgraphics **graphics );
  32. HRESULT PostMainThreadCallback( ThreadCallback callback, ULONG_PTR param );
  33. HRESULT PostMainThreadCallback2( ThreadCallback2 callback, Dispatchable *object, ULONG_PTR param1, ULONG_PTR param2 );
  34. HRESULT GetStorageHelper( ifc_omstoragehelper **helper );
  35. public:
  36. DISPATCH_CODES
  37. {
  38. API_ENSUREPATHEXIST = 10,
  39. API_MAKERESPATH = 20,
  40. API_GETCACHEMANAGER = 30,
  41. API_GETMLNAVIGATIONHELPER = 40,
  42. API_QUERYIMAGELOADER = 50,
  43. API_GETGRAPHICS = 60,
  44. API_POSTMAINTHREADCALLBACK = 70,
  45. API_POSTMAINTHREADCALLBACK2 = 80,
  46. API_GETSTORAGEHELPER = 90,
  47. };
  48. };
  49. inline HRESULT ifc_omutility::EnsurePathExist(const wchar_t *directory)
  50. {
  51. return _call(API_ENSUREPATHEXIST, (HRESULT)E_NOTIMPL, directory);
  52. }
  53. inline HRESULT ifc_omutility::MakeResourcePath(wchar_t *buffer, unsigned int bufferMax, HINSTANCE instance, const wchar_t *type, const wchar_t *name, unsigned int flags)
  54. {
  55. return _call(API_MAKERESPATH, (HRESULT)E_NOTIMPL, buffer, bufferMax, instance, type, name, flags);
  56. }
  57. inline HRESULT ifc_omutility::GetCacheManager(ifc_omcachemanager **cacheManager)
  58. {
  59. return _call(API_GETCACHEMANAGER, (HRESULT)E_NOTIMPL, cacheManager);
  60. }
  61. inline HRESULT ifc_omutility::GetMlNavigationHelper(HWND hLibrary, ifc_mlnavigationhelper **helper)
  62. {
  63. return _call(API_GETMLNAVIGATIONHELPER, (HRESULT)E_NOTIMPL, hLibrary, helper);
  64. }
  65. inline HRESULT ifc_omutility::QueryImageLoader(HINSTANCE hInstance, LPCWSTR pszName, BOOL fPremultiply, ifc_omimageloader **imageLoader)
  66. {
  67. return _call(API_QUERYIMAGELOADER, (HRESULT)E_NOTIMPL, hInstance, pszName, fPremultiply, imageLoader);
  68. }
  69. inline HRESULT ifc_omutility::GetGraphics(ifc_omgraphics **graphics)
  70. {
  71. return _call(API_GETGRAPHICS, (HRESULT)E_NOTIMPL, graphics);
  72. }
  73. inline HRESULT ifc_omutility::PostMainThreadCallback(ThreadCallback callback, ULONG_PTR param)
  74. {
  75. return _call(API_POSTMAINTHREADCALLBACK, (HRESULT)E_NOTIMPL, callback, param);
  76. }
  77. inline HRESULT ifc_omutility::PostMainThreadCallback2(ThreadCallback2 callback, Dispatchable *object, ULONG_PTR param1, ULONG_PTR param2)
  78. {
  79. return _call(API_POSTMAINTHREADCALLBACK2, (HRESULT)E_NOTIMPL, callback, object, param1, param2);
  80. }
  81. inline HRESULT ifc_omutility::GetStorageHelper(ifc_omstoragehelper **helper)
  82. {
  83. return _call(API_GETSTORAGEHELPER, (HRESULT)E_NOTIMPL, helper);
  84. }
  85. #endif //NULLSOFT_WINAMP_OMUTILITY_INTERFACE_HEADER