|
| 1 | +/* |
| 2 | + Simple DirectMedia Layer |
| 3 | + Copyright (C) 1997-2023 Sam Lantinga <[email protected]> |
| 4 | +
|
| 5 | + This software is provided 'as-is', without any express or implied |
| 6 | + warranty. In no event will the authors be held liable for any damages |
| 7 | + arising from the use of this software. |
| 8 | +
|
| 9 | + Permission is granted to anyone to use this software for any purpose, |
| 10 | + including commercial applications, and to alter it and redistribute it |
| 11 | + freely, subject to the following restrictions: |
| 12 | +
|
| 13 | + 1. The origin of this software must not be misrepresented; you must not |
| 14 | + claim that you wrote the original software. If you use this software |
| 15 | + in a product, an acknowledgment in the product documentation would be |
| 16 | + appreciated but is not required. |
| 17 | + 2. Altered source versions must be plainly marked as such, and must not be |
| 18 | + misrepresented as being the original software. |
| 19 | + 3. This notice may not be removed or altered from any source distribution. |
| 20 | +*/ |
| 21 | + |
| 22 | +/** |
| 23 | + * \file SDL_notification.h |
| 24 | + * |
| 25 | + * \brief Header file for notification API |
| 26 | + */ |
| 27 | + |
| 28 | +#ifndef SDL_notification_h_ |
| 29 | +#define SDL_notification_h_ |
| 30 | + |
| 31 | +#include <SDL3/SDL_stdinc.h> |
| 32 | + |
| 33 | +#include <SDL3/SDL_begin_code.h> |
| 34 | +/* Set up for C function definitions, even when using C++ */ |
| 35 | +#ifdef __cplusplus |
| 36 | +extern "C" { |
| 37 | +#endif |
| 38 | + |
| 39 | +/** |
| 40 | + * \brief SDL_Notification flags. |
| 41 | + */ |
| 42 | +typedef enum |
| 43 | +{ |
| 44 | + SDL_NOTIFICATION_PRIORITY_LOW = 0x00000010, /**< lowest */ |
| 45 | + SDL_NOTIFICATION_PRIORITY_NORMAL = 0x00000020, /**< normal/medium */ |
| 46 | + SDL_NOTIFICATION_PRIORITY_HIGH = 0x00000040 /**< high/important/critical */ |
| 47 | +} SDL_NotificationFlags; |
| 48 | + |
| 49 | +/** |
| 50 | + * \brief SDL_Icon flags. |
| 51 | + */ |
| 52 | +typedef enum |
| 53 | +{ |
| 54 | + SDL_ICON_TYPE_SINGLE_FILE = 0x00000010, /**< A single icon file. */ |
| 55 | + SDL_ICON_TYPE_ICON_DIRECTORY = 0x00000020, /**< A directory containing icons in "heightxwidth.bmp" format. */ |
| 56 | + SDL_ICON_TYPE_SURFACE = 0x00000040 /**< Icon inside an SDL surface. */ |
| 57 | +} SDL_IconFlags; |
| 58 | + |
| 59 | +typedef struct |
| 60 | +{ |
| 61 | + Uint32 flags; |
| 62 | + union { |
| 63 | + const char *path; |
| 64 | + SDL_Surface *surface; |
| 65 | + } icon; |
| 66 | +} SDL_Icon; |
| 67 | + |
| 68 | +/** |
| 69 | + * \brief Create a simple system notification. |
| 70 | + * |
| 71 | + * If a window is specified it's icon will be used for the notification, |
| 72 | + * and the notifcation will open that window when clicked on supported |
| 73 | + * platforms. Alternatively if an icon is specified for the icon this will, |
| 74 | + * be used instead. |
| 75 | + * |
| 76 | + * \param flags Notification/Priority Flags |
| 77 | + * \param title UTF-8 title text |
| 78 | + * \param message UTF-8 message text |
| 79 | + * \param window Window to associate to the notfication. |
| 80 | + * \param icon Icon (if different to window icon). |
| 81 | + * |
| 82 | + * \return 0 on success, -1 on error |
| 83 | + * |
| 84 | + * \sa SDL_ShowSimpleNotification |
| 85 | + */ |
| 86 | +extern DECLSPEC int SDLCALL SDL_ShowSimpleNotification(Uint32 flags, const char *title, const char *message, |
| 87 | + SDL_Window *window, SDL_Icon *icon); |
| 88 | + |
| 89 | +/* Ends C function definitions when using C++ */ |
| 90 | +#ifdef __cplusplus |
| 91 | +} |
| 92 | +#endif |
| 93 | +#include <SDL3/SDL_close_code.h> |
| 94 | + |
| 95 | + |
| 96 | +#endif /* SDL_notification_h_ */ |
| 97 | + |
0 commit comments