Emergency 20 Dokumentation  4.2.0
VehicleOrderBar.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 //[-------------------------------------------------------]
15 
16 #include <qsf/gui/GuiDocument.h>
17 
18 #include <Rocket/Core/String.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
51  {
55  VEHICLEORDERBARBUTTON_TECH
56  };
57 
58 
59  //[-------------------------------------------------------]
60  //[ Public methods ]
61  //[-------------------------------------------------------]
62  public:
63  explicit VehicleOrderBar(qsf::GuiContext& guiContext);
64 
65  void setEnabled(bool enabled);
66 
67  void enableButton(bool state, VehicleOrderBarButton buttonID);
68  void blinkButton(bool state, VehicleOrderBarButton buttonID);
69  void setButtonVisible(bool state, VehicleOrderBarButton buttonID);
70 
71  void deselectAll();
72 
73  void clickFireDepartment();
74  void clickAmbulanceDepartment();
75  void clickPoliceDepartment();
76  void clickTechDepartment();
77 
78 
79  //[-------------------------------------------------------]
80  //[ Public virtual qsf::GuiDocument methods ]
81  //[-------------------------------------------------------]
82  public:
83  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
84 
85 
86  //[-------------------------------------------------------]
87  //[ Private virtual qsf::GuiDocument methods ]
88  //[-------------------------------------------------------]
89  private:
90  virtual bool onPreShow() override;
91  virtual void onPreHide() override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
98  void setupUI();
99  void onReloadGui();
100 
101  Rocket::Core::String getStringByID(VehicleOrderBarButton buttonID);
102  void showVehicleSelection(const std::string& elementName, units::Department selectionDepartment);
103 
104 
105  //[-------------------------------------------------------]
106  //[ Private methods ]
107  //[-------------------------------------------------------]
108  private:
109  bool mEnabled;
110  BlinkButton mBlinkButton;
111  Rocket::Core::Element* mOrderBarContainer;
112 
113  // 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 minimap was still there but the minimap instance was destroyed
114  // Proper fix see QSF Bug "H301 GUI | "qsf::GuiDocument" | We need to guarantee that for each e.g. "onPostShow()" there's a "onPostHide()""
115  boost::signals2::connection mReloadGuiConnection;
116 
117 
118  };
119 
120 
121 //[-------------------------------------------------------]
122 //[ Namespace ]
123 //[-------------------------------------------------------]
124 } // em5
Definition: ActionPriority.h:13
VehicleOrderBarButton
Definition: VehicleOrderBar.h:50
Department
Definition: Department.h:19
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
Definition: MiniMapWindow.h:43
Vehicle order bar window.
Definition: VehicleOrderBar.h:42