ml_ratingcolumn.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef NULLOSFT_MEDIALIBRARY_RATING_COLUMN_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_RATING_COLUMN_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <windows.h>
  7. // Styles
  8. #define RCS_DEFAULT_I 0xFFFFFFFF // use default gen_ml style
  9. // layout
  10. #define RCS_ALLIGN_LEFT_I 0x00000000
  11. #define RCS_ALLIGN_CENTER_I 0x00000001
  12. #define RCS_ALLIGN_RIGHT_I 0x00000002
  13. // showepmty
  14. #define RCS_SHOWEMPTY_NEVER_I 0x00000000
  15. #define RCS_SHOWEMPTY_NORMAL_I 0x00000010
  16. #define RCS_SHOWEMPTY_HOT_I 0x00000020
  17. #define RCS_SHOWEMPTY_ANIMATION_I 0x00000040
  18. #define RCS_SHOWEMPTY_ALWAYS_I 0x00000070
  19. #define RCS_SHOWINACTIVE_HOT_I 0x00000080
  20. // traking (when)
  21. #define RCS_TRACK_NEVER_I 0x00000000
  22. #define RCS_TRACK_WNDFOCUSED_I 0x00000100
  23. #define RCS_TRACK_ANCESTORACITVE_I 0x00000200
  24. #define RCS_TRACK_PROCESSACTIVE_I 0x00000400
  25. #define RCS_TRACK_ALWAYS_I 0x00000800
  26. // traking (what)
  27. #define RCS_TRACKITEM_ALL_I 0x00000000
  28. #define RCS_TRACKITEM_SELECTED_I 0x00100000
  29. #define RCS_TRACKITEM_FOCUSED_I 0x00200000
  30. #define RCS_BLOCKCLICK_I 0x01000000
  31. #define RCS_BLOCKUNRATECLICK_I 0x02000000
  32. #define RCS_BLOCKDRAG_I 0x04000000
  33. #define RCS_SIZE_ALLOWDECREASE_I 0x10000000
  34. #define RCS_SIZE_ALLOWINCREASE_I 0x20000000
  35. #define RATING_DEFAULT_STYLE (RCS_ALLIGN_LEFT_I | \
  36. RCS_SHOWEMPTY_HOT_I | \
  37. RCS_SHOWEMPTY_ANIMATION_I | \
  38. RCS_TRACK_PROCESSACTIVE_I | \
  39. RCS_TRACKITEM_ALL_I | \
  40. /*RCS_BLOCKUNRATECLICK_I |*/ \
  41. 0)
  42. typedef struct _RATINGCOLUMNPAINT_I
  43. {
  44. HWND hwndList; // hwnd of the listview
  45. HDC hdc; // hdc
  46. UINT iItem; // item index
  47. UINT iSubItem; // subitem index
  48. INT value; // database rating value
  49. RECT *prcItem; // whole item rect (plvcd->nmcd.rc)
  50. RECT *prcView; // client area size (you can get it at CDDS_PREPAINT in plvcd->nmcd.rc)
  51. COLORREF rgbBk; // color to use as background (plvcd->clrTextBk)
  52. COLORREF rgbFg; // color to use as foreground (plvcd->clrText)
  53. UINT fStyle; // style to use RCS_XXX
  54. } RATINGCOLUMNPAINT_I;
  55. typedef struct _RATINGCOLUMN_I
  56. {
  57. HWND hwndList;
  58. UINT iItem;
  59. UINT iSubItem;
  60. INT value;
  61. POINT ptAction; //
  62. BOOL bRedrawNow; // You want list to be redrawn immediatly
  63. BOOL bCanceled; // Used with EndDrag - i
  64. UINT fStyle; // RCS_XXX
  65. } RATINGCOLUMN_I;
  66. BOOL MLRatingColumnI_Initialize(void); // call it before any other. You can call it any time something changed
  67. BOOL MLRatingColumnI_Update(void); // call this when any skin / font changed happend
  68. BOOL MLRatingColumnI_Paint(RATINGCOLUMNPAINT_I *pRCPaint);
  69. BOOL MLRatingColumnI_Click(RATINGCOLUMN_I *pRating); // Set: hwndList, ptAction, bRedrawNow, fStyle. // Returns TRUE if rating was clicked. Sets: iItem, iSubItem, value.
  70. void MLRatingColumnI_Track(RATINGCOLUMN_I *pRating); // Set: hwndList, iItem, iSubItem, value, ptAction, bRedrawNow, fStyle. No Return.
  71. BOOL MLRatingColumnI_BeginDrag(RATINGCOLUMN_I *pRating); // Set: hwndList, iItem, iSubItem, value, fStyle. Return TRUE if handled.
  72. BOOL MLRatingColumnI_Drag(POINT pt); // Return TRUE if handled.
  73. BOOL MLRatingColumnI_EndDrag(RATINGCOLUMN_I *pRating); // Set: ptAction, bCanceled, bRedrawNow. Return TRUE if handled. Sets: iItem, value.
  74. void MLRatingColumnI_Animate(HWND hwndList, UINT iItem, UINT durationMs);
  75. void MLRatingColumnI_CancelTracking(BOOL bRedrawNow);
  76. INT MLRatingColumnI_GetMinWidth(void);
  77. INT MLRatingColumnI_GetWidth(INT width, UINT fStyle); // will return you new width according to the policies
  78. LPCWSTR MLRatingColumnI_FillBackString(LPWSTR pszText, INT cchTextMax, INT nColumnWidth, UINT fStyle);
  79. typedef BOOL (CALLBACK *ONRATINGTWEAKAPLLY)(UINT /*newStyle*/, BOOL /*bClosing*/);
  80. HWND MLRatingColumnI_TweakDialog(HWND hwndParent, UINT fStyle, ONRATINGTWEAKAPLLY fnApply, BOOL bVisible);
  81. #endif // NULLOSFT_MEDIALIBRARY_RATING_COLUMN_HEADER