#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, 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 size_t | MAX_TITLE_LENGTH = 63 |
static const size_t | MAX_MESSAGE_LENGTH = 255 |
Definition at line 41 of file windows_tray_notification.hpp.
|
explicitprivate |
|
private |
|
staticprivate |
Definition at line 160 of file windows_tray_notification.cpp.
References utils::ellipsis_truncate(), MAX_MESSAGE_LENGTH, and MAX_TITLE_LENGTH.
Referenced by show().
|
staticprivate |
Definition at line 72 of file windows_tray_notification.cpp.
References _(), get_window_handle(), ICON_ID, MAX_TITLE_LENGTH, nid, NIIF_USER, string_to_wstring(), and WM_TRAYNOTIFY.
Referenced by show().
|
staticprivate |
Definition at line 28 of file windows_tray_notification.cpp.
References message_reset, and nid.
Referenced by handle_system_event(), and show().
|
staticprivate |
Definition at line 173 of file windows_tray_notification.cpp.
References CVideo::get_singleton(), and CVideo::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 43 of file windows_tray_notification.cpp.
References destroy_tray_icon(), message_reset, NIN_BALLOONTIMEOUT, NIN_BALLOONUSERCLICK, switch_to_wesnoth_window(), and WM_TRAYNOTIFY.
Referenced by events::pump().
|
private |
|
staticprivate |
Definition at line 147 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 211 of file windows_tray_notification.cpp.
References adjust_length(), create_tray_icon(), destroy_tray_icon(), nid, and set_tray_message().
|
staticprivate |
Definition at line 199 of file windows_tray_notification.cpp.
References unicode_cast().
Referenced by create_tray_icon(), and set_tray_message().
|
staticprivate |
Definition at line 186 of file windows_tray_notification.cpp.
References get_window_handle().
Referenced by handle_system_event().
|
staticprivate |
Definition at line 67 of file windows_tray_notification.hpp.
Referenced by create_tray_icon().
|
staticprivate |
Definition at line 70 of file windows_tray_notification.hpp.
Referenced by adjust_length(), and set_tray_message().
|
staticprivate |
Definition at line 69 of file windows_tray_notification.hpp.
Referenced by adjust_length(), create_tray_icon(), and set_tray_message().
|
staticprivate |
Definition at line 66 of file windows_tray_notification.hpp.
Referenced by destroy_tray_icon(), handle_system_event(), and set_tray_message().
|
staticprivate |
Definition at line 65 of file windows_tray_notification.hpp.
Referenced by create_tray_icon(), destroy_tray_icon(), set_tray_message(), and show().
|
staticprivate |
Definition at line 68 of file windows_tray_notification.hpp.
Referenced by create_tray_icon(), and handle_system_event().