// appexecsptconlistview.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "appsptconlistview.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern int g_iCurSptListColIndex; extern int g_iCurSptListColOrder; extern int CALLBACK SptListStrCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lSortObject); ///////////////////////////////////////////////////////////////////////////// // CAppSptConListView IMPLEMENT_DYNCREATE(CAppSptConListView, CListView) CAppSptConListView::CAppSptConListView() { } CAppSptConListView::~CAppSptConListView() { } BEGIN_MESSAGE_MAP(CAppSptConListView, CListView) //{{AFX_MSG_MAP(CAppSptConListView) ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAppSptConListView drawing void CAppSptConListView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // CAppSptConListView diagnostics #ifdef _DEBUG void CAppSptConListView::AssertValid() const { CListView::AssertValid(); } void CAppSptConListView::Dump(CDumpContext& dc) const { CListView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CAppSptConListView message handlers void CAppSptConListView::OnInitialUpdate() { CListView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CString strColTitle; int iColIndex = (int)VAL_ZERO; GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES); m_pMngFrm = (CMDIChildWnd*)GetParentFrame(); strColTitle.Empty(); strColTitle.LoadString(IDS_DB_CHANNEL_CHNUMBER); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_TSN); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_C1); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_C2); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_P1); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_P2); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_K); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_N); GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); } BOOL CAppSptConListView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Add your specialized code here and/or call the base class cs.style &= ~LVS_TYPEMASK; cs.style |= LVS_REPORT | LVS_SINGLESEL; return CListView::PreCreateWindow(cs); } void CAppSptConListView::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // TODO: Add your control notification handler code here g_iCurSptListColIndex = pNMListView->iSubItem; g_iCurSptListColOrder = !g_iCurSptListColOrder; GetListCtrl().SortItems(SptListStrCompare, (LPARAM)&GetListCtrl()); *pResult = 0; }