1
0

skinHelper.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #ifndef NULLSOFT_WINAMP_SKIN_HELPER_HEADER
  2. #define NULLSOFT_WINAMP_SKIN_HELPER_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include "../Plugins/General/gen_ml/ml_ipc_0313.h"
  8. #include "../Plugins/General/gen_ml/colors.h"
  9. #include "../winamp/wa_ipc.h"
  10. #include "../winamp/wa_dlg.h"
  11. #include "./ifc_skinhelper.h"
  12. #include "./ifc_skinnedmenu.h"
  13. #include "./ifc_skinnedrating.h"
  14. #include "./ifc_skinnedbrowser.h"
  15. #include <bfc/multipatch.h>
  16. #define MPIID_SKINHELPER 10
  17. #define MPIID_SKINNEDMENU 20
  18. #define MPIID_SKINNEDRATING 30
  19. #define MPIID_SKINNEDBROWSER 40
  20. class SkinHelper : public MultiPatch<MPIID_SKINHELPER, ifc_skinhelper>,
  21. public MultiPatch<MPIID_SKINNEDMENU, ifc_skinnedmenu>,
  22. public MultiPatch<MPIID_SKINNEDRATING, ifc_skinnedrating>,
  23. public MultiPatch<MPIID_SKINNEDBROWSER, ifc_skinnedbrowser>
  24. {
  25. protected:
  26. SkinHelper(HWND hwndWa);
  27. ~SkinHelper();
  28. public:
  29. static HRESULT CreateInstance(HWND hwndWinamp, SkinHelper **instance);
  30. public:
  31. /* Dispatchable */
  32. size_t AddRef();
  33. size_t Release();
  34. int QueryInterface(GUID interface_guid, void **object);
  35. /* ifc_skinhelper */
  36. HRESULT GetColor(UINT colorIndex, COLORREF *pColor);
  37. HRESULT GetColorEx(UINT uObject, UINT uPart, UINT uState, COLORREF *pColor);
  38. HRESULT GetBrush(UINT colorIndex, HBRUSH *pBrush);
  39. HFONT GetFont(void);
  40. HRESULT SkinWindow(HWND hwnd, const GUID *windowGuid, UINT flagsEx, FFCALLBACK callbackFF);
  41. HRESULT SkinControl(HWND hwnd, UINT type, UINT style);
  42. HRESULT UnskinWindow(HWND hwnd);
  43. /* ifc_skinnedmenu */
  44. BOOL TrackPopup(HMENU hMenu, UINT fuFlags, INT x, INT y, HWND hwnd, LPTPMPARAMS lptpm, ifc_menucustomizer *customizer);
  45. HRESULT IsPopupEnabled(void);
  46. HANDLE InitPopupHook(HWND hwnd, ifc_menucustomizer *customizer);
  47. HRESULT RemovePopupHook(HANDLE popupHook);
  48. /* ifc_skinnedrating */
  49. HRESULT RatingDraw(HDC hdc, INT maxValue, INT value, INT trackingVal, RECT *prc, UINT fStyle);
  50. HRESULT RatingHitTest(POINT pt, INT maxValue, RECT *prc, UINT fStyle, LONG *result);
  51. HRESULT RatingCalcMinRect(INT maxValue, RECT *prc);
  52. HRESULT RatingCreateMenuCustomizer(HMENU hMenu, ifc_menucustomizer **customizer);
  53. /* ifc_skinnedbrowser */
  54. HRESULT Browser_GetHostCss(wchar_t **ppchHostCss);
  55. COLORREF Browser_GetBackColor(void);
  56. COLORREF Browser_GetTextColor(void);
  57. COLORREF Browser_GetLinkColor(void);
  58. COLORREF Browser_GetActiveLinkColor(void);
  59. COLORREF Browser_GetVisitedLinkColor(void);
  60. COLORREF Browser_GetHoveredLinkColor(void);
  61. public:
  62. HFONT CreateSkinFont(void);
  63. void ResetColorCache(void);
  64. void ResetFontCache(void);
  65. protected:
  66. HRESULT LoadMediaLibraryModule(void);
  67. HRESULT InitializeColorData(void);
  68. HRESULT MlTrackSkinnedPopupMenuEx(HMENU hmenu, UINT fuFlags, INT x, INT y, HWND hwnd, LPTPMPARAMS lptpm, HMLIMGLST hmlil, INT width, UINT skinStyle, MENUCUSTOMIZEPROC customProc, ULONG_PTR customParam, INT *resultOut);
  69. HRESULT MlInitSkinnedPopupHook(HWND hwnd, HMLIMGLST hmlil, INT width, UINT skinStyle, MENUCUSTOMIZEPROC customProc, ULONG_PTR customParam, HANDLE *hookOut);
  70. protected:
  71. RECVS_MULTIPATCH;
  72. protected:
  73. typedef BOOL (__cdecl *MLSKINWINDOWEX)(HWND /*hwnd*/, INT /*type*/, UINT /*style*/);
  74. typedef BOOL (__cdecl *MLUNSKINWINDOW)(HWND /*hwnd*/);
  75. typedef BOOL (__cdecl *MLGETSKINCOLOR)(UINT /*uObject*/, UINT /*uPart*/, UINT /*uState*/, COLORREF* /*pColor*/);
  76. typedef void (__cdecl *MLRESETSKINCOLOR)(void);
  77. typedef BOOL (__cdecl *MLTRACKSKINNEDPOPUPMENUEX)(HMENU /*hmenu*/, UINT /*fuFlags*/, INT /*x*/, INT /*y*/, HWND /*hwnd*/,
  78. LPTPMPARAMS /*lptpm*/, HMLIMGLST /*hmlil*/, INT /*width*/, UINT /*skinStyle*/,
  79. MENUCUSTOMIZEPROC /*customProc*/, ULONG_PTR /*customParam*/);
  80. typedef BOOL (__cdecl *MLISSKINNEDPOPUPENABLED)(void);
  81. typedef HANDLE (__cdecl *MLINITSKINNEDPOPUPHOOK)(HWND /*hwnd*/, HMLIMGLST /*hmlil*/, INT /*width*/, UINT /*skinStyle*/,
  82. MENUCUSTOMIZEPROC /*customProc*/, ULONG_PTR /*customParam*/);
  83. typedef void (__cdecl *MLREMOVESKINNEDPOPUPHOOK)(HANDLE /*hPopupHook*/);
  84. typedef BOOL (__cdecl *MLRATINGDRAW)(HDC /*hdc*/, INT /*maxValue*/, INT /*value*/, INT /*trackingVal*/, HMLIMGLST /*hmlil*/, INT /*index*/, RECT* /*prc*/, UINT /*fStyle*/);
  85. typedef LONG (__cdecl *MLRATINGHITTEST)(POINT /*pt*/, INT /*maxValue*/, HMLIMGLST /*hmlil*/, RECT* /*prc*/, UINT /*fStyle*/);
  86. typedef BOOL (__cdecl *MLRATINGCALCMINRECT)(INT /*maxValue*/, HMLIMGLST /*hmlil*/, RECT* /*prc*/);
  87. protected:
  88. ULONG ref;
  89. HWND hwndWinamp;
  90. HMODULE mlModule;
  91. HRESULT mlLoadResult;
  92. HFONT playlistFont;
  93. HBRUSH szBrushes[WADLG_NUM_COLORS];
  94. BOOL initializeColors;
  95. size_t cchHostCss;
  96. MLSKINWINDOWEX mlSkinWindowEx;
  97. MLUNSKINWINDOW mlUnskinWindow;
  98. MLTRACKSKINNEDPOPUPMENUEX mlTrackSkinnedPopupMenuEx;
  99. MLISSKINNEDPOPUPENABLED mlIsSkinnedPopupEnabled;
  100. MLINITSKINNEDPOPUPHOOK mlInitSkinnedPopupHook;
  101. MLREMOVESKINNEDPOPUPHOOK mlRemoveSkinnedPopupHook;
  102. MLGETSKINCOLOR mlGetSkinColor;
  103. MLRESETSKINCOLOR mlResetSkinColor;
  104. MLRATINGDRAW mlRatingDraw;
  105. MLRATINGHITTEST mlRatingHitTest;
  106. MLRATINGCALCMINRECT mlRatingCalcMinRect;
  107. WCHAR szHostCss[396];
  108. };
  109. #endif // NULLSOFT_WINAMP_SKIN_HELPER_HEADER