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

CtrlSearchDetailPanel.h

Go to the documentation of this file.
00001 //
00002 // CtrlSearchDetailPanel.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_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_)
00023 #define AFX_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "MetaPanel.h"
00028 #include "RichDocument.h"
00029 #include "RichViewCtrl.h"
00030 #include "HttpRequest.h"
00031 
00032 class CMatchFile;
00033 class CImageFile;
00034 
00035 
00036 class CSearchDetailPanel : public CWnd
00037 {
00038 // Construction
00039 public:
00040         CSearchDetailPanel();
00041         virtual ~CSearchDetailPanel();
00042 
00043         DECLARE_DYNAMIC(CSearchDetailPanel)
00044 
00045 // Operations
00046 public:
00047         void            Update(CMatchFile* pFile);
00048 protected:
00049         static void     DrawText(CDC* pDC, int nX, int nY, LPCTSTR pszText, RECT* pRect = NULL);
00050         void            DrawThumbnail(CDC* pDC, CRect& rcClient, CRect& rcWork);
00051         void            DrawThumbnail(CDC* pDC, CRect& rcThumb);
00052         void            ClearReviews();
00053 protected:
00054         BOOL            RequestPreview();
00055         void            CancelPreview();
00056         static UINT     ThreadStart(LPVOID pParam);
00057         void            OnRun();
00058         BOOL            ExecuteRequest(CString strURL, BYTE** ppBuffer, DWORD* pnBuffer);
00059         void            OnPreviewLoaded(SHA1* pSHA1, CImageFile* pImage);
00060         BOOL            CachePreviewImage(SHA1* pSHA1, LPBYTE pBuffer, DWORD nBuffer);
00061 
00062 // Item
00063 protected:
00064         class Review
00065         {
00066         public:
00067                 Review(GGUID* pGUID, IN_ADDR* pAddress, LPCTSTR pszNick, int nRating, LPCTSTR pszComments);
00068                 virtual ~Review();
00069                 void                    Layout(CSearchDetailPanel* pParent, CRect* pRect);
00070                 void                    Reposition(int nScroll);
00071                 void                    Paint(CDC* pDC, int nScroll);
00072         public:
00073                 GGUID                   m_pGUID;
00074                 CString                 m_sNick;
00075                 int                             m_nRating;
00076                 CRichDocument   m_pComments;
00077                 CRichViewCtrl   m_wndComments;
00078                 CRect                   m_rc;
00079         };
00080         friend class Review;
00081 
00082 // Attributes
00083 protected:
00084         CMatchList*                     m_pMatches;
00085         BOOL                            m_bValid;
00086         CMatchFile*                     m_pFile;
00087         SHA1                            m_pSHA1;
00088         CString                         m_sName;
00089         CString                         m_sStatus;
00090         CRect                           m_rcStatus;
00091         CString                         m_sSize;
00092         int                                     m_nIcon48;
00093         int                                     m_nIcon32;
00094         int                                     m_nRating;
00095         CSchema*                        m_pSchema;
00096         CMetaPanel                      m_pMetadata;
00097         CPtrList                        m_pReviews;
00098         int                                     m_nScrollWheelLines;
00099 protected:
00100         CCriticalSection        m_pSection;
00101         CEvent                          m_pWakeup;
00102         BOOL                            m_bCanPreview;
00103         BOOL                            m_bRunPreview;
00104         BOOL                            m_bIsPreviewing;
00105         HANDLE                          m_hThread;
00106         BOOL                            m_bThread;
00107         CHttpRequest            m_pRequest;
00108         CStringList                     m_pPreviewURLs;
00109 protected:
00110         CBitmap                         m_bmThumb;
00111         CSize                           m_szThumb;
00112         CRect                           m_rcThumb;
00113         COLORREF                        m_crLight;
00114         int                                     m_nThumbSize;
00115 
00116 // Overrides
00117 public:
00118         //{{AFX_VIRTUAL(CSearchDetailPanel)
00119         public:
00120         virtual BOOL Create(CWnd* pParentWnd);
00121         //}}AFX_VIRTUAL
00122 
00123 // Implementation
00124 protected:
00125         //{{AFX_MSG(CSearchDetailPanel)
00126         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00127         afx_msg void OnDestroy();
00128         afx_msg void OnSize(UINT nType, int cx, int cy);
00129         afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00130         afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00131         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00132         afx_msg void OnPaint();
00133         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00134         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00135         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00136         afx_msg void OnClickReview(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult);
00137         //}}AFX_MSG
00138 
00139         DECLARE_MESSAGE_MAP()
00140 
00141 };
00142 
00143 #define IDC_DETAIL_PANEL        104
00144 #define IDC_REVIEW_VIEW         99
00145 
00146 //{{AFX_INSERT_LOCATION}}
00147 
00148 #endif // !defined(AFX_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_)

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