diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/omBrowser/skinHelper.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/omBrowser/skinHelper.h')
-rw-r--r-- | Src/omBrowser/skinHelper.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/Src/omBrowser/skinHelper.h b/Src/omBrowser/skinHelper.h new file mode 100644 index 00000000..1b7dddfd --- /dev/null +++ b/Src/omBrowser/skinHelper.h @@ -0,0 +1,133 @@ +#ifndef NULLSOFT_WINAMP_SKIN_HELPER_HEADER +#define NULLSOFT_WINAMP_SKIN_HELPER_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include <wtypes.h> +#include "../Plugins/General/gen_ml/ml_ipc_0313.h" +#include "../Plugins/General/gen_ml/colors.h" +#include "../winamp/wa_ipc.h" +#include "../winamp/wa_dlg.h" + +#include "./ifc_skinhelper.h" +#include "./ifc_skinnedmenu.h" +#include "./ifc_skinnedrating.h" +#include "./ifc_skinnedbrowser.h" + +#include <bfc/multipatch.h> + +#define MPIID_SKINHELPER 10 +#define MPIID_SKINNEDMENU 20 +#define MPIID_SKINNEDRATING 30 +#define MPIID_SKINNEDBROWSER 40 + +class SkinHelper : public MultiPatch<MPIID_SKINHELPER, ifc_skinhelper>, + public MultiPatch<MPIID_SKINNEDMENU, ifc_skinnedmenu>, + public MultiPatch<MPIID_SKINNEDRATING, ifc_skinnedrating>, + public MultiPatch<MPIID_SKINNEDBROWSER, ifc_skinnedbrowser> +{ + +protected: + SkinHelper(HWND hwndWa); + ~SkinHelper(); + +public: + static HRESULT CreateInstance(HWND hwndWinamp, SkinHelper **instance); + +public: + /* Dispatchable */ + size_t AddRef(); + size_t Release(); + int QueryInterface(GUID interface_guid, void **object); + + /* ifc_skinhelper */ + HRESULT GetColor(UINT colorIndex, COLORREF *pColor); + HRESULT GetColorEx(UINT uObject, UINT uPart, UINT uState, COLORREF *pColor); + HRESULT GetBrush(UINT colorIndex, HBRUSH *pBrush); + HFONT GetFont(void); + HRESULT SkinWindow(HWND hwnd, const GUID *windowGuid, UINT flagsEx, FFCALLBACK callbackFF); + HRESULT SkinControl(HWND hwnd, UINT type, UINT style); + HRESULT UnskinWindow(HWND hwnd); + + /* ifc_skinnedmenu */ + BOOL TrackPopup(HMENU hMenu, UINT fuFlags, INT x, INT y, HWND hwnd, LPTPMPARAMS lptpm, ifc_menucustomizer *customizer); + HRESULT IsPopupEnabled(void); + HANDLE InitPopupHook(HWND hwnd, ifc_menucustomizer *customizer); + HRESULT RemovePopupHook(HANDLE popupHook); + + /* ifc_skinnedrating */ + HRESULT RatingDraw(HDC hdc, INT maxValue, INT value, INT trackingVal, RECT *prc, UINT fStyle); + HRESULT RatingHitTest(POINT pt, INT maxValue, RECT *prc, UINT fStyle, LONG *result); + HRESULT RatingCalcMinRect(INT maxValue, RECT *prc); + HRESULT RatingCreateMenuCustomizer(HMENU hMenu, ifc_menucustomizer **customizer); + + /* ifc_skinnedbrowser */ + HRESULT Browser_GetHostCss(wchar_t **ppchHostCss); + COLORREF Browser_GetBackColor(void); + COLORREF Browser_GetTextColor(void); + COLORREF Browser_GetLinkColor(void); + COLORREF Browser_GetActiveLinkColor(void); + COLORREF Browser_GetVisitedLinkColor(void); + COLORREF Browser_GetHoveredLinkColor(void); + +public: + HFONT CreateSkinFont(void); + void ResetColorCache(void); + void ResetFontCache(void); + +protected: + HRESULT LoadMediaLibraryModule(void); + HRESULT InitializeColorData(void); + 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); + HRESULT MlInitSkinnedPopupHook(HWND hwnd, HMLIMGLST hmlil, INT width, UINT skinStyle, MENUCUSTOMIZEPROC customProc, ULONG_PTR customParam, HANDLE *hookOut); + +protected: + RECVS_MULTIPATCH; + +protected: + typedef BOOL (__cdecl *MLSKINWINDOWEX)(HWND /*hwnd*/, INT /*type*/, UINT /*style*/); + typedef BOOL (__cdecl *MLUNSKINWINDOW)(HWND /*hwnd*/); + typedef BOOL (__cdecl *MLGETSKINCOLOR)(UINT /*uObject*/, UINT /*uPart*/, UINT /*uState*/, COLORREF* /*pColor*/); + typedef void (__cdecl *MLRESETSKINCOLOR)(void); + typedef BOOL (__cdecl *MLTRACKSKINNEDPOPUPMENUEX)(HMENU /*hmenu*/, UINT /*fuFlags*/, INT /*x*/, INT /*y*/, HWND /*hwnd*/, + LPTPMPARAMS /*lptpm*/, HMLIMGLST /*hmlil*/, INT /*width*/, UINT /*skinStyle*/, + MENUCUSTOMIZEPROC /*customProc*/, ULONG_PTR /*customParam*/); + typedef BOOL (__cdecl *MLISSKINNEDPOPUPENABLED)(void); + typedef HANDLE (__cdecl *MLINITSKINNEDPOPUPHOOK)(HWND /*hwnd*/, HMLIMGLST /*hmlil*/, INT /*width*/, UINT /*skinStyle*/, + MENUCUSTOMIZEPROC /*customProc*/, ULONG_PTR /*customParam*/); + typedef void (__cdecl *MLREMOVESKINNEDPOPUPHOOK)(HANDLE /*hPopupHook*/); + + typedef BOOL (__cdecl *MLRATINGDRAW)(HDC /*hdc*/, INT /*maxValue*/, INT /*value*/, INT /*trackingVal*/, HMLIMGLST /*hmlil*/, INT /*index*/, RECT* /*prc*/, UINT /*fStyle*/); + typedef LONG (__cdecl *MLRATINGHITTEST)(POINT /*pt*/, INT /*maxValue*/, HMLIMGLST /*hmlil*/, RECT* /*prc*/, UINT /*fStyle*/); + typedef BOOL (__cdecl *MLRATINGCALCMINRECT)(INT /*maxValue*/, HMLIMGLST /*hmlil*/, RECT* /*prc*/); + + +protected: + ULONG ref; + HWND hwndWinamp; + HMODULE mlModule; + HRESULT mlLoadResult; + HFONT playlistFont; + HBRUSH szBrushes[WADLG_NUM_COLORS]; + BOOL initializeColors; + size_t cchHostCss; + + MLSKINWINDOWEX mlSkinWindowEx; + MLUNSKINWINDOW mlUnskinWindow; + MLTRACKSKINNEDPOPUPMENUEX mlTrackSkinnedPopupMenuEx; + MLISSKINNEDPOPUPENABLED mlIsSkinnedPopupEnabled; + MLINITSKINNEDPOPUPHOOK mlInitSkinnedPopupHook; + MLREMOVESKINNEDPOPUPHOOK mlRemoveSkinnedPopupHook; + MLGETSKINCOLOR mlGetSkinColor; + MLRESETSKINCOLOR mlResetSkinColor; + MLRATINGDRAW mlRatingDraw; + MLRATINGHITTEST mlRatingHitTest; + MLRATINGCALCMINRECT mlRatingCalcMinRect; + + WCHAR szHostCss[396]; +}; + + +#endif // NULLSOFT_WINAMP_SKIN_HELPER_HEADER
\ No newline at end of file |