www.pudn.com > QQ2004_Source_0.01.rar > QQServerView.cpp


// QQServerView.cpp : implementation of the CQQServerView class 
// 
 
#include "stdafx.h" 
#include "QQServer.h" 
 
#include "QQServerDoc.h" 
#include "QQServerView.h" 
 
#include "MainFrm.h" 
 
#include "UserListDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CQQServerView 
IMPLEMENT_DYNCREATE(CQQServerView, CListView) 
 
BEGIN_MESSAGE_MAP(CQQServerView, CListView) 
	//{{AFX_MSG_MAP(CQQServerView) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CQQServerView construction/destruction 
 
CQQServerView::CQQServerView() 
{ 
	// TODO: add construction code here 
} 
 
CQQServerView::~CQQServerView() 
{ 
} 
 
BOOL CQQServerView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return CListView::PreCreateWindow(cs); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CQQServerView drawing 
 
void CQQServerView::OnDraw(CDC* pDC) 
{ 
	CQQServerDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
/*	pDC->SelectStockObject(ANSI_FIXED_FONT); 
	int i = 0; 
 
	CRect rectClient; 
	GetClientRect(&rectClient); 
	int nClientLines = rectClient.Height() / m_sizeChar.cy; 
 
	int nLines = pDoc->m_listMsg.GetCount(); 
	if(nLines != 0) 
	{ 
		if(nLines > nClientLines) 
		{ 
			int nDeleteLines = nLines - nClientLines; 
			for(i = 0; i < nDeleteLines; i++) 
			{ 
				pDoc->m_listMsg.RemoveHead(); 
			} 
			nLines = nClientLines; 
		} 
		POSITION pos; 
		for(i = 0; i < nLines; i++) 
		{ 
			pos = pDoc->m_listMsg.FindIndex(i); 
			pDC->TextOut(0, i * m_sizeChar.cy, pDoc->m_listMsg.GetAt(pos)); 
		} 
	}*/ 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CQQServerView diagnostics 
 
#ifdef _DEBUG 
void CQQServerView::AssertValid() const 
{ 
	CListView::AssertValid(); 
} 
 
void CQQServerView::Dump(CDumpContext& dc) const 
{ 
	CListView::Dump(dc); 
} 
 
CQQServerDoc* CQQServerView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CQQServerDoc))); 
	return (CQQServerDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CQQServerView message handlers 
void CQQServerView::OnInitialUpdate()  
{ 
	CListView::OnInitialUpdate(); 
	 
	// TODO: Add your specialized code here and/or call the base class 
	CListCtrl &theCtrl = GetListCtrl(); 
 
	DWORD ctrlStyle = ::GetWindowLong(theCtrl.GetSafeHwnd(), GWL_STYLE); 
	ctrlStyle &= ~LVS_ICON; 
	ctrlStyle &= ~LVS_SMALLICON; 
	ctrlStyle &= ~LVS_LIST; 
	ctrlStyle |= LVS_REPORT; 
	::SetWindowLong(theCtrl.GetSafeHwnd(), GWL_STYLE, ctrlStyle);	 
 
	theCtrl.InsertColumn(0, _T("ʱ¼ä")); 
	theCtrl.InsertColumn(1, _T("ÏûÏ¢")); 
 
	CRect rcClient; 
	GetClientRect(rcClient); 
	theCtrl.SetColumnWidth(0, (rcClient.Width() >> 3)); 
	theCtrl.SetColumnWidth(1, (rcClient.Width() - (rcClient.Width() >> 3))); 
}