Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CtrlLibraryThumbView.h

Go to the documentation of this file.
00001 //
00002 // CtrlLibraryThumbView.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 // Construction
00036 public:
00037         CLibraryThumbView();
00038         virtual ~CLibraryThumbView();
00039 
00040         DECLARE_DYNCREATE(CLibraryThumbView)
00041 
00042 // Attributes
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 // Operations
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 // Overrides
00097 public:
00098         //{{AFX_VIRTUAL(CLibraryThumbView)
00099         protected:
00100         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00101         //}}AFX_VIRTUAL
00102 
00103 // Implementation
00104 protected:
00105         //{{AFX_MSG(CLibraryThumbView)
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         //}}AFX_MSG
00120 
00121         DECLARE_MESSAGE_MAP()
00122 
00123 };
00124 
00125 
00126 class CLibraryThumbItem
00127 {
00128 // Construction
00129 public:
00130         CLibraryThumbItem(CLibraryFile* pFile);
00131         virtual ~CLibraryThumbItem();
00132 
00133 // Attributes
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 // Operations
00149 public:
00150         BOOL    Update(CLibraryFile* pFile);
00151         void    Paint(CDC* pDC, const CRect& rcBlock, const CSize& szThumb, CDC* pMemDC);
00152 
00153 };
00154 
00155 //{{AFX_INSERT_LOCATION}}
00156 
00157 #endif // !defined(AFX_CTRLLIBRARYTHUMBVIEW_H__700A82CF_4E9C_4BE0_9EBA_DF2E49AC378F__INCLUDED_)

Generated on Thu Dec 15 10:39:36 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2