Cafu Engine
Group_New.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_NEW_GROUP_HPP_INCLUDED
8 #define CAFU_COMMAND_NEW_GROUP_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 
12 
13 class GroupT;
14 class MapDocumentT;
15 class MapElementT;
16 
17 
18 /// This class implements a command for adding a new group to the map document.
19 /// The newly added group initially has no members: it's up to the caller to put map elements into the new group.
20 /// Having no members means that the new group initially doesn't affect (the visibility of) any map elements,
21 /// but also that it is possibly subject to auto-pruning if no members are added to it soon.
22 /// The counterpart to this class is CommandDeleteGroupT.
23 class CommandNewGroupT : public CommandT
24 {
25  public:
26 
27  /// The constructor.
28  /// @param MapDoc The map document to add the new group to.
29  /// @param Name The name for the new group.
30  CommandNewGroupT(MapDocumentT& MapDoc, const wxString& Name);
31 
32  /// The destructor.
34 
35  /// Returns the new group.
36  GroupT* GetGroup() { return m_Group; }
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;
47  GroupT* m_Group;
48 };
49 
50 #endif
GroupT * GetGroup()
Returns the new group.
Definition: Group_New.hpp:36
void Undo()
This method un-does the command.
Definition: Group_New.cpp:48
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
~CommandNewGroupT()
The destructor.
Definition: Group_New.cpp:24
This class represents groups.
Definition: Group.hpp:20
CommandNewGroupT(MapDocumentT &MapDoc, const wxString &Name)
The constructor.
Definition: Group_New.cpp:12
wxString GetName() const
Returns the name (a description) of the command.
Definition: Group_New.cpp:63
bool Do()
This method executes the command.
Definition: Group_New.cpp:33
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
This class implements a command for adding a new group to the map document.
Definition: Group_New.hpp:23
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57