diff --git a/include/SDL3/SDL_notification.h b/include/SDL3/SDL_notification.h new file mode 100644 index 00000000000000..03c221a35a2350 --- /dev/null +++ b/include/SDL3/SDL_notification.h @@ -0,0 +1,97 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2023 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_notification.h + * + * \brief Header file for notification API + */ + +#ifndef SDL_notification_h_ +#define SDL_notification_h_ + +#include + +#include +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief SDL_Notification flags. + */ +typedef enum +{ + SDL_NOTIFICATION_PRIORITY_LOW = 0x00000010, /**< lowest */ + SDL_NOTIFICATION_PRIORITY_NORMAL = 0x00000020, /**< normal/medium */ + SDL_NOTIFICATION_PRIORITY_HIGH = 0x00000040 /**< high/important/critical */ +} SDL_NotificationFlags; + +/** + * \brief SDL_Icon flags. + */ +typedef enum +{ + SDL_ICON_TYPE_SINGLE_FILE = 0x00000010, /**< A single icon file. */ + SDL_ICON_TYPE_ICON_DIRECTORY = 0x00000020, /**< A directory containing icons in "heightxwidth.bmp" format. */ + SDL_ICON_TYPE_SURFACE = 0x00000040 /**< Icon inside an SDL surface. */ +} SDL_IconFlags; + +typedef struct +{ + Uint32 flags; + union { + const char *path; + SDL_Surface *surface; + } icon; +} SDL_Icon; + +/** + * \brief Create a simple system notification. + * + * If a window is specified it's icon will be used for the notification, + * and the notifcation will open that window when clicked on supported + * platforms. Alternatively if an icon is specified for the icon this will, + * be used instead. + * + * \param flags Notification/Priority Flags + * \param title UTF-8 title text + * \param message UTF-8 message text + * \param window Window to associate to the notfication. + * \param icon Icon (if different to window icon). + * + * \return 0 on success, -1 on error + * + * \sa SDL_ShowSimpleNotification + */ +extern DECLSPEC int SDLCALL SDL_ShowSimpleNotification(Uint32 flags, const char *title, const char *message, + SDL_Window *window, SDL_Icon *icon); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include + + +#endif /* SDL_notification_h_ */ +