The Battle for Wesnoth  1.19.5+dev
notifications.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2024
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include <string>
19 
20 namespace desktop {
21 
22 namespace notifications
23 {
25 
26 /**
27  * Displays a desktop notification @a message, from @a owner, of type @a t.
28  *
29  * If it is an appropriate time to send a desktop notification (i.e. the window
30  * does not have focus and the feature is not disabled by the preferences),
31  * and wesnoth was compiled with support for this feature, a notification will
32  * be issued. If there is no support for notifications, this fcn is a no-op.
33  *
34  * @note Currently we have support for dbus (linux), windows tray notifications,
35  * and NSUserNotification (Apple). To enable one of these, the corresponding compilation unit
36  * dbus_notification.cpp, apple_notification.cpp, windows_tray_notification.cpp,
37  * must be compiled, and the corresponding C++ symbol HAVE_LIBDBUS,
38  * _WIN32 must be defined for that compilation unit _and for this one_.
39  */
40  void send(const std::string& owner, const std::string& message, type t);
41 
42 /** Returns whether we were compiled with support for desktop notifications. */
43  bool available();
44 }
45 
46 }
double t
Definition: astarsearch.cpp:63
bool available()
Returns whether we were compiled with support for desktop notifications.
void send(const std::string &, const std::string &, type)
Displays a desktop notification message, from owner, of type t.