Emergency 20 Dokumentation  4.2.0
ChatWindow.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 //[-------------------------------------------------------]
14 
15 #include <qsf/gui/GuiDocument.h>
16 #include <qsf/math/Color3.h>
17 
18 #include <boost/signals2.hpp>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
32  {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Public methods ]
37  //[-------------------------------------------------------]
38  public:
39  explicit ChatWindow(qsf::GuiContext& guiContext);
40  virtual ~ChatWindow();
41 
46  void addTextMessage(const std::string& user, const std::string& message, const qsf::Color3& color = qsf::Color3::WHITE);
47 
48  void showChatWindow();
49  void blurInputField();
50  void disableChatWindow(); // Calls "disconnectFromMultiplayerSession()" and suppresses chat window show requests
51  void disconnectFromMultiplayerSession();
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public virtual qsf::GuiDocument methods ]
56  //[-------------------------------------------------------]
57  public:
58  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
59 
60 
61  //[-------------------------------------------------------]
62  //[ Private virtual qsf::GuiDocument methods ]
63  //[-------------------------------------------------------]
64  private:
65  virtual bool onPreShow() override;
66  virtual void onPreHide() override;
67 
68 
69  //[-------------------------------------------------------]
70  //[ Private methods ]
71  //[-------------------------------------------------------]
72  private:
77  void blockInput();
78 
83  void unblockInput();
84 
89  void onChatMessage(const multiplayer::SessionBase::ChatMessage& message);
90 
91 
92  //[-------------------------------------------------------]
93  //[ Private data ]
94  //[-------------------------------------------------------]
95  private:
96  multiplayer::SessionBase* mMultiplayerSession;
97  bool mChatWindowDisabled;
98  boost::signals2::scoped_connection mChatMessageConnection;
99 
100 
101  };
102 
103 
104 //[-------------------------------------------------------]
105 //[ Namespace ]
106 //[-------------------------------------------------------]
107 } // em5
Definition: ActionPriority.h:13
static const Color3 WHITE
White (sRGB="255 255 255", Hex="#FFFFFF")
Definition: Color3.h:41
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: SessionBase.h:139
Color class with red, green and blue component.
Definition: Color3.h:30
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
EMERGENCY 5 multiplayer session base class.
Definition: SessionBase.h:55
Definition: ChatWindow.h:31