Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/notifications/dispatchers/CommandNotification.h @ 7210

Last change on this file since 7210 was 7210, checked in by dafrick, 14 years ago

Created new NotificationDispatcher. It just displays, upon being triggered, some predefined Notification message.

File size: 3.9 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
31    @brief Definition of the CommandNotification class.
32*/
33
34#ifndef _CommandNotification_H__
35#define _CommandNotification_H__
36
37#include "notifications/NotificationsPrereqs.h"
38
39#include "notifications/NotificationDispatcher.h"
40#include <string>
41
42namespace orxonox {
43
44    /**
45    @brief
46        This class implements a method of displaying a Notification with information to an input command and the key the command is mapped to.
47        The message that is displayed is a string made out uf the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
48    @author
49        Damian 'Mozork' Frick
50    */
51    class _NotificationsExport CommandNotification : public NotificationDispatcher
52    {
53
54        public:
55            CommandNotification(BaseObject* creator); //!< Default Constructor.
56            virtual ~CommandNotification(); //!< Destructor.
57
58            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CommandNotification object through XML.
59
60            /**
61            @brief Get the command, whose key is displayed.
62            @return Returns the name of the command.
63            */
64            const std::string& getCommand(void)
65                { return this->command_; }
66            /**
67            @brief Get the preMessage, the first part of the displayed message.
68            @return Returns the preMessage.
69            */
70            const std::string& getPreMessage(void)
71                { return this->preMessage_; }
72            /**
73            @brief Get the postMessage, the last part of the displayed message.
74            @return Returns the postMessage.
75            */
76            const std::string& getPostMessage(void)
77                { return this->postMessage_; }
78
79        protected:
80            virtual const std::string& createNotificationMessage(void); //!< Composes the Notification of the preMessage the name of the key the command is mapped to and the postMessage.
81
82        private:
83            std::string command_; //!< The name of the command.
84            std::string preMessage_; //!< The first part of the displayed message.
85            std::string postMessage_; //!< The last part of the displayed message.
86
87            /**
88            @brief Set the command, whose key is displayed.
89            @param command The name of the command.
90            */
91            void setCommand(const std::string& command)
92                { this->command_ = command; }
93            /**
94            @brief Set the preMessage, the first part of the displayed message.
95            @param message The preMessage.
96            */
97            void setPreMessage(const std::string& message)
98                { this->preMessage_ = message; }
99            /**
100            @brief Set the postMessage, the last part of the displayed message.
101            @param message The postMessage.
102            */
103            void setPostMessage(const std::string& message)
104                 { this->postMessage_ = message; }
105
106    };
107
108}
109
110#endif // _CommandNotification_H__
Note: See TracBrowser for help on using the repository browser.