1 | /*************************************************************************** |
2 | * Copyright (C) 1999-2006 by Éric Bischoff <ebischoff@nerim.net> * |
3 | * Copyright (C) 2007 by Albert Astals Cid <aacid@kde.org> * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * |
9 | ***************************************************************************/ |
10 | |
11 | /* Action stored in the undo buffer */ |
12 | |
13 | #ifndef _ACTION_H_ |
14 | #define _ACTION_H_ |
15 | |
16 | #include <QUndoCommand> |
17 | #include <QPointF> |
18 | |
19 | class ToDraw; |
20 | |
21 | class QGraphicsScene; |
22 | |
23 | class ActionAdd : public QUndoCommand |
24 | { |
25 | public: |
26 | ActionAdd(ToDraw *item, QGraphicsScene *scene); |
27 | ~ActionAdd(); |
28 | |
29 | void redo(); |
30 | void undo(); |
31 | |
32 | private: |
33 | ToDraw *m_item; |
34 | QGraphicsScene *m_scene; |
35 | bool m_done; |
36 | }; |
37 | |
38 | |
39 | class ActionRemove : public QUndoCommand |
40 | { |
41 | public: |
42 | ActionRemove(ToDraw *item, QGraphicsScene *scene); |
43 | ~ActionRemove(); |
44 | |
45 | void redo(); |
46 | void undo(); |
47 | |
48 | private: |
49 | ToDraw *m_item; |
50 | QGraphicsScene *m_scene; |
51 | bool m_done; |
52 | }; |
53 | |
54 | class ActionMove : public QUndoCommand |
55 | { |
56 | public: |
57 | ActionMove(ToDraw *item, const QPointF &pos, int zValue, QGraphicsScene *scene); |
58 | |
59 | void redo(); |
60 | void undo(); |
61 | |
62 | private: |
63 | ToDraw *m_item; |
64 | QPointF m_pos; |
65 | qreal m_zValue; |
66 | QGraphicsScene *m_scene; |
67 | }; |
68 | |
69 | #endif |
70 | |