xoreos  0.0.5
notifications.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 #include "src/events/notifyable.h"
27 
29 
30 namespace Events {
31 
33 }
34 
36 }
37 
39 }
40 
41 std::list<Notifyable *>::iterator NotificationManager::registerNotifyable(Notifyable &notifyable) {
43 
44  _notifyables.push_back(&notifyable);
45 
46  return --_notifyables.end();
47 }
48 
49 void NotificationManager::unregisterNotifyable(const std::list<Notifyable *>::iterator &it) {
51 
52  _notifyables.erase(it);
53 }
54 
55 void NotificationManager::resized(int oldWidth, int oldHeight, int newWidth, int newHeight) {
57 
58  for (std::list<Notifyable *>::iterator it = _notifyables.begin(); it != _notifyables.end(); ++it)
59  (*it)->notifyResized(oldWidth, oldHeight, newWidth, newHeight);
60 }
61 
64 
65  for (std::list<Notifyable *>::iterator it = _notifyables.begin(); it != _notifyables.end(); ++it)
66  (*it)->notifyCameraMoved();
67 }
68 
69 } // End of namespace Events
void unregisterNotifyable(const std::list< Notifyable *>::iterator &it)
void cameraMoved()
Notify all Notifyables that the camera moved.
std::list< Notifyable * >::iterator registerNotifyable(Notifyable &notifyable)
std::list< Notifyable * > _notifyables
Definition: notifications.h:64
void resized(int oldWidth, int oldHeight, int newWidth, int newHeight)
Notify all Notifyables that the screen size changed.
The notification manager, handling all notifications.
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
Definition: singleton.h:122
The notification manager, handling all notifications.
Definition: notifications.h:49
A class that can be notified by the NotificationManager.
Convenience class that locks a mutex on creation and unlocks it on destruction.
Definition: mutex.h:71