Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h @ 8378

Last change on this file since 8378 was 8378, checked in by dafrick, 13 years ago

Notification text alignment can be set per queue.

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file NotificationListener.h
31    @brief Definition of the NotificationListener class.
32    @ingroup Notifications
33*/
34
35#ifndef _NotificationListener_H__
36#define _NotificationListener_H__
37
38#include "OrxonoxPrereqs.h"
39
40#include <ctime>
41#include <set>
42#include <string>
43
44#include "util/StringUtils.h"
45
46#include "core/OrxonoxClass.h"
47
48namespace orxonox
49{
50   
51    namespace notificationMessageMode
52    {
53        enum Value {
54            message,
55            command
56        };
57    }
58   
59    namespace notificationSendMode
60    {
61        enum Value {
62            local,
63            network,
64            broadcast
65        };
66    }
67
68    // TODO: Update doc.
69    /**
70    @brief
71        NotificationListener interface.
72
73        The NotificationListener interface presents a means to being informed when @ref orxonox::Notification "Notifications" in the target set of this NotificationListener change. (e.g. @ref orxonox::Notification "Notifications" were added or removed)
74        When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager".
75
76    @author
77        Damian 'Mozork' Frick
78       
79    @ingroup Notifications
80    */
81    class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
82    {
83        public:
84            NotificationListener();
85            virtual ~NotificationListener() {}
86           
87            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
88            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
89           
90            static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageMode::Value messageMode = notificationMessageMode::message, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0);
91            static void sendNotificationHelper(const std::string& message, const std::string& sender, unsigned int messageMode);
92           
93            virtual bool registerNotification(const std::string& message, const std::string& sender) { return false; }
94            virtual void executeCommand(const std::string& command, const std::string& sender) {}
95    };
96}
97
98#endif /* _NotificationListener_H__ */
Note: See TracBrowser for help on using the repository browser.