1
0

skinnedheader.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef NULLOSFT_MEDIALIBRARY_SKINNED_HEADER_CONTROL_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_SKINNED_HEADER_CONTROL_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./skinnedwnd.h"
  7. #include <commctrl.h>
  8. #ifndef HDF_SORTUP
  9. #define HDF_SORTUP 0x0400
  10. #define HDF_SORTDOWN 0x0200
  11. #endif // !HDF_SORTUP
  12. // size rules
  13. #define SHS_SIZERULE_WINDOWS 0x00 // Use windows default size rule.
  14. #define SHS_SIZERULE_ADJUSTONE 0x01 // Resize column and adjust adjacent column.
  15. #define SHS_SIZERULE_ADJUSTALL 0x03 // Resize column and adjust adjacent column when column reach minimum adjust next one.
  16. #define SHS_SIZERULE_PROPORTIONAL 0x02 // Resize column and adjust all columns proportionately.
  17. class SkinnedHeader : public SkinnedWnd
  18. {
  19. protected:
  20. SkinnedHeader(void);
  21. virtual ~SkinnedHeader(void);
  22. void SetHeight(INT nHeight); // if nHeight == -1 control will calculate height required to fit current font
  23. protected:
  24. virtual BOOL Attach(HWND hwndHeader);
  25. virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  26. virtual BOOL OnReflectedNotify(INT idCtrl, REFLECTPARAM *rParam);
  27. virtual BOOL OnCustomDraw(HWND hwndFrom, NMCUSTOMDRAW *pnmcd, LRESULT *pResult);
  28. virtual void OnSkinChanged(BOOL bNotifyChildren, BOOL bRedraw);
  29. virtual void OnPaint(void);
  30. virtual BOOL OnLayout(HDLAYOUT *pLayout);
  31. virtual BOOL OnSetCursor(HWND hwdCursor, UINT hitTest, UINT message);
  32. virtual BOOL OnBeginTrack(HWND hwndFrom, NMHEADERW *phdn, LRESULT *pResult);
  33. virtual BOOL OnEndTrack(HWND hwndFrom, NMHEADERW *phdn);
  34. virtual BOOL OnItemChanging(HWND hwndFrom, NMHEADERW *phdn, LRESULT *pResult);
  35. virtual BOOL OnItemChanged(HWND hwndFrom, NMHEADERW *phdn);
  36. virtual void OnTimer(UINT_PTR nIDEvent, TIMERPROC lpTimerFunc);
  37. virtual BOOL OnCursorNotify(HWND hwndFrom, NMMOUSE *pnm, LRESULT *pResult);
  38. virtual BOOL OnMediaLibraryIPC(INT msg, INT_PTR param, LRESULT *pResult);
  39. virtual LRESULT OnSetItem(INT iIndex, HDITEMW *phdItem, BOOL bUnicode);
  40. private:
  41. void DrawHeaderItem(LPNMCUSTOMDRAW pnmcd);
  42. UINT SizeRuleAdjustOne(HDITEMW *phdi, INT index, UINT uMsg);
  43. UINT SizeRuleProportional(HDITEMW *phdi, INT index, UINT uMsg);
  44. void BlockRedraw(BOOL bBlock, UINT unblockDelay);
  45. friend BOOL SkinWindowEx(HWND hwndToSkin, INT type, UINT style);
  46. public:
  47. static DWORD GetSortArrowSize(void);
  48. static BOOL DrawSortArrow(HDC hdc, RECT *prc, COLORREF rgbBk, COLORREF rgbFg, BOOL bAscending);
  49. static BOOL DrawCloudIcon(HDC hdc, RECT *prc, COLORREF rgbBk, COLORREF rgbFg);
  50. protected:
  51. DWORD hdrFlags;
  52. DWORD hdrSizeRule;
  53. HCURSOR hcurNormal;
  54. INT cloudColumn;
  55. };
  56. #endif // NULLOSFT_MEDIAIBRARY_SKINNED_HEADER_CONTROL_HEADER