| [7210] | 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 | |
|---|
| [7456] | 29 | /** |
|---|
| 30 | @file SimpleNotification.h |
|---|
| 31 | @brief Declaration of the SimpleNotification class. |
|---|
| 32 | @ingroup NotificationDispatchers |
|---|
| 33 | */ |
|---|
| 34 | |
|---|
| [7210] | 35 | #ifndef _SimpleNotification_H__ |
|---|
| 36 | #define _SimpleNotification_H__ |
|---|
| 37 | |
|---|
| 38 | #include "notifications/NotificationsPrereqs.h" |
|---|
| 39 | |
|---|
| 40 | #include "notifications/NotificationDispatcher.h" |
|---|
| 41 | #include <string> |
|---|
| 42 | |
|---|
| 43 | namespace orxonox { |
|---|
| 44 | |
|---|
| 45 | /** |
|---|
| 46 | @brief |
|---|
| 47 | The SimpleNotification class enables the sending of (in XML) predefined Notifications upon some kind of triggering event. |
|---|
| [7484] | 48 | |
|---|
| 49 | In use it would like this: |
|---|
| 50 | @code |
|---|
| [7488] | 51 | <SimpleNotification message="some message..." sender="me"> |
|---|
| [7484] | 52 | <events> |
|---|
| 53 | <trigger> |
|---|
| 54 | <PlayerTrigger /> |
|---|
| 55 | </trigger> |
|---|
| 56 | </events> |
|---|
| 57 | </SimpleNotification> |
|---|
| 58 | @endcode |
|---|
| 59 | For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation. |
|---|
| [7552] | 60 | |
|---|
| [7210] | 61 | @author |
|---|
| 62 | Damian 'Mozork' Frick |
|---|
| [7552] | 63 | |
|---|
| 64 | @ingroup NotificationDispatchers |
|---|
| [7210] | 65 | */ |
|---|
| 66 | class _NotificationsExport SimpleNotification : public NotificationDispatcher |
|---|
| 67 | { |
|---|
| 68 | public: |
|---|
| [9667] | 69 | SimpleNotification(Context* context); //!< Default Constructor. |
|---|
| [7210] | 70 | virtual ~SimpleNotification(); //!< Destructor. |
|---|
| 71 | |
|---|
| 72 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleNotification object through XML. |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| 75 | @brief Get the message, that is displayed. |
|---|
| 76 | @return Returns the message, that is displayed. |
|---|
| 77 | */ |
|---|
| 78 | const std::string& getMessage(void) |
|---|
| 79 | { return this->message_; } |
|---|
| 80 | |
|---|
| 81 | protected: |
|---|
| 82 | /** |
|---|
| 83 | @brief Creates the notification message that should be sent upon the SimpleNotification triggering. |
|---|
| 84 | @return Returns the notification message. |
|---|
| 85 | */ |
|---|
| 86 | virtual const std::string& createNotificationMessage(void) |
|---|
| 87 | { return this->message_; } |
|---|
| 88 | |
|---|
| 89 | private: |
|---|
| 90 | std::string message_; //!< The message that is displayed. |
|---|
| 91 | |
|---|
| 92 | /** |
|---|
| 93 | @brief Sets the message that is to be displayed. |
|---|
| 94 | @param message The message to be displayed. |
|---|
| 95 | */ |
|---|
| 96 | void setMessage(const std::string& message) |
|---|
| 97 | { this->message_ = message; } |
|---|
| 98 | }; |
|---|
| 99 | |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | #endif // _SimpleNotification_H__ |
|---|