00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_CTRLLIBRARYALBUMVIEW_H__19FB3DBB_8526_4E9D_A647_75DF07BAE7E2__INCLUDED_)
00023 #define AFX_CTRLLIBRARYALBUMVIEW_H__19FB3DBB_8526_4E9D_A647_75DF07BAE7E2__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "CtrlLibraryFileView.h"
00028
00029 class CLibraryFile;
00030 class CLibraryAlbumTrack;
00031
00032
00033 class CLibraryAlbumView : public CLibraryFileView
00034 {
00035
00036 public:
00037 CLibraryAlbumView();
00038 virtual ~CLibraryAlbumView();
00039
00040 DECLARE_DYNCREATE(CLibraryAlbumView)
00041
00042
00043 protected:
00044 CSize m_szTrack;
00045 int m_nRows;
00046 LPCTSTR m_pStyle;
00047 static LPCTSTR m_pStaticStyle;
00048 protected:
00049 CLibraryAlbumTrack** m_pList;
00050 int m_nCount;
00051 int m_nBuffer;
00052 int m_nScroll;
00053 CImageList m_pStars;
00054 protected:
00055 CPtrList m_pSelTrack;
00056 int m_nSelected;
00057 CLibraryAlbumTrack* m_pFocus;
00058 CLibraryAlbumTrack* m_pFirst;
00059 CLibraryAlbumTrack* m_pRating;
00060 BOOL m_bDrag;
00061 CPoint m_ptDrag;
00062 public:
00063 static COLORREF m_crRows[2];
00064
00065
00066 public:
00067 virtual void Update();
00068 virtual BOOL Select(DWORD nObject);
00069 virtual DWORD HitTestIndex(const CPoint& point) const;
00070 protected:
00071 void Clear();
00072 BOOL Select(CLibraryAlbumTrack* pItem, TRISTATE bSelect = TS_TRUE);
00073 BOOL DeselectAll(CLibraryAlbumTrack* pItem = NULL);
00074 BOOL SelectTo(CLibraryAlbumTrack* pItem);
00075 void SelectTo(int nDelta);
00076 protected:
00077 void UpdateScroll();
00078 void ScrollBy(int nDelta);
00079 void ScrollTo(int nDelta);
00080 CLibraryAlbumTrack* HitTest(const CPoint& point, CRect* pRect = NULL) const;
00081 int GetTrackIndex(CLibraryAlbumTrack* pTrack) const;
00082 BOOL GetItemRect(CLibraryAlbumTrack* pTrack, CRect* pRect);
00083 void StartDragging(CPoint& ptMouse);
00084 CImageList* CreateDragImage(const CPoint& ptMouse);
00085
00086 static int SortList(LPCVOID pA, LPCVOID pB);
00087
00088
00089 public:
00090
00091 protected:
00092 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00093
00094
00095
00096 protected:
00097
00098 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00099 afx_msg void OnDestroy();
00100 afx_msg void OnSize(UINT nType, int cx, int cy);
00101 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00102 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00103 afx_msg void OnPaint();
00104 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00105 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00106 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00107 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00108 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00109 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00110
00111
00112 DECLARE_MESSAGE_MAP()
00113
00114 friend class CLibraryAlbumTrack;
00115 };
00116
00117 class CLibraryAlbumTrack
00118 {
00119
00120 public:
00121 CLibraryAlbumTrack(CLibraryFile* pFile);
00122 virtual ~CLibraryAlbumTrack();
00123
00124
00125 public:
00126 DWORD m_nIndex;
00127 DWORD m_nCookie;
00128 BOOL m_bShared;
00129 BOOL m_bSelected;
00130 public:
00131 int m_nShell;
00132 int m_nTrack;
00133 CString m_sTrack;
00134 CString m_sTitle;
00135 CString m_sArtist;
00136 CString m_sAlbum;
00137 int m_nLength;
00138 CString m_sLength;
00139 int m_nBitrate;
00140 CString m_sBitrate;
00141 int m_nRating;
00142 BOOL m_bComments;
00143 int m_nSetRating;
00144
00145
00146 public:
00147 BOOL Update(CLibraryFile* pFile);
00148 void Paint(CLibraryAlbumView* pView, CDC* pDC, const CRect& rcBlock, int nCount);
00149 BOOL HitTestRating(const CRect& rcBlock, const CPoint& point);
00150 BOOL LockRating();
00151 protected:
00152 void PaintText(CDC* pDC, const CRect& rcTrack, int nFrom, int nTo, const CString* pstr, BOOL bCenter = FALSE);
00153
00154 };
00155
00156
00157
00158 #endif // !defined(AFX_CTRLLIBRARYALBUMVIEW_H__19FB3DBB_8526_4E9D_A647_75DF07BAE7E2__INCLUDED_)