Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/src/orxonox/overlays/notifications/Notification.cc @ 2871

Last change on this file since 2871 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.6 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 thes
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#include "OrxonoxStableHeaders.h"
30#include "Notification.h"
31
32#include "core/CoreIncludes.h"
33
34#include "NotificationManager.h"
35
36namespace orxonox
37{
38    Notification::Notification(BaseObject* creator) : BaseObject(creator)
39    {
40        RegisterObject(Notification);
41    }
42   
43    Notification::Notification(BaseObject* creator, const std::string & message, const std::string & title, float time) : BaseObject(creator)
44    {
45        this->title_ = title;
46        this->message_ = message;
47        if(time > 0)
48            this->displayTime_ = time;
49    }
50   
51    Notification::~Notification()
52    {
53    }
54   
55    void Notification::initialize(void)
56    {
57        RegisterObject(Notification);
58       
59        this->title_ = "";
60        this->message_ = "";
61        this->displayTime_ = NOTIFICATION_DISPLAY_TIME;
62        this->sent_ = false;
63    }
64   
65    bool Notification::send(void)
66    {
67        bool successful = NotificationManager::insertNotification(this);
68        if(successful)
69            this->sent_ = true;
70        return successful;
71    }
72   
73    bool Notification::setTitle(const std::string & title)
74    {
75        if(this->isSent())
76            return false;
77        this->title_ = title;
78        return true;
79    }
80   
81    bool Notification::setMessage(const std::string & message)
82    {
83        if(this->isSent())
84            return false;
85        this->message_ = message;
86        return true;
87    }
88   
89    bool Notification::setDisplayTime(float time)
90    {
91        if(this->isSent())
92        {
93            return false;
94        }
95        if(time > 0)
96        {
97            this->displayTime_ = time;
98            return true;
99        }
100        return false;
101    }
102}
Note: See TracBrowser for help on using the repository browser.