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_CTRLLIBRARYTHUMBVIEW_H__700A82CF_4E9C_4BE0_9EBA_DF2E49AC378F__INCLUDED_)
00023 #define AFX_CTRLLIBRARYTHUMBVIEW_H__700A82CF_4E9C_4BE0_9EBA_DF2E49AC378F__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "CtrlLibraryFileView.h"
00028
00029 class CLibraryThumbItem;
00030 class CLibraryFile;
00031
00032
00033 class CLibraryThumbView : public CLibraryFileView
00034 {
00035
00036 public:
00037 CLibraryThumbView();
00038 virtual ~CLibraryThumbView();
00039
00040 DECLARE_DYNCREATE(CLibraryThumbView)
00041
00042
00043 protected:
00044 CCriticalSection m_pSection;
00045 HANDLE m_hThread;
00046 BOOL m_bThread;
00047 DWORD m_nInvalidate;
00048 BOOL m_bRush;
00049 protected:
00050 CSize m_szThumb;
00051 CSize m_szBlock;
00052 int m_nColumns;
00053 int m_nRows;
00054 protected:
00055 CLibraryThumbItem** m_pList;
00056 int m_nCount;
00057 int m_nBuffer;
00058 int m_nScroll;
00059 protected:
00060 int m_nSelected;
00061 CLibraryThumbItem* m_pFocus;
00062 CLibraryThumbItem* m_pFirst;
00063 CPtrList m_pSelThumb;
00064 BOOL m_bDrag;
00065 CPoint m_ptDrag;
00066
00067
00068 public:
00069 virtual void Update();
00070 virtual BOOL Select(DWORD nObject);
00071 virtual DWORD HitTestIndex(const CPoint& point) const;
00072 protected:
00073 void Clear();
00074 int GetThumbIndex(CLibraryThumbItem* pThumb) const;
00075 BOOL Select(CLibraryThumbItem* pThumb, TRISTATE bSelect = TS_TRUE);
00076 BOOL DeselectAll(CLibraryThumbItem* pThumb = NULL);
00077 BOOL SelectTo(CLibraryThumbItem* pThumb);
00078 void SelectTo(int nDelta);
00079 protected:
00080 void UpdateScroll();
00081 void ScrollBy(int nDelta);
00082 void ScrollTo(int nDelta);
00083 CLibraryThumbItem* HitTest(const CPoint& point) const;
00084 BOOL GetItemRect(CLibraryThumbItem* pThumb, CRect* pRect);
00085 void StartDragging(CPoint& ptMouse);
00086 CImageList* CreateDragImage(const CPoint& ptMouse);
00087 protected:
00088 void StartThread();
00089 void StopThread();
00090 void OnRun();
00091
00092 protected:
00093 static int SortList(LPCVOID pA, LPCVOID pB);
00094 static UINT ThreadStart(LPVOID pParam);
00095
00096
00097 public:
00098
00099 protected:
00100 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00101
00102
00103
00104 protected:
00105
00106 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00107 afx_msg void OnDestroy();
00108 afx_msg void OnSize(UINT nType, int cx, int cy);
00109 afx_msg void OnPaint();
00110 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00111 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00112 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00113 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00114 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00115 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00116 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00117 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00118 afx_msg void OnTimer(UINT nIDEvent);
00119
00120
00121 DECLARE_MESSAGE_MAP()
00122
00123 };
00124
00125
00126 class CLibraryThumbItem
00127 {
00128
00129 public:
00130 CLibraryThumbItem(CLibraryFile* pFile);
00131 virtual ~CLibraryThumbItem();
00132
00133
00134 public:
00135 DWORD m_nIndex;
00136 DWORD m_nCookie;
00137 CString m_sText;
00138 BOOL m_bShared;
00139 public:
00140 BOOL m_bSelected;
00141 int m_nThumb;
00142 CBitmap m_bmThumb;
00143 CSize m_szThumb;
00144 int m_nShell;
00145
00146 enum { thumbWaiting, thumbValid, thumbError };
00147
00148
00149 public:
00150 BOOL Update(CLibraryFile* pFile);
00151 void Paint(CDC* pDC, const CRect& rcBlock, const CSize& szThumb, CDC* pMemDC);
00152
00153 };
00154
00155
00156
00157 #endif // !defined(AFX_CTRLLIBRARYTHUMBVIEW_H__700A82CF_4E9C_4BE0_9EBA_DF2E49AC378F__INCLUDED_)