Module tray

Available on crate feature dep_sdl3 only.
Expand description

SDL offers a way to add items to the “system tray” (more correctly called the “notification area” on Windows). On platforms that offer this concept, an SDL app can add a tray icon, submenus, checkboxes, and clickable entries, and register a callback that is fired when the user clicks on these pieces.

Structs§

SDL_Tray
An opaque handle representing a toplevel system tray object.
SDL_TrayEntry
An opaque handle representing an entry on a system tray object.
SDL_TrayMenu
An opaque handle representing a menu/submenu on a system tray object.

Constants§

SDL_TRAYENTRY_BUTTON
Make the entry a simple button. Required.
SDL_TRAYENTRY_CHECKBOX
Make the entry a checkbox. Required.
SDL_TRAYENTRY_CHECKED
Make the entry checked. This is valid only for checkboxes. Optional.
SDL_TRAYENTRY_DISABLED
Make the entry disabled. Optional.
SDL_TRAYENTRY_SUBMENU
Prepare the entry to have a submenu. Required

Functions§

SDL_ClickTrayEntry
Simulate a click on a tray entry.
SDL_CreateTray
Create an icon to be placed in the operating system’s tray, or equivalent.
SDL_CreateTrayMenu
Create a menu for a system tray.
SDL_CreateTraySubmenu
Create a submenu for a system tray entry.
SDL_DestroyTray
Destroys a tray object.
SDL_GetTrayEntries
Returns a list of entries in the menu, in order.
SDL_GetTrayEntryChecked
Gets whether or not an entry is checked.
SDL_GetTrayEntryEnabled
Gets whether or not an entry is enabled.
SDL_GetTrayEntryLabel
Gets the label of an entry.
SDL_GetTrayEntryParent
Gets the menu containing a certain tray entry.
SDL_GetTrayMenu
Gets a previously created tray menu.
SDL_GetTrayMenuParentEntry
Gets the entry for which the menu is a submenu, if the current menu is a submenu.
SDL_GetTrayMenuParentTray
Gets the tray for which this menu is the first-level menu, if the current menu isn’t a submenu.
SDL_GetTraySubmenu
Gets a previously created tray entry submenu.
SDL_InsertTrayEntryAt
Insert a tray entry at a given position.
SDL_RemoveTrayEntry
Removes a tray entry.
SDL_SetTrayEntryCallback
Sets a callback to be invoked when the entry is selected.
SDL_SetTrayEntryChecked
Sets whether or not an entry is checked.
SDL_SetTrayEntryEnabled
Sets whether or not an entry is enabled.
SDL_SetTrayEntryLabel
Sets the label of an entry.
SDL_SetTrayIcon
Updates the system tray icon’s icon.
SDL_SetTrayTooltip
Updates the system tray icon’s tooltip.
SDL_UpdateTrays
Update the trays.

Type Aliases§

SDL_TrayCallback
A callback that is invoked when a tray entry is selected.
SDL_TrayEntryFlags
Flags that control the creation of system tray entries.