Cafu Engine
DialogEntityInspector.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_MAPEDITOR_DIALOG_ENTITY_INSPECTOR_HPP_INCLUDED
8 #define CAFU_MAPEDITOR_DIALOG_ENTITY_INSPECTOR_HPP_INCLUDED
9 
10 #include "ObserverPattern.hpp"
11 
12 #include "wx/wx.h"
13 #include "wx/propgrid/manager.h"
14 
15 
16 namespace cf { namespace GameSys { class ComponentBaseT; } }
17 namespace cf { namespace GameSys { class EntityT; } }
18 namespace cf { namespace TypeSys { class VarBaseT; } }
19 class ChildFrameT;
20 class MapDocumentT;
21 
22 
23 namespace MapEditor
24 {
25  class EntityInspectorDialogT : public wxPropertyGridManager, public ObserverT
26  {
27  public:
28 
29  EntityInspectorDialogT(wxWindow* Parent, ChildFrameT* ChildFrame, const wxSize& Size);
31 
32  // ObserverT implementation.
33  void NotifySubjectChanged_Selection(SubjectT* Subject, const ArrayT<MapElementT*>& OldSelection, const ArrayT<MapElementT*>& NewSelection) override;
34  void NotifySubjectChanged_Deleted(SubjectT* Subject, const ArrayT< IntrusivePtrT<cf::GameSys::EntityT> >& Entities) override;
35  void NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail) override;
36  void NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail, const ArrayT<BoundingBox3fT>& OldBounds) override;
37  void Notify_EntChanged(SubjectT* Subject, const ArrayT< IntrusivePtrT<MapEditor::CompMapEntityT> >& Entities, EntityModDetailE Detail) override;
38  void Notify_VarChanged(SubjectT* Subject, const cf::TypeSys::VarBaseT& Var) override;
39  void NotifySubjectDies(SubjectT* dyingSubject) override;
40 
41 
42  private:
43 
44  void RefreshPropGrid();
45  void AppendComponent(IntrusivePtrT<cf::GameSys::ComponentBaseT> Comp);
46 
47  void OnPropertyGridChanging(wxPropertyGridEvent& Event);
48  void OnPropertyGridChanged(wxPropertyGridEvent& Event);
49  void OnPropertyGridRightClick(wxPropertyGridEvent& Event);
50 
51  MapDocumentT* m_MapDocument;
52  ChildFrameT* m_ChildFrame;
53  IntrusivePtrT<cf::GameSys::EntityT> m_SelectedEntity;
54  bool m_IsRecursiveSelfNotify;
55 
56  DECLARE_EVENT_TABLE()
57  };
58 }
59 
60 #endif
MapElemModDetailE
Definition: ObserverPattern.hpp:37
void NotifySubjectDies(SubjectT *dyingSubject) override
This method is called whenever a subject is about the be destroyed (and become unavailable).
Definition: DialogEntityInspector.cpp:214
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
void NotifySubjectChanged_Deleted(SubjectT *Subject, const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities) override
Notifies the observer that one or more entities have been deleted.
Definition: DialogEntityInspector.cpp:76
void NotifySubjectChanged_Selection(SubjectT *Subject, const ArrayT< MapElementT * > &OldSelection, const ArrayT< MapElementT * > &NewSelection) override
Notifies the observer that the selection in the current subject has been changed. ...
Definition: DialogEntityInspector.cpp:69
EntityModDetailE
Definition: ObserverPattern.hpp:47
This class represents a child frame.
Definition: ChildFrame.hpp:55
Definition: ObserverPattern.hpp:64
Definition: DialogEntityInspector.hpp:25
void NotifySubjectChanged_Modified(SubjectT *Subject, const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail) override
Definition: DialogEntityInspector.cpp:94
Definition: ObserverPattern.hpp:158
void Notify_VarChanged(SubjectT *Subject, const cf::TypeSys::VarBaseT &Var) override
Notifies the observer that a variable has changed.
Definition: DialogEntityInspector.cpp:176
This is the common base class for the VarT classes.
Definition: Variables.hpp:113
void Notify_EntChanged(SubjectT *Subject, const ArrayT< IntrusivePtrT< MapEditor::CompMapEntityT > > &Entities, EntityModDetailE Detail) override
Definition: DialogEntityInspector.cpp:127
This file provides the classes for the Observer pattern as described in the book by the GoF...