#include <windows_tray_notification.hpp>
Static Public Member Functions | |
static bool | show (std::string title, std::string message) |
Displays a tray notification. More... | |
static void | handle_system_event (const SDL_Event &event) |
Frees resources when a notification disappears, switches user to the wesnoth window if the notification popup was clicked by user. More... | |
Private Member Functions | |
windows_tray_notification () | |
windows_tray_notification (const windows_tray_notification &w) | |
windows_tray_notification & | operator= (const windows_tray_notification &w) |
Static Private Member Functions | |
static bool | create_tray_icon () |
static void | destroy_tray_icon () |
static bool | set_tray_message (const std::string &title, const std::string &message) |
static void | adjust_length (std::string &title, std::string &message) |
static HWND | get_window_handle () |
static void | switch_to_wesnoth_window () |
static std::wstring | string_to_wstring (const std::string &string, std::size_t maxlength) |
Static Private Attributes | |
static NOTIFYICONDATA * | nid = nullptr |
static bool | message_reset = false |
static const int | ICON_ID = 1007 |
static const unsigned int | WM_TRAYNOTIFY = 32868 |
static const std::size_t | MAX_TITLE_LENGTH = 63 |
static const std::size_t | MAX_MESSAGE_LENGTH = 255 |
Definition at line 28 of file windows_tray_notification.hpp.
|
explicitprivate |
|
private |
|
staticprivate |
Definition at line 159 of file windows_tray_notification.cpp.
References utils::ellipsis_truncate(), MAX_MESSAGE_LENGTH, and MAX_TITLE_LENGTH.
Referenced by show().
|
staticprivate |
Definition at line 73 of file windows_tray_notification.cpp.
References _(), get_window_handle(), ICON_ID, MAX_TITLE_LENGTH, nid, string_to_wstring(), and WM_TRAYNOTIFY.
Referenced by show().
|
staticprivate |
Definition at line 29 of file windows_tray_notification.cpp.
References message_reset, and nid.
Referenced by handle_system_event(), and show().
|
staticprivate |
Definition at line 172 of file windows_tray_notification.cpp.
References video::get_window().
Referenced by create_tray_icon(), and switch_to_wesnoth_window().
|
static |
Frees resources when a notification disappears, switches user to the wesnoth window if the notification popup was clicked by user.
event | System event. |
Definition at line 44 of file windows_tray_notification.cpp.
References destroy_tray_icon(), message_reset, switch_to_wesnoth_window(), and WM_TRAYNOTIFY.
Referenced by events::pump().
|
private |
|
staticprivate |
Definition at line 146 of file windows_tray_notification.cpp.
References MAX_MESSAGE_LENGTH, MAX_TITLE_LENGTH, message_reset, nid, and string_to_wstring().
Referenced by show().
|
static |
Displays a tray notification.
When user clicks on the notification popup, the user switches to the wesnoth window.
title | Title of a notification. Gets truncated if longer than 64 characters, including the terminating null character. |
message | Message of a notification. Gets truncated if longer than 256 characters, including the terminating null character. |
Definition at line 210 of file windows_tray_notification.cpp.
References adjust_length(), create_tray_icon(), destroy_tray_icon(), nid, and set_tray_message().
|
staticprivate |
Definition at line 198 of file windows_tray_notification.cpp.
Referenced by create_tray_icon(), and set_tray_message().
|
staticprivate |
Definition at line 185 of file windows_tray_notification.cpp.
References get_window_handle().
Referenced by handle_system_event().
|
staticprivate |
Definition at line 54 of file windows_tray_notification.hpp.
Referenced by create_tray_icon().
|
staticprivate |
Definition at line 57 of file windows_tray_notification.hpp.
Referenced by adjust_length(), and set_tray_message().
|
staticprivate |
Definition at line 56 of file windows_tray_notification.hpp.
Referenced by adjust_length(), create_tray_icon(), and set_tray_message().
|
staticprivate |
Definition at line 53 of file windows_tray_notification.hpp.
Referenced by destroy_tray_icon(), handle_system_event(), and set_tray_message().
|
staticprivate |
Definition at line 52 of file windows_tray_notification.hpp.
Referenced by create_tray_icon(), destroy_tray_icon(), set_tray_message(), and show().
|
staticprivate |
Definition at line 55 of file windows_tray_notification.hpp.
Referenced by create_tray_icon(), and handle_system_event().