1
0

skinnedscrollwnd.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef NULLOSFT_MEDIALIBRARY_SKINNED_SCROLLWINDOW_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_SKINNED_SCROLLWINDOW_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./skinnedwnd.h"
  7. typedef struct _SCROLLBAR SCROLLBAR;
  8. // scroll modes
  9. #define SCROLLMODE_STANDARD_I 0x00
  10. #define SCROLLMODE_LISTVIEW_I 0x01
  11. #define SCROLLMODE_TREEVIEW_I 0x02
  12. #define SCROLLMODE_COMBOLBOX_I 0x03
  13. class SkinnedScrollWnd : public SkinnedWnd
  14. {
  15. public:
  16. typedef enum InvalidateFlags
  17. {
  18. InvalidateFlag_Normal = 0,
  19. InvalidateFlag_RedrawNow = (1 << 0),
  20. InvalidateFlag_Frame = (1 << 1),
  21. InvalidateFlag_VertBarAppeared = (1 << 2),
  22. InvalidateFlag_VertBarRemoved = (1 << 3),
  23. InvalidateFlag_HorzBarAppeared = (1 << 4),
  24. InvalidateFlag_HorzBarRemoved = (1 << 5),
  25. } InvalidateFlags;
  26. protected:
  27. SkinnedScrollWnd(BOOL bIsDialog);
  28. virtual ~SkinnedScrollWnd(void);
  29. public:
  30. void UpdateScrollBars(BOOL fInvalidate);
  31. void ShowHorzScroll(BOOL fEnable);
  32. void ShowVertScroll(BOOL fEnable);
  33. BOOL IsHorzBarHidden();
  34. BOOL IsVertBarHidden();
  35. BOOL SetMode(UINT nMode);
  36. UINT GetMode();
  37. void DisableNoScroll(BOOL bDisable);
  38. BOOL IsNoScrollDisabled();
  39. protected:
  40. virtual BOOL Attach(HWND hwndHeader);
  41. virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  42. virtual INT OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS *pncsp);
  43. virtual INT OnNcHitTest(POINTS pts);
  44. virtual void OnNcPaint(HRGN rgnUpdate);
  45. virtual void OnNcMouseMove(UINT nHitTest, POINTS pts);
  46. virtual void OnNcLButtonDown(UINT nHitTest, POINTS pts);
  47. virtual void OnNcMouseLeave();
  48. virtual void OnStyleChanged(INT styleType, STYLESTRUCT *pss);
  49. virtual void OnLButtonUp(UINT nFlags, POINTS pts);
  50. virtual void OnMouseMove(UINT nFlags, POINTS pts);
  51. virtual void OnTimer(UINT_PTR idEvent, TIMERPROC fnTimer);
  52. virtual LRESULT OnEraseBackground(HDC hdc);
  53. virtual void OnPrint(HDC hdc, UINT options);
  54. virtual void OnSkinChanged(BOOL bNotifyChildren, BOOL bRedraw);
  55. virtual BOOL OnMediaLibraryIPC(INT msg, INT_PTR param, LRESULT *pResult);
  56. BOOL ShowScrollBar(int wBar, BOOL fShow);
  57. void UpdateScrollBar(SCROLLBAR *psb, InvalidateFlags *invalidateFlags);
  58. void InvalidateNC(InvalidateFlags invalidate, UINT bars);
  59. void PaintNonClient(HDC hdc);
  60. INT AdjustHover(UINT nHitTest, POINTS pts);
  61. void UpdateFrame();
  62. LRESULT OnListViewScroll(INT dx, INT dy);
  63. void OnVertScroll(UINT code, UINT pos, HWND hwndSB);
  64. void OnMouseWheel(INT delta, UINT vtKey, POINTS pts);
  65. void Emulate_LeftButtonUp(UINT nFlags, POINTS pts, BOOL forwardMessage);
  66. private:
  67. friend BOOL SkinWindowEx(HWND hwndToSkin, INT type, UINT style);
  68. friend static BOOL GetHScrollRect(SkinnedScrollWnd *pWnd, RECT *prc);
  69. friend static BOOL GetVScrollRect(SkinnedScrollWnd *pWnd, RECT *prc);
  70. private:
  71. SCROLLBAR *psbHorz;
  72. SCROLLBAR *psbVert;
  73. UINT scrollFlags;
  74. UINT scrollPortionHover;
  75. int wheelCarryover;
  76. };
  77. DEFINE_ENUM_FLAG_OPERATORS(SkinnedScrollWnd::InvalidateFlags);
  78. #endif //NULLOSFT_MEDIALIBRARY_SKINNED_SCROLLWINDOW_HEADER