⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadfontdoc.cpp

📁 传真示例
💻 CPP
字号:
// LoadFontDoc.cpp : implementation of the CLoadFontDoc class
//

#include "stdafx.h"
#include "LoadFont.h"
#include "DlgcLoadFont.h"
#include "LoadFontDoc.h"
#include "FontBrowse.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLoadFontDoc

IMPLEMENT_DYNCREATE(CLoadFontDoc, CDocument)

BEGIN_MESSAGE_MAP(CLoadFontDoc, CDocument)
	//{{AFX_MSG_MAP(CLoadFontDoc)
	ON_COMMAND(ID_FONT_DOWNLOAD, OnFontDownload)
	ON_UPDATE_COMMAND_UI(ID_FONT_DOWNLOAD, OnUpdateFontDownload)
	ON_UPDATE_COMMAND_UI(ID_VIEW_PROGRESS, OnUpdateViewProgress)
	ON_COMMAND(ID_VIEW_PROGRESS, OnViewProgress)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLoadFontDoc construction/destruction

CLoadFontDoc::CLoadFontDoc()
{
	// TODO: add one-time construction code here
	
	// We will need this around to access functions in CLoadFontApp.
	m_pApp = (CLoadFontApp *)AfxGetApp();
	// This is the pointer to our DlgcLoadFont class object.
	m_pLF = 0;
}

CLoadFontDoc::~CLoadFontDoc()
{
}

BOOL CLoadFontDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	// Create the Dialogic LoadFont class.  This self initializes everything
	// it needs.
	m_pLF = new CDlgcLoadFont;
	if (!m_pLF)
		AfxMessageBox("Error creating CDlgcLoadFont resource.");

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CLoadFontDoc serialization

void CLoadFontDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CLoadFontDoc diagnostics

#ifdef _DEBUG
void CLoadFontDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CLoadFontDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CLoadFontDoc commands

void CLoadFontDoc::DeleteContents() 
{
	// TODO: Add your specialized code here and/or call the base class

	// Delete our DlgcLoadFont object.
	if (m_pLF)
		delete m_pLF;

	CDocument::DeleteContents();
}

void CLoadFontDoc::OnFontDownload() 
{
	if (!IsWindowVisible(m_pLF->m_pStatusDlg->m_hWnd))
	{
		m_pLF->m_pStatusDlg->ShowWindow(SW_SHOW);
		m_pLF->m_pStatusDlg->UpdateWindow();
	}

	BeginWaitCursor();
	m_pLF->DownloadFonts();
	EndWaitCursor();
}

void CLoadFontDoc::OnUpdateFontDownload(CCmdUI* pCmdUI) 
{
	if (m_pLF->Downloadable())
		pCmdUI->Enable(TRUE);
	else
		pCmdUI->Enable(FALSE);
}

void CLoadFontDoc::OnUpdateViewProgress(CCmdUI* pCmdUI) 
{
	pCmdUI->SetCheck(IsWindowVisible(m_pLF->m_pStatusDlg->m_hWnd));
}

void CLoadFontDoc::OnViewProgress() 
{
	if (IsWindowVisible(m_pLF->m_pStatusDlg->m_hWnd))
		m_pLF->m_pStatusDlg->ShowWindow(SW_HIDE);
	else
		m_pLF->m_pStatusDlg->ShowWindow(SW_SHOW);
	m_pLF->m_pStatusDlg->UpdateWindow();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -