NCL Composer  0.1.5
 All Classes Functions Variables Pages
Commands.h
1 /* Copyright (c) 2011-2012 Telemidia/PUC-Rio.
2  * All rights reserved. This program and the accompanying materials
3  * are made available under the terms of the Eclipse Public License v1.0
4  * which accompanies this distribution, and is available at
5  * http://www.eclipse.org/legal/epl-v10.html
6  *
7  * Contributors:
8  * Telemidia/PUC-Rio - initial API and implementation
9  */
10 #ifndef COMMANDS_H
11 #define COMMANDS_H
12 #include <QUndoCommand>
13 
14 #include "model/Project.h"
15 
16 namespace composer {
17  namespace core {
18  namespace util {
19 
23 class EditCommand : public QUndoCommand
24 {
25 public:
26  EditCommand(Project *project, Entity *entity,
27  QMap <QString, QString> newAttrs, QUndoCommand *parent = 0);
28 
29  void undo();
30  void redo();
31 
32 private:
33  Project *project;
34  QString uniqueId;
35  QMap <QString, QString> attrs, newAttrs;
36  MessageControl *msgControl;
37 };
38 
42 class RemoveCommand : public QUndoCommand
43 {
44 public:
45  RemoveCommand(Project *project, Entity *entity, QUndoCommand *parent = 0);
46 
47  void undo();
48  void redo();
49 
50 private:
51  Project *project;
52  Entity *entity;
53  QString parentUniqueId;
54  MessageControl *msgControl;
55  bool first;
56 };
57 
61 class AddCommand : public QUndoCommand
62 {
63 public:
64  AddCommand(Project *project, Entity *entity, QString parentUniqueId,
65  QUndoCommand *parent = 0);
66 
67  void undo();
68  void redo();
69 
70 private:
71  Project *project;
72  Entity *entity;
73  QString parentUniqueId;
74  MessageControl *msgControl;
75  bool first;
76 };
77 
78 //QString createCommandString(DiagramItem *item, const QPointF &point);
79 
80 } } } //end namespace
81 #endif // COMMANDS_H