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

📄 addfunctiondlg.cpp

📁 文档生成工具 XML例子
💻 CPP
字号:
// AddFunctionDlg.cpp : implementation file
//

#include "stdafx.h"
#include "XMLClassDoc.h"
#include "AddFunctionDlg.h"
#include "DocManage.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAddFunctionDlg dialog


CAddFunctionDlg::CAddFunctionDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAddFunctionDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAddFunctionDlg)
	m_strComboType = _T("");
	m_strFunctionName = _T("");
	m_strParaNote = _T("");
	m_strReturn = _T("");
	m_strFunctionDeclare = _T("");
	//}}AFX_DATA_INIT
}


void CAddFunctionDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAddFunctionDlg)
	DDX_CBString(pDX, IDC_COMBO_TYPE, m_strComboType);
	DDX_Text(pDX, IDC_EDIT_FUNCTIONNAME, m_strFunctionName);
	DDX_Text(pDX, IDC_EDIT_PARANOTE, m_strParaNote);
	DDX_Text(pDX, IDC_EDIT_RETURN, m_strReturn);
	DDX_Text(pDX, IDC_EDIT_FUNDECLARE, m_strFunctionDeclare);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddFunctionDlg, CDialog)
	//{{AFX_MSG_MAP(CAddFunctionDlg)
	ON_EN_CHANGE(IDC_EDIT_PARANOTE, OnChangeEdit)
	ON_EN_CHANGE(IDC_EDIT_RETURN, OnChangeEdit)
	ON_EN_CHANGE(IDC_EDIT_FUNCTIONNAME, OnChangeEdit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddFunctionDlg message handlers

void CAddFunctionDlg::OnOK() 
{	
	UpdateData(true);
	m_strFunctionName.TrimLeft();
	m_strFunctionName.TrimRight();
	if (m_strFunctionName.IsEmpty())
	{
		MessageBox("请输入操作名!");
		return;
	}
	CDocManage *pDocManage = new CDocManage();
	pDocManage->AddFunction(m_strClassName, m_strFunctionDeclare, m_strFunctionName, m_strComboType);
	delete pDocManage;
	CDialog::OnOK();
}

void CAddFunctionDlg::OnChangeEdit() 
{
	UpdateData(true);
	m_strReturn.TrimLeft();
	m_strReturn.TrimRight();
	m_strFunctionName.TrimLeft();
	m_strFunctionName.TrimRight();
	m_strParaNote.TrimLeft();
	m_strParaNote.TrimRight();

	if (m_strReturn.IsEmpty())
	{
		m_strReturn = "void";
	}
	if (m_strFunctionName.IsEmpty())
	{
		m_strFunctionDeclare = m_strReturn + " " + m_strFunctionName + "()"; 
	}
	else
	{
		m_strFunctionDeclare = m_strReturn + " " + m_strFunctionName + "(" + m_strParaNote + ")";
	}
	UpdateData(false);
}


BOOL CAddFunctionDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();	
	((CComboBox*)GetDlgItem(IDC_COMBO_TYPE))->SetCurSel(1);		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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