Cafu Engine
DocumentAdapter.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_DOCUMENT_ADAPTER_HPP_INCLUDED
8 #define CAFU_DOCUMENT_ADAPTER_HPP_INCLUDED
9 
10 #include "Templates/Array.hpp"
11 
12 
13 class EditorMaterialI;
14 class MapDocumentT;
15 namespace cf { namespace TypeSys { class VarBaseT; } }
16 namespace GuiEditor { class GuiDocumentT; }
17 namespace ModelEditor { class ModelDocumentT; }
18 
19 
20 /// This class provides a common interface to the documents of the map, GUI or model editor.
21 /// Using this interface, it is possible to have shared code (like the material browser,
22 /// parts of the component system, and some commands) that can access a document without
23 /// knowing whether it deals with (and does its work for) a map, a GUI or a model document.
24 /// In summary, the shared code is nicely separated from the editor documents.
26 {
27  public:
28 
29  virtual const ArrayT<EditorMaterialI*>& GetMaterials() const=0;
30  virtual void GetUsedMaterials(ArrayT<EditorMaterialI*>& UsedMaterials) const=0;
31  virtual void OnMarkMaterial(EditorMaterialI* Mat) const=0;
32  virtual void OnReplaceMaterial(EditorMaterialI* Mat) const=0;
33  virtual void UpdateAllObservers_VarChanged(const cf::TypeSys::VarBaseT& Var)=0;
34 };
35 
36 
38 {
39  public:
40 
42 
43  const ArrayT<EditorMaterialI*>& GetMaterials() const;
44  void GetUsedMaterials(ArrayT<EditorMaterialI*>& UsedMaterials) const;
45  void OnMarkMaterial(EditorMaterialI* Mat) const;
46  void OnReplaceMaterial(EditorMaterialI* Mat) const;
47  void UpdateAllObservers_VarChanged(const cf::TypeSys::VarBaseT& Var);
48 
49 
50  private:
51 
52  MapDocumentT& m_MapDoc;
53 };
54 
55 
57 {
58  public:
59 
61 
62  const ArrayT<EditorMaterialI*>& GetMaterials() const;
63  void GetUsedMaterials(ArrayT<EditorMaterialI*>& UsedMaterials) const;
64  void OnMarkMaterial(EditorMaterialI* Mat) const;
65  void OnReplaceMaterial(EditorMaterialI* Mat) const;
66  void UpdateAllObservers_VarChanged(const cf::TypeSys::VarBaseT& Var);
67 
68 
69  private:
70 
71  GuiEditor::GuiDocumentT& m_GuiDoc;
72 };
73 
74 
76 {
77  public:
78 
80 
81  const ArrayT<EditorMaterialI*>& GetMaterials() const;
82  void GetUsedMaterials(ArrayT<EditorMaterialI*>& UsedMaterials) const;
83  void OnMarkMaterial(EditorMaterialI* Mat) const;
84  void OnReplaceMaterial(EditorMaterialI* Mat) const;
85  void UpdateAllObservers_VarChanged(const cf::TypeSys::VarBaseT& Var);
86 
87 
88  private:
89 
90  ModelEditor::ModelDocumentT& m_ModelDoc;
91 };
92 
93 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
Definition: DocumentAdapter.hpp:75
Definition: DocumentAdapter.hpp:37
Definition: EditorMaterial.hpp:21
This class provides a common interface to the documents of the map, GUI or model editor.
Definition: DocumentAdapter.hpp:25
Definition: GuiDocument.hpp:39
This is the common base class for the VarT classes.
Definition: Variables.hpp:113
Definition: DocumentAdapter.hpp:56
Definition: ModelDocument.hpp:30