Cafu Engine
GuiDocument.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_GUIEDITOR_GUI_DOCUMENT_HPP_INCLUDED
8 #define CAFU_GUIEDITOR_GUI_DOCUMENT_HPP_INCLUDED
9 
10 #include "CompSelection.hpp"
11 #include "ObserverPattern.hpp"
12 #include "../DocumentAdapter.hpp"
13 
14 #include "GuiSys/GuiImpl.hpp"
15 #include "GuiSys/Window.hpp"
16 #include "Templates/Pointer.hpp"
17 #include "UniScriptState.hpp"
18 #include "wx/wx.h"
19 
20 
21 class GameConfigT;
22 class EditorMaterialI;
23 
24 
25 namespace GuiEditor
26 {
28  {
29  GuiPropertiesT() {}
31 
32  bool Activate;
33  bool Interactive;
34  bool ShowMouse;
35  wxString DefaultFocus;
36  };
37 
38 
39  class GuiDocumentT : public SubjectT
40  {
41  public:
42 
43  GuiDocumentT(GameConfigT* GameConfig, const wxString& GuiInitFileName="");
44  ~GuiDocumentT();
45 
46  IntrusivePtrT<cf::GuiSys::GuiImplT> GetGui() { return m_Gui; }
47  IntrusivePtrT<cf::GuiSys::WindowT> GetRootWindow() { return m_Gui->GetRootWindow(); }
48 
49  GuiPropertiesT& GetGuiProperties() { return m_GuiProperties; }
50 
51  void SetSelection(const ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> >& NewSelection);
52  const ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> >& GetSelection() const { return m_Selection; }
53 
54  const ArrayT<EditorMaterialI*>& GetEditorMaterials() const { return m_EditorMaterials; }
55  GameConfigT* GetGameConfig() { return m_GameConfig; }
56  GuiDocAdapterT& GetAdapter() { return m_DocAdapter; }
57 
58  bool SaveInit_cgui(std::ostream& OutFile);
59 
61 
62 
63  private:
64 
65  GuiDocumentT(const GuiDocumentT&); ///< Use of the Copy Constructor is not allowed.
66  void operator = (const GuiDocumentT&); ///< Use of the Assignment Operator is not allowed.
67 
68  cf::UniScriptStateT m_ScriptState; ///< The script state that the m_Gui is bound to and lives in.
71  GuiPropertiesT m_GuiProperties;
72  ArrayT<EditorMaterialI*> m_EditorMaterials; ///< One editor material for each material in the GUI (its material manager).
73  GameConfigT* m_GameConfig;
74  GuiDocAdapterT m_DocAdapter; ///< Kept here because it sometimes needs the same lifetime as the GuiDocumentT itself, e.g. when referenced by a "material" property of the Window Inspector, or by commands in the command history.
75  };
76 }
77 
78 #endif
Definition: GuiDocument.hpp:27
This class implements a Graphical User Interface (GUI).
Definition: GuiImpl.hpp:42
Definition: EditorMaterial.hpp:21
The class describes the settings for a game/MOD.
Definition: GameConfig.hpp:32
Definition: GuiDocument.hpp:39
Definition: DocumentAdapter.hpp:56
IntrusivePtrT< WindowT > GetRootWindow() const
Returns the root window of this GUI.
Definition: GuiImpl.cpp:337
Definition: ObserverPattern.hpp:95
This class represents the state of a script: the underlying Lua state, pending coroutines, metatables for C++ class hierarchies, etc.
Definition: UniScriptState.hpp:214
This file provides the classes for the Observer pattern as described in the book by the GoF...
Definition: Renderer.hpp:16