Click here to Skip to main content
15,883,901 members
Articles / Desktop Programming / MFC

CListCtrlExt and CListViewExt controls

Rate me:
Please Sign up or sign in to vote.
4.78/5 (22 votes)
20 Feb 2012CPOL5 min read 82.7K   8.7K   84  
An enhanced list control based on the standard CListCtrl MFC class.
// TestList6View.h : interface of the CTestList6View class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TESTLIST6VIEW_H__F51991ED_08B3_406F_8F18_BBCAB06185B4__INCLUDED_)
#define AFX_TESTLIST6VIEW_H__F51991ED_08B3_406F_8F18_BBCAB06185B4__INCLUDED_

#include <afxcview.h>
#include "ChildListCtrlExt.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CTestList6View : public CListView
{
protected: // create from serialization only
	CTestList6View();
	DECLARE_DYNCREATE(CTestList6View)

// Attributes
public:
	CTestList6Doc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTestList6View)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CTestList6View();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CEdit m_Edit;
	CComboBox m_Combo;
	CDateTimeCtrl m_DT;
	CChildListCtrlExt m_List;
	static BOOL EndEditor(CWnd** pWnd, int nRow, int nColumn, CString &strSubItemText, DWORD_PTR dwItemData, void* pThis, BOOL bUpdate);
	static BOOL InitEditor(CWnd** pWnd, int nRow, int nColumn, CString &strSubItemText, DWORD_PTR dwItemData, void* pThis, BOOL bUpdate);

// Generated message map functions
protected:
	void RefreshList();
	void PopulateList();
	//{{AFX_MSG(CTestList6View)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnViewRefresh();
	afx_msg void OnViewLineup();
	//}}AFX_MSG
	afx_msg void OnListStyle(UINT nCommandID);
	afx_msg void OnUpdateListStyles(CCmdUI* pCmdUI);
	DECLARE_MESSAGE_MAP()

private:
	CFont* m_pFont;
};

#ifndef _DEBUG  // debug version in TestList6View.cpp
inline CTestList6Doc* CTestList6View::GetDocument()
   { return (CTestList6Doc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TESTLIST6VIEW_H__F51991ED_08B3_406F_8F18_BBCAB06185B4__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions