You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.5 KiB
C++
80 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QList>
|
|
#include <QUndoCommand>
|
|
#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<ZxRenderItem*>& items, \
|
|
bool bNeedLayout = true, \
|
|
QUndoCommand *parent = 0);
|
|
~ZxAddCommandMulti();
|
|
|
|
virtual void redo();
|
|
virtual void undo();
|
|
|
|
private:
|
|
|
|
ZxRenderItem* m_pParent;
|
|
QList<ZxRenderItem*> 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;
|
|
};
|
|
|
|
|
|
|
|
|