The Battle for Wesnoth  1.19.25+dev
windows_tray_notification.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2025
3  by Maxim Biro <nurupo.contributions@gmail.com>
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 // Win32 API forward declaration (full definition in WinUser.h)
21 typedef struct tagMSG MSG;
22 
24 {
25  /**
26  * Displays a tray notification.
27  * When user clicks on the notification popup, the user switches to the wesnoth window.
28  *
29  * @param title Title of a notification. Gets truncated if longer than 64 characters, including
30  * the terminating null character.
31  * @param message Message of a notification. Gets truncated if longer than 256 characters, including
32  * the terminating null character.
33  *
34  * @return True if message was shown successfully, False otherwise.
35  */
36  bool show(std::string title, std::string message);
37 
38  /**
39  * Frees resources when a notification disappears, switches user to the wesnoth
40  * window if the notification popup was clicked by user.
41  *
42  * @param msg Windows message payload.
43  *
44  * @return True if the message was handled.
45  */
46  bool message_hook(const MSG& msg);
47 };
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:109
bool show(std::string title, std::string message)
Displays a tray notification.
bool message_hook(const MSG &msg)
Frees resources when a notification disappears, switches user to the wesnoth window if the notificati...
struct tagMSG MSG