Emergency 20 Dokumentation  4.2.0
GuiHotReloadSupport.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include <qsf/gui/GuiDocument.h>
14 
15 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
35  {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Public methods ]
40  //[-------------------------------------------------------]
41  public:
49  explicit GuiHotReloadSupport(qsf::GuiContext& guiContext);
50 
55  virtual ~GuiHotReloadSupport();
56 
57 
58  //[-------------------------------------------------------]
59  //[ Protected virtual em5::GuiHotReloadSupport methods ]
60  //[-------------------------------------------------------]
61  protected:
66  virtual void onReloadGui();
67 
68  // TODO(co) I would like to see those special methods removed, just overload methods as usual and call base implementations as usual (can't change it right now to not make too many untested changes inside a patch)
69  // Due the private nature of onPreShow/onPreHide we have to define additional methods
70  // These methods have the same meaning as qsf::GuiDocument::onPreShow/onPreHide
71  virtual bool onDocumentPreShow();
72  virtual void onDocumentPreHide();
73 
74 
75  //[-------------------------------------------------------]
76  //[ Private virtual qsf::GuiDocument methods ]
77  //[-------------------------------------------------------]
78  private:
79  virtual bool onPreShow() override;
80  virtual void onPreHide() override;
81 
82 
83  //[-------------------------------------------------------]
84  //[ Private methods ]
85  //[-------------------------------------------------------]
86  private:
87  void disconnectSignals();
88 
89 
90  //[-------------------------------------------------------]
91  //[ Private data ]
92  //[-------------------------------------------------------]
93  private:
94  // TODO(sw) This is an fix for the crash when going from the game to the main menu and initiate then a GUI hot reloading -> The connection to the menubar was still there but the menubar instance was destroyed
95  // Proper fix see QSF Bug "H301 GUI | "qsf::GuiDocument" | We need to guarantee that for each e.g. "onPostShow()" there's a "onPostHide()""
96  boost::signals2::connection mReloadGuiConnection;
97 
98 
99  };
100 
101 
102 //[-------------------------------------------------------]
103 //[ Namespace ]
104 //[-------------------------------------------------------]
105 } // em5
virtual ~GuiHotReloadSupport()
Destructor.
Definition: ActionPriority.h:13
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
virtual bool onDocumentPreShow()
GuiHotReloadSupport(qsf::GuiContext &guiContext)
Default constructor.
A base class which adds GUI hot reloading support to an GUI document.
Definition: GuiHotReloadSupport.h:34
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
virtual void onDocumentPreHide()
virtual void onReloadGui()
Gets called when the GUI should be reloaded.