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_CTRLMATCH_H__7AF5A040_15D1_4BC1_A384_3C27F226F878__INCLUDED_)
00023 #define AFX_CTRLMATCH_H__7AF5A040_15D1_4BC1_A384_3C27F226F878__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "CtrlMatchTip.h"
00028
00029 class CMatchList;
00030 class CMatchFile;
00031 class CQueryHit;
00032 class CSchema;
00033
00034
00035 class CMatchCtrl : public CWnd
00036 {
00037
00038 public:
00039 CMatchCtrl();
00040 virtual ~CMatchCtrl();
00041
00042 friend class CHitMonitorWnd;
00043 friend class CSearchWnd;
00044 friend class CBrowseFrameCtrl;
00045
00046
00047 public:
00048 CMatchList* m_pMatches;
00049 LPCTSTR m_sType;
00050 CSchema* m_pSchema;
00051 CPtrList m_pColumns;
00052 protected:
00053 CHeaderCtrl m_wndHeader;
00054 CMatchTipCtrl m_wndTip;
00055 CImageList m_pStars;
00056 protected:
00057 DWORD m_nTopIndex;
00058 DWORD m_nHitIndex;
00059 DWORD m_nBottomIndex;
00060 DWORD m_nFocus;
00061 int m_nPageCount;
00062 int m_nCurrentWidth;
00063 DWORD m_nCacheItems;
00064 int m_nTrailWidth;
00065 UINT m_nMessage;
00066 CString m_sMessage;
00067 BOOL m_bSearchLink;
00068 CBitmap m_bmSortAsc;
00069 CBitmap m_bmSortDesc;
00070 BOOL m_bTips;
00071 int m_nScrollWheelLines;
00072
00073
00074 public:
00075 void Update();
00076 void DestructiveUpdate();
00077 void SelectSchema(CSchema* pSchema, CPtrList* pColumns);
00078 void SetBrowseMode();
00079 BOOL HitTestHeader(const CPoint& point);
00080 void SetSortColumn(int nColumn = -1, BOOL bDirection = FALSE);
00081 void SetMessage(UINT nMessageID, BOOL bLink = FALSE);
00082 void SetMessage(LPCTSTR pszMessage, BOOL bLink = FALSE);
00083 void EnableTips(BOOL bTips);
00084 protected:
00085 void InsertColumn(int nColumn, LPCTSTR pszCaption, int nFormat, int nWidth);
00086 void SaveColumnState();
00087 BOOL LoadColumnState();
00088 void UpdateScroll(DWORD nScroll = 0xFFFFFFFF);
00089 void ScrollBy(int nDelta);
00090 void ScrollTo(DWORD nIndex);
00091 void DrawItem(CDC& dc, CRect& rc, CMatchFile* pFile, CQueryHit* pHit, BOOL bFocus);
00092 void DrawStatus(CDC& dc, CRect& rcCol, CMatchFile* pFile, CQueryHit* pHit, BOOL bSelected, COLORREF crBack);
00093 void DrawRating(CDC& dc, CRect& rcCol, int nRating, BOOL bSelected, COLORREF crBack);
00094 void DrawEmptyMessage(CDC& dc, CRect& rcClient);
00095 BOOL HitTest(const CPoint& point, CMatchFile** poFile, CQueryHit** poHit, DWORD* pnIndex = NULL, CRect* pRect = NULL);
00096 BOOL GetItemRect(CMatchFile* pFindFile, CQueryHit* pFindHit, CRect* pRect);
00097 BOOL PixelTest(const CPoint& point);
00098 void MoveFocus(int nDelta, BOOL bShift);
00099 void NotifySelection();
00100 void DoDelete();
00101 void DoExpand(BOOL bExpand);
00102
00103
00104 public:
00105
00106 public:
00107 virtual BOOL Create(CMatchList* pMatches, CWnd* pParentWnd);
00108
00109
00110
00111 public:
00112 DECLARE_MESSAGE_MAP()
00113 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00114 afx_msg void OnDestroy();
00115 afx_msg void OnSize(UINT nType, int cx, int cy);
00116 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00117 afx_msg void OnPaint();
00118 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00119 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00120 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00121 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00122 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00123 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00124 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00125 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00126 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00127 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00128 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00129 afx_msg void OnTimer(UINT nIDEvent);
00130 afx_msg void OnChangeHeader(NMHDR* pNotifyStruct, LRESULT* pResult);
00131 afx_msg void OnClickHeader(NMHDR* pNotifyStruct, LRESULT* pResult);
00132 afx_msg void OnSetFocus(CWnd* pOldWnd);
00133 afx_msg void OnKillFocus(CWnd* pNewWnd);
00134
00135 };
00136
00137
00138
00139 #define MATCH_COL_NAME 0
00140 #define MATCH_COL_TYPE 1
00141 #define MATCH_COL_SIZE 2
00142 #define MATCH_COL_RATING 3
00143 #define MATCH_COL_STATUS 4
00144 #define MATCH_COL_COUNT 5
00145 #define MATCH_COL_SPEED 6
00146 #define MATCH_COL_CLIENT 7
00147 #define MATCH_COL_MAX 8
00148
00149 #define IDC_MATCHES 100
00150 #define IDC_MATCH_HEADER 115
00151
00152 #endif