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_CTRLLIBRARYTILEVIEW_H__C409D195_CBAA_45F3_9757_AF8F0D67174C__INCLUDED_)
00023 #define AFX_CTRLLIBRARYTILEVIEW_H__C409D195_CBAA_45F3_9757_AF8F0D67174C__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "CtrlLibraryView.h"
00028
00029 class CLibraryTileItem;
00030 class CAlbumFolder;
00031
00032
00033 class CLibraryTileView : public CLibraryView
00034 {
00035
00036 public:
00037 CLibraryTileView();
00038 virtual ~CLibraryTileView();
00039
00040
00041 protected:
00042 CSize m_szBlock;
00043 int m_nColumns;
00044 int m_nRows;
00045 protected:
00046 CLibraryTileItem** m_pList;
00047 int m_nCount;
00048 int m_nBuffer;
00049 int m_nScroll;
00050 protected:
00051 int m_nSelected;
00052 CLibraryTileItem* m_pFocus;
00053 CLibraryTileItem* m_pFirst;
00054 CPtrList m_pSelTile;
00055 BOOL m_bDrag;
00056 CPoint m_ptDrag;
00057
00058
00059 public:
00060 virtual BOOL CheckAvailable(CLibraryTreeItem* pSel);
00061 virtual void Update();
00062 virtual BOOL Select(DWORD nObject);
00063 protected:
00064 void Clear();
00065 int GetTileIndex(CLibraryTileItem* pTile) const;
00066 BOOL Select(CLibraryTileItem* pTile, TRISTATE bSelect = TS_TRUE);
00067 BOOL DeselectAll(CLibraryTileItem* pTile = NULL);
00068 BOOL SelectTo(CLibraryTileItem* pTile);
00069 void SelectTo(int nDelta);
00070 void Highlight(CLibraryTileItem* pTile);
00071 protected:
00072 static int SortList(LPCVOID pA, LPCVOID pB);
00073 void UpdateScroll();
00074 void ScrollBy(int nDelta);
00075 void ScrollTo(int nDelta);
00076 CLibraryTileItem* HitTest(const CPoint& point) const;
00077 BOOL GetItemRect(CLibraryTileItem* pTile, CRect* pRect);
00078 void StartDragging(CPoint& ptMouse);
00079 CImageList* CreateDragImage(const CPoint& ptMouse);
00080
00081
00082 public:
00083
00084 protected:
00085 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00086
00087
00088
00089 protected:
00090
00091 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00092 afx_msg void OnDestroy();
00093 afx_msg void OnSize(UINT nType, int cx, int cy);
00094 afx_msg void OnPaint();
00095 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00096 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00097 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00098 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00099 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00100 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00101 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00102 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00103 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
00104 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00105 afx_msg void OnUpdateLibraryAlbumOpen(CCmdUI* pCmdUI);
00106 afx_msg void OnLibraryAlbumOpen();
00107 afx_msg void OnUpdateLibraryAlbumDelete(CCmdUI* pCmdUI);
00108 afx_msg void OnLibraryAlbumDelete();
00109 afx_msg void OnUpdateLibraryAlbumProperties(CCmdUI* pCmdUI);
00110 afx_msg void OnLibraryAlbumProperties();
00111
00112
00113 DECLARE_MESSAGE_MAP()
00114
00115 };
00116
00117
00118 class CLibraryTileItem
00119 {
00120
00121 public:
00122 CLibraryTileItem(CAlbumFolder* pFolder);
00123 virtual ~CLibraryTileItem();
00124
00125
00126 public:
00127 CAlbumFolder* m_pFolder;
00128 DWORD m_nCookie;
00129 BOOL m_bSelected;
00130 CString m_sTitle;
00131 CString m_sSubtitle1;
00132 CString m_sSubtitle2;
00133 int m_nIcon32;
00134 int m_nIcon48;
00135 BOOL m_bCollection;
00136
00137
00138 public:
00139 BOOL Update();
00140 void Paint(CDC* pDC, const CRect& rcBlock, CDC* pMemDC);
00141 protected:
00142 void DrawText(CDC* pDC, const CRect* prcClip, int nX, int nY, LPCTSTR pszText, CRect* prcUnion = NULL);
00143
00144 };
00145
00146
00147
00148 #endif // !defined(AFX_CTRLLIBRARYTILEVIEW_H__C409D195_CBAA_45F3_9757_AF8F0D67174C__INCLUDED_)