Emergency 20 Dokumentation  4.2.0
ToolTipWindow.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 #include <qsf/job/JobProxy.h>
15 
16 
17 //[-------------------------------------------------------]
18 //[ Forward declarations ]
19 //[-------------------------------------------------------]
20 namespace em5
21 {
22  class ToolTipManager;
23 }
24 namespace Rocket
25 {
26  namespace Core
27  {
28  class ElementText;
29  }
30 }
31 
32 
33 //[-------------------------------------------------------]
34 //[ Namespace ]
35 //[-------------------------------------------------------]
36 namespace em5
37 {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Classes ]
42  //[-------------------------------------------------------]
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Friend definitions ]
53  //[-------------------------------------------------------]
54  friend class ToolTipManager; // Needs access to the reload GUI method
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
61  explicit ToolTipWindow(qsf::GuiContext& guiContext);
62  virtual ~ToolTipWindow();
63 
64  void updateText(const std::string& text, const glm::ivec2& mousePosition);
65  void updatePosition(const glm::ivec2& mousePosition);
66 
67  void activate();
68  void deactivate(bool withFadeOut);
69 
70  // Configuration
71  bool isFadeOutEnabled() const;
72  void enabledFadeOut(bool enable);
73 
74  float getFadeOutTimeInSeconds() const;
75  void setFadeOutTimeInSeconds(float fadeTime);
76 
77  bool isShowDelayEnabled() const;
78  void enabledShowDelay(bool enable);
79 
80  float getShowDelayInSeconds() const;
81  void setShowDelayInSeconds(float delayTime);
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private methods ]
86  //[-------------------------------------------------------]
87  private:
88  void setupUI();
89  void onReloadGui();
90  glm::vec2 getContentSize(Rocket::Core::Element& element);
91 
92  void startShowDelay();
93  void startFadeOut();
94  void activateJob();
95  void updateAnimation(const qsf::JobArguments& jobArguments);
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private data ]
100  //[-------------------------------------------------------]
101  private:
102  qsf::JobProxy mUpdateJobProxy;
103  Rocket::Core::Element* mToolTipElement;
104  Rocket::Core::ElementText* mToolTipTextElement;
105  Rocket::Core::Element* mToolTipFormattedElement;
106  glm::vec2 mCurrentContentSize;
107  glm::vec2 mCurrentTooltipSize;
108 
109  // Show delay / fade out handling
110  bool mShowWithDelayEnabled;
111  bool mShowWithDelay;
112  float mShowDelayInSeconds;
113  float mCurrentShowDelayInSeconds;
114 
115  bool mFadingOutEnabled;
116  bool mFadingOut;
117  float mFadeOutTimeInSeconds;
118  float mCurrentFadeOutTimeInSeconds;
119 
120 
121  };
122 
123 
124 //[-------------------------------------------------------]
125 //[ Namespace ]
126 //[-------------------------------------------------------]
127 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
Definition: OverlayComponent.h:29
ToolTipWindow(qsf::GuiContext &guiContext)
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void setFadeOutTimeInSeconds(float fadeTime)
float getFadeOutTimeInSeconds() const
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
float getShowDelayInSeconds() const
void deactivate(bool withFadeOut)
bool isShowDelayEnabled() const
void enabledFadeOut(bool enable)
EMERGENCY 5 tooltip manager class.
Definition: ToolTipManager.h:53
void updatePosition(const glm::ivec2 &mousePosition)
void setShowDelayInSeconds(float delayTime)
void enabledShowDelay(bool enable)
void updateText(const std::string &text, const glm::ivec2 &mousePosition)
virtual ~ToolTipWindow()
EMERGENCY 5 tooltip window.
Definition: ToolTipWindow.h:47
bool isFadeOutEnabled() const