143 lines
3.7 KiB
C++
143 lines
3.7 KiB
C++
// appdatatzlistview.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "appdatatzlistview.h"
|
|
#include "Constant.h"
|
|
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
extern int g_iCurrListColIndex;
|
|
extern int g_iCurrListColOrder;
|
|
extern int CALLBACK ListStrCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lSortObject);
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataTzListView
|
|
|
|
IMPLEMENT_DYNCREATE(CAppDataTzListView, CListView)
|
|
|
|
CAppDataTzListView::CAppDataTzListView()
|
|
{
|
|
m_pMngFrm = NULL;
|
|
}
|
|
|
|
CAppDataTzListView::~CAppDataTzListView()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAppDataTzListView, CListView)
|
|
//{{AFX_MSG_MAP(CAppDataTzListView)
|
|
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
|
ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataTzListView drawing
|
|
|
|
void CAppDataTzListView::OnDraw(CDC* pDC)
|
|
{
|
|
CDocument* pDoc = GetDocument();
|
|
// TODO: add draw code here
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataTzListView diagnostics
|
|
|
|
#ifdef _DEBUG
|
|
void CAppDataTzListView::AssertValid() const
|
|
{
|
|
CListView::AssertValid();
|
|
}
|
|
|
|
void CAppDataTzListView::Dump(CDumpContext& dc) const
|
|
{
|
|
CListView::Dump(dc);
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataTzListView message handlers
|
|
|
|
void CAppDataTzListView::OnInitialUpdate()
|
|
{
|
|
CListView::OnInitialUpdate();
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
CString strColTitle;
|
|
|
|
GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP
|
|
| LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES);
|
|
|
|
m_pMngFrm = (CMDIChildWnd*)GetParentFrame();
|
|
|
|
g_iCurrListColIndex = (int)VAL_ZERO;
|
|
g_iCurrListColOrder = (int)VAL_ZERO;
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_TZ_TZNAME);
|
|
GetListCtrl().InsertColumn(0, strColTitle, LVCFMT_LEFT, 100);
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_TZ_TYPE);
|
|
GetListCtrl().InsertColumn(1, strColTitle, LVCFMT_LEFT, 250);
|
|
strColTitle.Empty();
|
|
|
|
strColTitle.LoadString(IDS_DB_TZ_CDATE);
|
|
GetListCtrl().InsertColumn(2, strColTitle, LVCFMT_LEFT, 250);
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_TZ_DESC);
|
|
GetListCtrl().InsertColumn(3, strColTitle, LVCFMT_LEFT, 250);
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_TZ_LOCATION);
|
|
GetListCtrl().InsertColumn(4, strColTitle, LVCFMT_LEFT, 250);
|
|
}
|
|
|
|
BOOL CAppDataTzListView::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 | LVS_SHOWSELALWAYS;
|
|
|
|
return CListView::PreCreateWindow(cs);
|
|
}
|
|
|
|
void CAppDataTzListView::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
// TODO: Add your control notification handler code here
|
|
g_iCurrListColIndex = pNMListView->iSubItem;
|
|
g_iCurrListColOrder = !g_iCurrListColOrder;
|
|
GetListCtrl().SortItems(ListStrCompare, (LPARAM)&GetListCtrl());
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CAppDataTzListView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int iItemIndex = (int)VAL_ZERO;
|
|
POSITION posItem;
|
|
DWORD dwItemHandle = (DWORD)VAL_ZERO;
|
|
|
|
posItem = GetListCtrl().GetFirstSelectedItemPosition();
|
|
iItemIndex = GetListCtrl().GetNextSelectedItem(posItem);
|
|
|
|
if ((int)VAL_MINUS_ONE != iItemIndex)
|
|
{
|
|
dwItemHandle = GetListCtrl().GetItemData(iItemIndex);
|
|
::SendMessage(m_pMngFrm->m_hWnd, WM_SKIP, (WPARAM )dwItemHandle, (LPARAM)VAL_ZERO);
|
|
}
|
|
*pResult = 0;
|
|
}
|