Emergency 20 Dokumentation  4.2.0
GuiHelper.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 "em5/Export.h"
14 
15 #include <qsf/math/Color4.h>
16 
17 #include <Rocket/Core/BaseXMLParser.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Time;
26  class Color3;
27  class Entity;
28  class GuiDocument;
29  class AssetProxy;
30 }
31 namespace Rocket
32 {
33  namespace Core
34  {
35  class Element;
36  class ElementDocument;
37  class ElementText;
38  }
39 }
40 
41 
42 //[-------------------------------------------------------]
43 //[ Namespace ]
44 //[-------------------------------------------------------]
45 namespace em5
46 {
47 
48 
49  //[-------------------------------------------------------]
50  //[ Classes ]
51  //[-------------------------------------------------------]
57  {
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public definitions ]
62  //[-------------------------------------------------------]
63  public:
64  static const qsf::Color4 IDLE_ACTION_COLOR; // Intense green
65  static const qsf::Color4 BUSY_ACTION_COLOR; // Yellow
66  static const qsf::Color4 BUSY_BLOCKED_ACTION_COLOR; // Orange
67  static const qsf::Color4 CALCULATING_PATH; // Red
68 
69 
70  //[-------------------------------------------------------]
71  //[ Public static methods ]
72  //[-------------------------------------------------------]
73  public:
74  // Get the text between span or from form inputs like text fields or password input fields
75  static Rocket::Core::String getValueById(Rocket::Core::ElementDocument& document, const Rocket::Core::String& id);
76  static void setValueById(Rocket::Core::ElementDocument& document, const Rocket::Core::String& id, const Rocket::Core::String& value);
77 
78  // Shows and hides elements - this is faster than the show/hide with display but has the side effect that the element is still used in the layouting
79  static void showElementWithVisibility(Rocket::Core::Element& element, bool show);
80  static void showElementByIdWithVisibility(Rocket::Core::ElementDocument& document, const Rocket::Core::String& id, bool show);
81 
82  // Shows and hides elements - this is slower than the show/hide with display property since it will change the layout
83  static void showElementWithDisplay(Rocket::Core::Element& element, bool show);
84  static void showElementByIdWithDisplay(Rocket::Core::ElementDocument& document, const Rocket::Core::String& id, bool show);
85 
86  // Shows and hides elements - just another alternative (TODO(fw): WHat is the difference to the others?)
87  static void showElementByIdWithHiddenClass(Rocket::Core::ElementDocument& document, const Rocket::Core::String& id, bool show);
88 
89  static Rocket::Core::Element* createElement(Rocket::Core::Element* parentElement, const Rocket::Core::String& tagName, const Rocket::Core::XMLAttributes& attributes);
90  static Rocket::Core::ElementText* getOrCreateTextElement(Rocket::Core::Element* parentElement, bool clearChildsWhenNoTextFoundAsFirstChild = true);
91 
92  // Check box
93  static bool isCheckBoxChecked(Rocket::Core::Element& element);
94  static bool toggleCheckBox(Rocket::Core::Element& element);
95 
103  static std::string numberStringWithSeparator(uint32 number);
104 
109  static std::string convertStringToUsableFilename(const std::string& filename);
110 
115  static std::string fixedLength(int value, uint32 digits);
116 
121  static std::string insertWhiteSpaces(uint32 maximumWordLength, const std::string& string);
122 
127  static std::string useHTMLEntities(const std::string& string);
128 
133  static std::string getHexColorWhiteAlpha(float alpha);
134 
139  static const qsf::Color3& getSystemColor3();
140 
145  static const qsf::Color4& getActionPriorityColorByEntity(const qsf::Entity& entity);
146 
158  static void selectListElement(const qsf::GuiDocument& document, const std::string& listElementName, Rocket::Core::Element* selectedElement);
159 
167  static std::string getTimeAsGuiString(const qsf::Time& time);
168 
169  static std::string getDisplayNameForMap(const qsf::AssetProxy& mapAssetProxy);
170  static std::string getPreviewImageForMap(const qsf::AssetProxy& mapAssetProxy);
171 
172  static std::string equipmentNameToFilename(const std::string& equipmentName);
173 
174  static void getLetterboxDimensions(const glm::ivec2& frameSize, float aspectRatio, glm::ivec2& outSize, glm::ivec2& outOffset);
175 
176 
177  //[-------------------------------------------------------]
178  //[ Private methods ]
179  //[-------------------------------------------------------]
180  private:
181  // GUI helper can't be instantiated
182  GuiHelper() {}
183  ~GuiHelper() {}
184 
185 
186  };
187 
188 
189 //[-------------------------------------------------------]
190 //[ Namespace ]
191 //[-------------------------------------------------------]
192 } // em5
Definition: ActionPriority.h:13
static const qsf::Color4 CALCULATING_PATH
Definition: GuiHelper.h:67
Entity class.
Definition: Entity.h:46
Color class with red, green, blue and alpha component.
Definition: Color4.h:39
unsigned int uint32
Definition: PlatformTypes.h:181
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: OverlayComponent.h:29
Color class with red, green and blue component.
Definition: Color3.h:30
Definition: PickupPersonByParamedicAction.h:21
Asset proxy class.
Definition: AssetProxy.h:57
static const qsf::Color4 BUSY_ACTION_COLOR
Definition: GuiHelper.h:65
static const qsf::Color4 IDLE_ACTION_COLOR
Definition: GuiHelper.h:64
Definition: MiniMapWindow.h:43
EMERGENCY 5 static GUI helper class.
Definition: GuiHelper.h:56
static const qsf::Color4 BUSY_BLOCKED_ACTION_COLOR
Definition: GuiHelper.h:66
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32