ScummVM API documentation
osd_message_queue.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef COMMON_OSD_MESSAGE_QUEUE_H
23 #define COMMON_OSD_MESSAGE_QUEUE_H
24 
25 #include "common/events.h"
26 #include "common/singleton.h"
27 #include "common/str.h"
28 #include "common/ustr.h"
29 #include "common/queue.h"
30 #include "common/mutex.h"
31 
32 namespace Common {
33 
45 class OSDMessageQueue : public Singleton<OSDMessageQueue>, public EventSource {
46 public:
48  ~OSDMessageQueue();
49 
50  void registerEventSource();
51 
52  enum {
53  kMinimumDelay = 1000
54  };
55 
59  void addMessage(const Common::U32String &msg);
60 
70  bool pollEvent(Common::Event &event) override;
71 
72 private:
73  Mutex _mutex;
74  Queue<U32String> _messages;
75  uint32 _lastUpdate;
76 };
77 
80 } // End of namespace Common
81 
82 #endif
Definition: queue.h:42
bool pollEvent(Common::Event &event) override
Definition: osd_message_queue.h:45
Definition: ustr.h:57
Definition: events.h:199
Definition: algorithm.h:29
Definition: mutex.h:67
void addMessage(const Common::U32String &msg)
Definition: events.h:259
Definition: singleton.h:42