command.h

来自「这是我写的数据结构的课设」· C头文件 代码 · 共 168 行

H
168
字号
// Command.h: interface for the CCommand class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMMAD_H__5CA7A7E8_B327_41F2_988E_1666C8A1B779__INCLUDED_)
#define AFX_COMMAD_H__5CA7A7E8_B327_41F2_988E_1666C8A1B779__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000



class CCommand
{
protected:
	int		m_nStep ; // 命令操作步

public:
	CCommand() {}
	~CCommand() {}

	virtual int GetType() = 0;	// 返回命令类型 ECommandType
	virtual int OnLButtonDown(UINT nFlags, const CPoint center) = 0 ;
	virtual int OnMouseMove(UINT nFlags, const CPoint center) = 0 ;
	virtual int OnRButtonDown(UINT nFlags, const CPoint center) = 0 ;
	virtual int Cancel() = 0 ;
} ;


///////////////////////////////////////////////////////////////
/*	
 *	CInsertVertex
 */
class CInsertVertex : public CCommand
{
private:
	CPoint m_center;
public:
	CInsertVertex() ;
	~CInsertVertex() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
/*	
 *	CInsertPath
 */
class CInsertPath : public CCommand
{
private:
	CPoint m_center;
public:
	CInsertPath() ;
	~CInsertPath() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;
///////////////////////////////////////////////////////////////
/*	
 *	CDelete
 */
class CDelete : public CCommand
{
private:
	CPoint m_center;
public:
	CDelete() ;
	~CDelete() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;
///////////////////////////////////////////////////////////////
/*	
 *	CChange
 */
class CChange : public CCommand
{
private:
	CPoint m_center;
public:
	CChange() ;
	~CChange() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;
///////////////////////////////////////////////////////////////
/*	
 *	CInformation 
 */
class CInformation : public CCommand
{
private:
	CPoint m_center;
public:
	CInformation() ;
	~CInformation() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;
///////////////////////////////////////////////////////////////
/*	
 *	CShortestPath
 */
class CShortestPath : public CCommand
{
private:
	CPoint m_center;
public:
	CShortestPath() ;
	~CShortestPath() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;
///////////////////////////////////////////////////////////////
/*	
 *	CAllPaths
 */
class CAllPaths : public CCommand
{
private:
	CPoint m_center;
public:
	CAllPaths() ;
	~CAllPaths() ;

	int		GetType();
	int		OnLButtonDown(UINT nFlags, const CPoint center) ;
	int		OnMouseMove(UINT nFlags, const CPoint center) ;
	int		OnRButtonDown(UINT nFlags, const CPoint center) ;

	int		Cancel() ;
} ;

#endif // !defined(AFX_COMMAD_H__5CA7A7E8_B327_41F2_988E_1666C8A1B779__INCLUDED_)

⌨️ 快捷键说明

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