#pragma once #include #include #include "iPlotBase_global.h" class ZxRenderItem; /// 命令: 添加一个图元 class I_PLOTBASE_EXPORT ZxAddCommand : public QUndoCommand { public: ZxAddCommand(ZxRenderItem* pParent, ZxRenderItem* pItem, \ int nIndex = -1, bool bNeedLayout = true, \ QUndoCommand *parent = 0); ~ZxAddCommand(); virtual void redo(); virtual void undo(); private: ZxRenderItem* m_pParent; ZxRenderItem* m_pItem; int m_nIndex; bool m_bAdded : 1; bool m_bNeedLayout : 1; }; /// 命令: 添加多个图元 class I_PLOTBASE_EXPORT ZxAddCommandMulti : public QUndoCommand { public: ZxAddCommandMulti(ZxRenderItem* pParent, \ const QList& items, \ bool bNeedLayout = true, \ QUndoCommand *parent = 0); ~ZxAddCommandMulti(); virtual void redo(); virtual void undo(); private: ZxRenderItem* m_pParent; QList m_items; bool m_bAdded : 1; bool m_bNeedLayout : 1; }; /// 命令: 替换一个图元 class I_PLOTBASE_EXPORT ZxCmdReplace : public QUndoCommand { public: ZxCmdReplace(ZxRenderItem* pParent, ZxRenderItem* pItem, \ int nIndex, bool bNeedLayout = true, \ QUndoCommand *parent = 0); ~ZxCmdReplace(); virtual void redo(); virtual void undo(); private: ZxRenderItem* m_pParent; ZxRenderItem* m_pItem; int m_nIndex; bool m_bNeedLayout : 1; };