1 | /*************************************************************************** |
2 | kimecommands.h - description |
3 | ------------------- |
4 | begin : Fri May 25 2001 |
5 | copyright : (C) 2001 by Jan Schäfer |
6 | email : janschaefer@users.sourceforge.net |
7 | ***************************************************************************/ |
8 | |
9 | /*************************************************************************** |
10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * |
15 | * * |
16 | ***************************************************************************/ |
17 | |
18 | #ifndef KIMECOMMANDS_H |
19 | #define KIMECOMMANDS_H |
20 | |
21 | |
22 | #include <qundostack.h> |
23 | |
24 | #include <kdeversion.h> |
25 | |
26 | class KImageMapEditor; |
27 | class AreaSelection; |
28 | |
29 | |
30 | |
31 | class CutCommand : public QUndoCommand |
32 | |
33 | { |
34 | public: |
35 | CutCommand (KImageMapEditor * document, const AreaSelection & selection); |
36 | virtual ~CutCommand(); |
37 | |
38 | virtual void redo(); |
39 | virtual void undo(); |
40 | |
41 | protected: |
42 | AreaSelection *_cutAreaSelection; |
43 | KImageMapEditor* _document; |
44 | bool _cutted; |
45 | }; |
46 | |
47 | /** |
48 | * Does the same like the cut command |
49 | * only have a different name in the Undo-History |
50 | **/ |
51 | class DeleteCommand : public CutCommand |
52 | { |
53 | public : |
54 | DeleteCommand (KImageMapEditor * document, const AreaSelection & selection); |
55 | }; |
56 | |
57 | class PasteCommand : public QUndoCommand |
58 | { |
59 | public: |
60 | PasteCommand (KImageMapEditor * document, const AreaSelection & selection); |
61 | ~PasteCommand (); |
62 | |
63 | virtual void redo(); |
64 | virtual void undo(); |
65 | |
66 | protected: |
67 | AreaSelection *_pasteAreaSelection; |
68 | KImageMapEditor* _document; |
69 | bool _pasted; |
70 | bool _wasUndoed; |
71 | |
72 | }; |
73 | |
74 | class MoveCommand : public QUndoCommand |
75 | { |
76 | public: |
77 | MoveCommand (KImageMapEditor *document, AreaSelection *a,const QPoint & oldPoint); |
78 | ~MoveCommand (); |
79 | |
80 | virtual void redo(); |
81 | virtual void undo(); |
82 | |
83 | protected: |
84 | QPoint _newPoint; |
85 | QPoint _oldPoint; |
86 | |
87 | KImageMapEditor* _document; |
88 | AreaSelection *_areaSelection; |
89 | //- Area *_oldArea; |
90 | }; |
91 | |
92 | class ResizeCommand : public QUndoCommand |
93 | { |
94 | public: |
95 | ResizeCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea); |
96 | ~ResizeCommand (); |
97 | |
98 | virtual void redo(); |
99 | virtual void undo(); |
100 | |
101 | protected: |
102 | |
103 | KImageMapEditor* _document; |
104 | AreaSelection *_areaSelection; |
105 | Area *_oldArea; |
106 | Area *_newArea; |
107 | }; |
108 | |
109 | class AddPointCommand : public QUndoCommand |
110 | { |
111 | public: |
112 | AddPointCommand (KImageMapEditor *document, AreaSelection *a, const QPoint & p); |
113 | ~AddPointCommand (); |
114 | |
115 | virtual void redo(); |
116 | virtual void undo(); |
117 | |
118 | protected: |
119 | |
120 | KImageMapEditor* _document; |
121 | AreaSelection *_areaSelection; |
122 | QPoint _point; |
123 | int _coordpos; |
124 | }; |
125 | |
126 | class RemovePointCommand : public QUndoCommand |
127 | { |
128 | public: |
129 | RemovePointCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea); |
130 | ~RemovePointCommand (); |
131 | |
132 | virtual void redo(); |
133 | virtual void undo(); |
134 | |
135 | protected: |
136 | |
137 | KImageMapEditor* _document; |
138 | AreaSelection *_areaSelection; |
139 | Area *_oldArea; |
140 | Area *_newArea; |
141 | }; |
142 | |
143 | |
144 | class CreateCommand : public QUndoCommand |
145 | { |
146 | public: |
147 | CreateCommand (KImageMapEditor *document, Area *area); |
148 | ~CreateCommand (); |
149 | |
150 | virtual void redo(); |
151 | virtual void undo(); |
152 | |
153 | protected: |
154 | |
155 | KImageMapEditor* _document; |
156 | Area *_area; |
157 | bool _created; |
158 | bool _wasUndoed; |
159 | }; |
160 | |
161 | |
162 | #endif |
163 | |