WZDDOC.CPP
资源名称:B43.rar [点击查看]
上传用户:leishk
上传日期:2022-03-16
资源大小:3649k
文件大小:3k
源码类别:
ListView/ListBox
开发平台:
Visual C++
- // WzdDoc.cpp : implementation of the CWzdDoc class
- //
- #include "stdafx.h"
- #include "Wzd.h"
- #include "WzdDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CWzdDoc
- IMPLEMENT_DYNCREATE(CWzdDoc, CDocument)
- BEGIN_MESSAGE_MAP(CWzdDoc, CDocument)
- //{{AFX_MSG_MAP(CWzdDoc)
- ON_COMMAND(IDC_ICON_MODE, OnIconMode)
- ON_COMMAND(IDC_LIST_MODE, OnListMode)
- ON_COMMAND(IDC_REPORT_MODE, OnReportMode)
- ON_COMMAND(IDC_SMALLICON_MODE, OnSmalliconMode)
- ON_COMMAND(IDC_UPLEVEL, OnUplevel)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CWzdDoc construction/destruction
- CWzdDoc::CWzdDoc()
- {
- // TODO: add one-time construction code here
- }
- CWzdDoc::~CWzdDoc()
- {
- while (!m_list.IsEmpty())
- {
- delete m_list.RemoveHead();
- }
- }
- BOOL CWzdDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
- int id=0;
- CWzdInfo *pDevInfo,*pFoldInfo,*pFileInfo;
- pDevInfo=new CWzdInfo("C:","C Drive",CWzdInfo::DEVICE,id++);
- m_list.AddTail(pDevInfo);
- m_pSelectionInfo=pDevInfo;
- pFoldInfo=new CWzdInfo("Winnt","Winnt directory",CWzdInfo::FOLDER,id++);
- pDevInfo->m_list.AddTail(pFoldInfo);
- pFileInfo=new CWzdInfo("file1.txt","the other file",CWzdInfo::FILE,id++);
- pFoldInfo->m_list.AddTail(pFileInfo);
- pFileInfo=new CWzdInfo("file.txt","the file",CWzdInfo::FILE,id++);
- pDevInfo->m_list.AddTail(pFileInfo);
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CWzdDoc serialization
- void CWzdDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CWzdDoc diagnostics
- #ifdef _DEBUG
- void CWzdDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
- void CWzdDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CWzdDoc commands
- void CWzdDoc::SaveSelection(CWzdInfo *pSelectionInfo,int nMode)
- {
- m_pSelectionInfo=pSelectionInfo;
- UpdateAllViews(NULL,nMode);
- }
- void CWzdDoc::OnIconMode()
- {
- UpdateAllViews(NULL,ICON_LIST_VIEW);
- }
- void CWzdDoc::OnListMode()
- {
- UpdateAllViews(NULL,LIST_LIST_VIEW);
- }
- void CWzdDoc::OnReportMode()
- {
- UpdateAllViews(NULL,REPORT_LIST_VIEW);
- }
- void CWzdDoc::OnSmalliconMode()
- {
- UpdateAllViews(NULL,SMALL_ICON_LIST_VIEW);
- }
- void CWzdDoc::OnUplevel()
- {
- UpdateAllViews(NULL,TREE_VIEW_UP_LEVEL);
- }