DialogSkinner.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef DIALOGSKINNERH
  2. #define DIALOGSKINNERH
  3. #include "MediaLibraryInterface.h"
  4. #include "../winamp/wa_dlg.h"
  5. COLORREF GetHTMLColor( int color );
  6. class DialogSkinner
  7. {
  8. typedef HBITMAP( *BitmapFunc )( );
  9. typedef int ( *ColorFunc )( int idx ); // pass this an index, returns a RGB value (passing 0 or > 3 returns NULL)
  10. typedef int ( *HandleFunc )( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  11. typedef void ( *DrawFunc )( HWND hwndDlg, int *tab, int tabsize ); // each entry in tab would be the id | DCW_*
  12. public:
  13. DialogSkinner()
  14. {}
  15. int Color( int index )
  16. {
  17. if ( !color )
  18. color = (ColorFunc)mediaLibrary.GetWADLGFunc( 1 );
  19. return color( index );
  20. }
  21. RGBQUAD GetRGB( int index )
  22. {
  23. COLORREF color = Color( index );
  24. RGBQUAD rgb;
  25. rgb.rgbReserved = 0;
  26. rgb.rgbBlue = GetBValue( color );
  27. rgb.rgbGreen = GetGValue( color );
  28. rgb.rgbRed = GetRValue( color );
  29. return rgb;
  30. }
  31. INT_PTR Handle( HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam )
  32. {
  33. if ( !handle )
  34. handle = (HandleFunc)mediaLibrary.GetWADLGFunc( 2 );
  35. return handle( dlg, msg, wParam, lParam );
  36. }
  37. void Draw( HWND dlg, int *tab, int tabSize )
  38. {
  39. if ( !draw )
  40. draw = (DrawFunc)mediaLibrary.GetWADLGFunc( 3 );
  41. draw( dlg, tab, tabSize );
  42. }
  43. HFONT GetFont()
  44. {
  45. return (HFONT)mediaLibrary.GetWADLGFunc( 66 );
  46. }
  47. HBITMAP GetBitmap()
  48. {
  49. if ( !bitmap )
  50. bitmap = (BitmapFunc)mediaLibrary.GetWADLGFunc( 4 );
  51. return bitmap();
  52. }
  53. ColorFunc color = 0;
  54. HandleFunc handle = 0;
  55. DrawFunc draw = 0;
  56. BitmapFunc bitmap = 0;
  57. };
  58. extern DialogSkinner dialogSkinner;
  59. #endif