SkinnedListView.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _SKINNEDLISTVIEW_H_
  2. #define _SKINNEDLISTVIEW_H_
  3. #include <windows.h>
  4. #include <windowsx.h>
  5. #include <stdio.h>
  6. #include <shlobj.h>
  7. #include "..\..\General\gen_ml/ml.h"
  8. #include "..\..\General\gen_ml/ml_ipc_0313.h"
  9. #include "pmp.h"
  10. #include "../nu/listview.h"
  11. #include <map>
  12. #include "..\..\General\gen_ml/itemlist.h"
  13. #include "..\..\General\gen_ml/childwnd.h"
  14. #include "../winamp/wa_ipc.h"
  15. #include "../winamp/wa_dlg.h"
  16. #include "config.h"
  17. class ListField {
  18. public:
  19. int field;
  20. int width;
  21. int pos;
  22. wchar_t * name;
  23. bool hidden, hiddenDefault;
  24. ListField() : field(0), width(0), pos(0), name(0), hidden(0), hiddenDefault(0) {};
  25. ListField(int field, int defwidth, wchar_t * name, C_Config * config, bool hidden=false);
  26. ~ListField() { free(name); }
  27. void ResetPos();
  28. };
  29. class ListContents {
  30. public:
  31. C_ItemList fields, hiddenfields;
  32. C_Config * config;
  33. int cloud, cloudcol;
  34. typedef std::map<size_t, int> CloudCache;
  35. CloudCache cloud_cache;
  36. Device *dev;
  37. ListContents() : config(NULL), cloud(0), cloudcol(-1), dev(0) {};
  38. virtual ~ListContents();
  39. virtual int GetNumColumns()=0;
  40. virtual int GetNumRows()=0;
  41. virtual wchar_t * GetColumnTitle(int num)=0;
  42. virtual int GetColumnWidth(int num)=0;
  43. virtual void GetCellText(int row, int col, wchar_t * buf, int buflen)=0;
  44. virtual int GetSortColumn();
  45. virtual int GetSortDirection(); // return true for acending.
  46. virtual void ColumnClicked(int col); // sort contents and update list
  47. virtual void ColumnResize(int col, int newWidth); // called once only just before deconstuctor if changed
  48. virtual void GetInfoString(wchar_t * buf);
  49. void SortColumns();
  50. virtual bool CustomizeColumns(HWND parent, BOOL showmenu);
  51. virtual void ResetColumns();
  52. virtual pmpart_t GetArt(int row){return NULL;}
  53. virtual void SetMode(int mode){}
  54. virtual songid_t GetTrack(int pos)=0;
  55. };
  56. class PrimaryListContents : public ListContents {
  57. public:
  58. virtual void RemoveTrack(songid_t song){}
  59. };
  60. class SkinnedListView {
  61. protected:
  62. HWND libraryParent, headerWindow;
  63. int dlgitem;
  64. bool enableHeaderMenu;
  65. public:
  66. int skinlistview_handle;
  67. ListContents * contents;
  68. W_ListView listview;
  69. SkinnedListView(ListContents * lc, int dlgitem, HWND libraryParent, HWND parent, bool enableHeaderMenu=true);
  70. virtual ~SkinnedListView(){}
  71. virtual BOOL DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  72. static LRESULT pmp_listview(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  73. static LRESULT pmp_listview_alt(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  74. virtual void UpdateList(bool softUpdate=false);
  75. virtual int GetFindItemColumn();
  76. virtual HMENU GetMenu(bool isFilter, int filterNum, C_Config *c, HMENU themenu);
  77. virtual void ProcessMenuResult(int r, bool isFilter, int filterNum, C_Config *c, HWND parent);
  78. virtual void InitializeFilterData(int filterNum, C_Config *config);
  79. };
  80. #endif //_SKINNEDLISTVIEW_H_