www.pudn.com > netmapper.rar > MapView.cpp


// MapView.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "NetMapDoc.h" 
#include "NetMap.h" 
#include "MapView.h" 
#include "Mainfrm.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMapView 
 
IMPLEMENT_DYNCREATE(CMapView, CFormView) 
 
CMapView::CMapView() 
	: CFormView(CMapView::IDD) 
{ 
	//{{AFX_DATA_INIT(CMapView) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
 
} 
 
CMapView::~CMapView() 
{ 
 
} 
 
void CMapView::DoDataExchange(CDataExchange* pDX) 
{ 
	CFormView::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMapView) 
	DDX_Control(pDX, IDC_TREE4, m_vlan); 
	DDX_Control(pDX, IDC_TREE3, m_map); 
	DDX_Control(pDX, IDC_TAB2, m_tab); 
	//}}AFX_DATA_MAP 
} 
void CMapView::OnInitialUpdate() 
{ 
	CFormView::OnInitialUpdate(); 
	GetParentFrame()->RecalcLayout(); 
	ResizeParentToFit(); 
    CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd; 
	pMain->pListView=this; 
    m_tab.InsertItem(0, _T("设备列表") ); 
    m_tab.InsertItem(1, _T("VLAN列表") ); 
    m_vlan.ShowWindow( SW_HIDE ); 
} 
 
BEGIN_MESSAGE_MAP(CMapView, CFormView) 
	//{{AFX_MSG_MAP(CMapView) 
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB2, OnSelchangeTab2) 
	ON_WM_DESTROY() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMapView diagnostics 
 
#ifdef _DEBUG 
void CMapView::AssertValid() const 
{ 
	CFormView::AssertValid(); 
} 
 
void CMapView::Dump(CDumpContext& dc) const 
{ 
	CFormView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMapView message handlers 
 
void CMapView::OnSelchangeTab2(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
int sel = m_tab.GetCurSel(); 
 
switch(sel) 
{ 
case 0: 
m_map.ShowWindow( SW_SHOW ); 
m_vlan.ShowWindow( SW_HIDE ); 
break; 
case 1: 
m_vlan.ShowWindow( SW_SHOW ); 
m_map.ShowWindow( SW_HIDE ); 
break; 
} 
	 
	*pResult = 0; 
} 
 
void CMapView::OnDestroy()  
{ 
	CFormView::OnDestroy(); 
 
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd; 
CMainFrame::NodeData *p; 
for (int i=0;iNodeArray.GetSize();i++) 
{ 
	p=(CMainFrame::NodeData *)m_map.GetItemData(pMain->NodeArray[i]); 
    if (p!=NULL) 
    { 
	if (p->pImage!=NULL) delete p->pImage; 
	delete p; 
	} 
}	 
	 
}