MyCommand.h
上传用户:netltd
上传日期:2013-02-12
资源大小:7234k
文件大小:1k
- #include <afxtempl.h>
- /////////////////////////////////////////////////////////////////////////////////////////////
- class CMyCommandStruct: public CObject
- {
- public:
- int m_command; //操作命令ID号
- int m_num; //操作命令操作的对象数目
- int* m_object; //图形对象代号,操作命令无对象时为NULL
- int* m_index; //图形对象在其数列中的序号
- public:
- CMyCommandStruct(int command, int num, int* object, int* index);
- ~CMyCommandStruct();
- };
- /////////////////////////////////////////////////////////////////////////////////////////////
- //命令列表类,用于存储所有发生的命令,以便Undo,Redo命令使用
- class CMyCommand: public CObject
- {
- public:
- DECLARE_DYNCREATE(CMyCommand)
- //用于储存命令列表类指针
- CObArray m_CommandArray;
- //用于存储图形对象发生改变后先前的信息
- CArray<float, float> m_SavedProportion;
- CArray<CPoint, CPoint> m_SavedPosition;
- CArray<int, int> m_SavedLineStyle;
- CArray<int, int> m_SavedColor;
-
- public:
- int CommandPointer; //命令指针
- int ProportionPointer;
- int PositionPointer;
- int LineStylePointer;
- int ColorPointer;
- public:
- CMyCommand();
- //增加命令
- void AddCommand(int command, int num, int* object, int* index);
- CMyCommandStruct* GetCommandAt(int index);
- //删除序号从index之后的命令
- void DelCommandFrom(int index);
- void AddProportion(int proportion);
- void GetProportionAt(int index);
- void DelProportionFrom(int index);
- public:
- ~CMyCommand();
- };