|
SDL 3.0
|
#include <SDL3/SDL_properties.h>#include <SDL3/SDL_stdinc.h>#include <SDL3/SDL_surface.h>#include <SDL3/SDL_begin_code.h>#include <SDL3/SDL_close_code.h>Go to the source code of this file.
Data Structures | |
| union | SDL_NotificationAction |
Macros | |
| #define | SDL_PROP_GLOBAL_NOTIFICATION_HEADER_ICON_STRING "SDL.notification.header_icon" |
| #define | SDL_PROP_NOTIFICATION_ACTIONS_POINTER "SDL.notification.actions" |
| #define | SDL_PROP_NOTIFICATION_ACTION_COUNT_NUMBER "SDL.notification.action_count" |
| #define | SDL_PROP_NOTIFICATION_IMAGE_POINTER "SDL.notification.image" |
| #define | SDL_PROP_NOTIFICATION_MESSAGE_STRING "SDL.notification.message" |
| #define | SDL_PROP_NOTIFICATION_PRIORITY_NUMBER "SDL.notification.priority" |
| #define | SDL_PROP_NOTIFICATION_REPLACES_NUMBER "SDL.notification.replaces" |
| #define | SDL_PROP_NOTIFICATION_SOUND_STRING "SDL.notification.sound" |
| #define | SDL_PROP_NOTIFICATION_TRANSIENT_BOOLEAN "SDL.notification.transient" |
| #define | SDL_PROP_NOTIFICATION_TITLE_STRING "SDL.notification.title" |
Typedefs | |
| typedef Uint32 | SDL_NotificationID |
Enumerations | |
| enum | SDL_NotificationPriority { SDL_NOTIFICATION_PRIORITY_LOW = -1 , SDL_NOTIFICATION_PRIORITY_NORMAL = 0 , SDL_NOTIFICATION_PRIORITY_HIGH = 1 , SDL_NOTIFICATION_PRIORITY_CRITICAL = 2 } |
| enum | SDL_NotificationActionType { SDL_NOTIFICATION_ACTION_TYPE_BUTTON = 1 } |
Functions | |
| bool | SDL_RequestNotificationPermission (void) |
| SDL_NotificationID | SDL_ShowNotificationWithProperties (SDL_PropertiesID props) |
| SDL_NotificationID | SDL_ShowNotification (const char *title, const char *message, SDL_Surface *image, SDL_NotificationAction *actions, int num_actions) |
| bool | SDL_RemoveNotification (SDL_NotificationID notification) |
| #define SDL_PROP_GLOBAL_NOTIFICATION_HEADER_ICON_STRING "SDL.notification.header_icon" |
Notifications are temporary popup dialogs that passively present information to the user, or prompt user action. They are managed and presented by the system, and can present simple options for user feedback, usually in the form of buttons.
The capabilities of notifications, and how they are displayed, vary between systems, but they generally allow for a title, message body, an associated image, and buttons to allow the user to provide feedback.
How notifications are presented and handled are subject to system policy, and it should not be assumed that showing a notification means that the user will see it immediately, if at all. The user may disable notifications for certain applications, they may be suppressed based on the current activity, and most systems provide a "do not disturb" mode that universally silences notifications when activated.
There is both a customizable function SDL_ShowNotificationWithProperties() that offers many options for what is displayed, and also a much-simplified version SDL_ShowSimpleNotification(), which simply takes a header (required), body (optional), and image (optional). The path to an image to be used as the header icon for system notifications on some platforms.
This is required on: - Windows - *nix when not running in a container, and no .desktop entry is available
Image types supported depend on the platform, but .png generally offers the best compatability.
On *nix platforms, this can also be the name of a system icon, as specified by the Icon Naming Specification.
Can be set before calling SDL_ShowNotification() or SDL_ShowSimpleNotification() for the first time.
Definition at line 80 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_ACTION_COUNT_NUMBER "SDL.notification.action_count" |
Definition at line 127 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_ACTIONS_POINTER "SDL.notification.actions" |
Definition at line 126 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_IMAGE_POINTER "SDL.notification.image" |
Definition at line 128 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_MESSAGE_STRING "SDL.notification.message" |
Definition at line 129 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_PRIORITY_NUMBER "SDL.notification.priority" |
Definition at line 130 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_REPLACES_NUMBER "SDL.notification.replaces" |
Definition at line 131 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_SOUND_STRING "SDL.notification.sound" |
Definition at line 132 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_TITLE_STRING "SDL.notification.title" |
Definition at line 134 of file SDL_notification.h.
| #define SDL_PROP_NOTIFICATION_TRANSIENT_BOOLEAN "SDL.notification.transient" |
Definition at line 133 of file SDL_notification.h.
| typedef Uint32 SDL_NotificationID |
The identifier for a system notification.
Definition at line 82 of file SDL_notification.h.
| Enumerator | |
|---|---|
| SDL_NOTIFICATION_ACTION_TYPE_BUTTON | Adds a button to the notification that generates feedback when activated. |
Definition at line 92 of file SDL_notification.h.
Definition at line 84 of file SDL_notification.h.
|
extern |
Remove a notification.
| notification | the ID of the notification to remove. |
|
extern |
Requests permission from the system to display notifications.
A return value of true only means that the system supports notifications, and that the request for permission was successfully issued. It does not reflect any user settings to allow or deny notifications.
|
extern |
Show a system notification with normal priority.
| title | UTF-8 title text, required. |
| message | UTF-8 message text, may be NULL. |
| image | The image associated with this notification, may be NULL. |
| actions | An array of actions to attach to the notification, may be NULL. |
| num_actions | The number of actions in the actions array. |
|
extern |
Show a system notification.
System notifications are small, asynchronous popup windows that notify the user of some information. How they are displayed is system dependent.
These are the supported properties:
Not all properties are supported by all platforms.
Notifications are available on: - Windows 10 or higher - macOS 10.14 or higher - iOS 11 or higher - *nix platforms that support the org.freedesktop.Notifications, or org.freedesktop.portal.Notification interfaces
| props | the properties to be used when creating this notification. |