Cafu Engine
ToolbarGroups.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_TOOLBAR_GROUPS_HPP_INCLUDED
8 #define CAFU_TOOLBAR_GROUPS_HPP_INCLUDED
9 
10 #include "ObserverPattern.hpp"
11 #include "Commands/Group_SetProp.hpp"
12 #include "Templates/Array.hpp"
13 #include "wx/panel.h"
14 
15 
16 class ChildFrameT;
17 class CommandHistoryT;
18 class MapDocumentT;
19 class GroupsListViewT;
20 
21 
22 /// The groups toolbar (actually, a dialog).
23 class GroupsToolbarT : public wxPanel, public ObserverT
24 {
25  public:
26 
27  /// The constructor.
28  GroupsToolbarT(ChildFrameT* ChildFrame, CommandHistoryT* History);
29 
30  /// The destructor.
32 
33  // Implementation of the ObserverT interface.
35  void NotifySubjectDies(SubjectT* Subject);
36 
37 
38  private:
39 
40  friend class GroupsListViewT;
41 
42  ChildFrameT* m_ChildFrame;
43  CommandHistoryT* m_History;
44  MapDocumentT* m_MapDoc;
45  GroupsListViewT* m_ListView;
46  bool m_IsRecursiveSelfNotify;
47 
48  // The event handlers.
49  void OnToggleVisibility(unsigned long GroupNr); ///< Called by the m_ListView when the visibility of the group with the given number was toggled.
50  void OnToggleProperty(unsigned long GroupNr, CommandGroupSetPropT::PropT Prop); ///< Called by the m_ListView when a property of the group with the given number was toggled.
51  void OnMenu(wxCommandEvent& CE); ///< Event handler for popup (context) menu events.
52  void OnMenuUpdate(wxUpdateUIEvent& UE); ///< Event handler for popup menu update events.
53 
54  /// IDs for the controls in whose events we are interested.
55  enum
56  {
57  ID_LISTVIEW_GROUPS=wxID_HIGHEST+1,
58  ID_MENU_SELECT,
59  ID_MENU_EDIT_RENAME,
60  ID_MENU_EDIT_SETCOLOR,
61  ID_MENU_EDIT_SHOW,
62  ID_MENU_EDIT_HIDE,
63  ID_MENU_EDIT_CANSELECT,
64  ID_MENU_EDIT_LOCK,
65  ID_MENU_EDIT_SELASGROUP,
66  ID_MENU_EDIT_SELASINDIV,
67  // ID_MENU_NEW_GROUP, // Create a new, empty group. Doesn't buy us any new functionality at the cost of confusing the user.
68  // ID_MENU_AUGMENT_GROUP, // Add/Assign the selected elements as members of this group. Same problem as with ID_MENU_NEW_GROUP.
69  ID_MENU_DELETE,
70  ID_MENU_MERGE,
71  ID_MENU_MOVEUP,
72  ID_MENU_MOVEDOWN,
73  ID_MENU_SHOW_ALL
74  };
75 
76  DECLARE_EVENT_TABLE()
77 };
78 
79 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
void NotifySubjectChanged_Groups(SubjectT *Subject)
Notifies the observer that the groups in the current subject have been changed (new group added...
Definition: ToolbarGroups.cpp:344
Definition: CommandHistory.hpp:13
This class represents a child frame.
Definition: ChildFrame.hpp:55
Definition: ObserverPattern.hpp:64
GroupsToolbarT(ChildFrameT *ChildFrame, CommandHistoryT *History)
The constructor.
Definition: ToolbarGroups.cpp:309
Definition: ObserverPattern.hpp:158
void NotifySubjectDies(SubjectT *Subject)
This method is called whenever a subject is about the be destroyed (and become unavailable).
Definition: ToolbarGroups.cpp:368
This class implements the list view of the map editor groups.
Definition: ToolbarGroups.cpp:40
~GroupsToolbarT()
The destructor.
Definition: ToolbarGroups.cpp:337
The groups toolbar (actually, a dialog).
Definition: ToolbarGroups.hpp:23
This file provides the classes for the Observer pattern as described in the book by the GoF...