www.pudn.com > CraftFTP_gb.rar > CustomCmdDialog.h
#if !defined(AFX_CUSTOMCMDDIALOG_H__49F49C79_B389_4315_A84A_BA7CEE84462D__INCLUDED_)
#define AFX_CUSTOMCMDDIALOG_H__49F49C79_B389_4315_A84A_BA7CEE84462D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CustomCmdDialog.h : header file
//
#include "DialogEx.h"
#define FIRST_CUSTOM_FTP_COMMAND 0x1000
#define LAST_CUSTOM_FTP_COMMAND 0x1200
/////////////////////////////////////////////////////////////////////////////
// CCustomCmdDialog dialog
struct CCustomFtpCmd
{
CCustomFtpCmd(){nCommandID = 0;}
void CopyFrom(CCustomFtpCmd * pCustomFtpCmd);
CString szCmdLabel; //命令标签
CString szCommand; //命令体
CString szDescription; //命令描述
UINT nCommandID; //菜单命令
};
class CCraftFTPApp;
class CCustomCmdList : public
CList
{
public:
CCustomCmdList()
{
m_nCommandID = FIRST_CUSTOM_FTP_COMMAND;
}
~CCustomCmdList()
{
Cleanup();
}
void Cleanup()
{
//释放内存
while(GetCount()>0)
{
CCustomFtpCmd * pFtpCmd = RemoveHead();
if(pFtpCmd) delete pFtpCmd;
}
m_nCommandID = FIRST_CUSTOM_FTP_COMMAND;
}
//创建新列表
void CreateNewFromList(CCustomCmdList * pList);
//从文件加载
BOOL LoadFromFile(LPCTSTR szPathName = NULL);
//保存到文件
void SaveToFile(LPCTSTR szPathName = NULL);
//根据命令ID查找
CCustomFtpCmd * FindByCommandID(UINT nCmdID);
public:
UINT m_nCommandID;
};
class CCustomCmdDialog : public CDialogEx
{
// Construction
public:
CCustomCmdDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CCustomCmdDialog)
enum { IDD = IDD_DIALOG_CUSTOMCMDS };
CListCtrl m_wndCustomCmdCtrl;
CString m_szDescription;
CString m_szCmdText;
CString m_szCmdLabel;
//}}AFX_DATA
public:
CGroupFrame m_GroupFrame;
int m_nSelectedItem;
CCustomCmdList m_list;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCustomCmdDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
static const DWORD m_nHelpIDs[];
virtual const DWORD* GetHelpIDs() {return m_nHelpIDs;}
// Generated message map functions
//{{AFX_MSG(CCustomCmdDialog)
virtual BOOL OnInitDialog();
afx_msg void OnButtonAddCustomFtpCmd();
afx_msg void OnItemChangedListCustomCmds(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnButtonRemoveCustomFtpCmd();
afx_msg void OnChangeEditFtpCmdLabel();
afx_msg void OnChangeEditFtpCmdText();
afx_msg void OnChangeEditFtpCmdDescription();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CUSTOMCMDDIALOG_H__49F49C79_B389_4315_A84A_BA7CEE84462D__INCLUDED_)