File indexing completed on 2024-09-08 06:49:27
0001 /* 0002 SPDX-FileCopyrightText: 1999-2006 Éric Bischoff <ebischoff@nerim.net> 0003 SPDX-FileCopyrightText: 2007 Albert Astals Cid <aacid@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 /* Action stored in the undo buffer */ 0009 0010 #ifndef _ACTION_H_ 0011 #define _ACTION_H_ 0012 0013 #include <QUndoCommand> 0014 #include <QPointF> 0015 0016 class ToDraw; 0017 0018 class QGraphicsScene; 0019 0020 class ActionAdd : public QUndoCommand 0021 { 0022 public: 0023 ActionAdd(ToDraw *item, QGraphicsScene *scene); 0024 ~ActionAdd() override; 0025 0026 void redo() override; 0027 void undo() override; 0028 0029 private: 0030 ToDraw *m_item; 0031 QGraphicsScene *m_scene; 0032 bool m_done; 0033 bool m_shouldAdd; 0034 }; 0035 0036 0037 class ActionRemove : public QUndoCommand 0038 { 0039 public: 0040 ActionRemove(ToDraw *item, const QPointF &oldPos, QGraphicsScene *scene); 0041 ~ActionRemove() override; 0042 0043 void redo() override; 0044 void undo() override; 0045 0046 private: 0047 ToDraw *m_item; 0048 QPointF m_oldPos; 0049 QGraphicsScene *m_scene; 0050 bool m_done; 0051 }; 0052 0053 class ActionMove : public QUndoCommand 0054 { 0055 public: 0056 ActionMove(ToDraw *item, const QPointF &oldPos, int zValue, QGraphicsScene *scene); 0057 0058 void redo() override; 0059 void undo() override; 0060 0061 private: 0062 ToDraw *m_item; 0063 QPointF m_oldPos; 0064 QPointF m_newPos; 0065 qreal m_zValue; 0066 QGraphicsScene *m_scene; 0067 }; 0068 0069 #endif