Cafu Engine
Group_Delete.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_COMMAND_DELETE_GROUP_HPP_INCLUDED
8 #define CAFU_COMMAND_DELETE_GROUP_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 
12 
14 class GroupT;
15 class MapDocumentT;
16 
17 
18 /// This class implements a command for deleting one or more groups from the map document.
19 /// Any members of the deleted group(s) are assigned the NULL (no) group.
20 /// The counterpart to this class is CommandNewGroupT.
22 {
23  public:
24 
25  /// The constructor for deleting a single group.
26  /// @param MapDoc The map document to delete the group from.
27  /// @param Group The group to be deleted from the map document.
28  CommandDeleteGroupT(MapDocumentT& MapDoc, GroupT* Group);
29 
30  /// The constructor for deleting multiple groups at once.
31  /// @param MapDoc The map document to delete the groups from.
32  /// @param Groups The groups to be deleted from the map document.
33  CommandDeleteGroupT(MapDocumentT& MapDoc, const ArrayT<GroupT*>& Groups);
34 
35  /// The destructor.
37 
38  // Implementation of the CommandT interface.
39  bool Do();
40  void Undo();
41  wxString GetName() const;
42 
43 
44  private:
45 
46  MapDocumentT& m_MapDoc; ///< The map document to delete the groups from.
47  const ArrayT<GroupT*> m_DelGroups; ///< The list of groups to delete.
48  const ArrayT<GroupT*> m_OldGroups; ///< The original list of groups before the delete.
49  CommandAssignGroupT* m_AssignNullGroup;
50 };
51 
52 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
This class implements a command for deleting one or more groups from the map document.
Definition: Group_Delete.hpp:21
wxString GetName() const
Returns the name (a description) of the command.
Definition: Group_Delete.cpp:105
This class represents groups.
Definition: Group.hpp:20
CommandDeleteGroupT(MapDocumentT &MapDoc, GroupT *Group)
The constructor for deleting a single group.
Definition: Group_Delete.cpp:22
void Undo()
This method un-does the command.
Definition: Group_Delete.cpp:88
bool Do()
This method executes the command.
Definition: Group_Delete.cpp:61
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
This class implements a command for putting a set of given map elements into a given group ("MapElems...
Definition: Group_Assign.hpp:21
~CommandDeleteGroupT()
The destructor.
Definition: Group_Delete.cpp:47