OpenCPN Partial API docs
Loading...
Searching...
No Matches
notification.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2025 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef _NOTIFICATION_H__
26#define _NOTIFICATION_H__
27
28#include <string>
29
30#include <wx/datetime.h>
31
32enum class NotificationSeverity : int {
33 kInformational = 0,
34 kWarning = 1,
35 kCritical = 2
36};
37
40public:
41 Notification(NotificationSeverity _severity, const std::string &_message,
42 int _timeout_secs = -1);
43 virtual ~Notification() = default;
44
45 std::string GetMessage() { return message; }
46 NotificationSeverity GetSeverity() const { return severity; }
47 time_t GetActivateTime() const { return activate_time; }
48 std::string GetGuid() const { return guid; }
49 size_t GetStringHash() const { return message_hash; }
50 int GetTimeoutCount() const { return auto_timeout_secs; }
51 void DecrementTimoutCount() { auto_timeout_secs--; }
52
53private:
54 NotificationSeverity severity;
55 const std::string message;
56 const time_t activate_time;
57 const std::string guid;
58 const size_t message_hash;
59 int auto_timeout_secs;
60};
61
62#endif
User visible notification.