sdl.tray

SDL Tray

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.

Members

Aliases

SDL_TrayCallback
alias SDL_TrayCallback = void function(void* userdata, SDL_TrayEntry* entry)

A callback that is invoked when a tray entry is selected.

SDL_TrayEntryFlags
alias SDL_TrayEntryFlags = Uint32

Flags that control the creation of system tray entries.

Functions

SDL_ClickTrayEntry
void SDL_ClickTrayEntry(SDL_TrayEntry* entry)

Simulate a click on a tray entry.

SDL_CreateTray
SDL_Tray* SDL_CreateTray(SDL_Surface* icon, const(char)* tooltip)

Create an icon to be placed in the operating system's tray, or equivalent.

SDL_CreateTrayMenu
SDL_TrayMenu* SDL_CreateTrayMenu(SDL_Tray* tray)

Create a menu for a system tray.

SDL_CreateTraySubmenu
SDL_TrayMenu* SDL_CreateTraySubmenu(SDL_TrayEntry* entry)

Create a submenu for a system tray entry.

SDL_DestroyTray
void SDL_DestroyTray(SDL_Tray* tray)

Destroys a tray object.

SDL_GetTrayEntries
const(SDL_TrayEntry)** SDL_GetTrayEntries(SDL_TrayMenu* menu, int* count)

Returns a list of entries in the menu, in order.

SDL_GetTrayEntryChecked
bool SDL_GetTrayEntryChecked(SDL_TrayEntry* entry)

Gets whether or not an entry is checked.

SDL_GetTrayEntryEnabled
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry* entry)

Gets whether or not an entry is enabled.

SDL_GetTrayEntryLabel
const(char)* SDL_GetTrayEntryLabel(SDL_TrayEntry* entry)

Gets the label of an entry.

SDL_GetTrayEntryParent
SDL_TrayMenu* SDL_GetTrayEntryParent(SDL_TrayEntry* entry)

Gets the menu containing a certain tray entry.

SDL_GetTrayMenu
SDL_TrayMenu* SDL_GetTrayMenu(SDL_Tray* tray)

Gets a previously created tray menu.

SDL_GetTrayMenuParentEntry
SDL_TrayEntry* SDL_GetTrayMenuParentEntry(SDL_TrayMenu* menu)

Gets the entry for which the menu is a submenu, if the current menu is a submenu.

SDL_GetTrayMenuParentTray
SDL_Tray* SDL_GetTrayMenuParentTray(SDL_TrayMenu* menu)

Gets the tray for which this menu is the first-level menu, if the current menu isn't a submenu.

SDL_GetTraySubmenu
SDL_TrayMenu* SDL_GetTraySubmenu(SDL_TrayEntry* entry)

Gets a previously created tray entry submenu.

SDL_InsertTrayEntryAt
SDL_TrayEntry* SDL_InsertTrayEntryAt(SDL_TrayMenu* menu, int pos, const(char)* label, SDL_TrayEntryFlags flags)

Insert a tray entry at a given position.

SDL_RemoveTrayEntry
void SDL_RemoveTrayEntry(SDL_TrayEntry* entry)

Removes a tray entry.

SDL_SetTrayEntryCallback
void SDL_SetTrayEntryCallback(SDL_TrayEntry* entry, SDL_TrayCallback callback, void* userdata)

Sets a callback to be invoked when the entry is selected.

SDL_SetTrayEntryChecked
void SDL_SetTrayEntryChecked(SDL_TrayEntry* entry, bool checked)

Sets whether or not an entry is checked.

SDL_SetTrayEntryEnabled
void SDL_SetTrayEntryEnabled(SDL_TrayEntry* entry, bool enabled)

Sets whether or not an entry is enabled.

SDL_SetTrayEntryLabel
void SDL_SetTrayEntryLabel(SDL_TrayEntry* entry, const(char)* label)

Sets the label of an entry.

SDL_SetTrayIcon
void SDL_SetTrayIcon(SDL_Tray* tray, SDL_Surface* icon)

Updates the system tray icon's icon.

SDL_SetTrayTooltip
void SDL_SetTrayTooltip(SDL_Tray* tray, const(char)* tooltip)

Updates the system tray icon's tooltip.

SDL_UpdateTrays
void SDL_UpdateTrays()

Update the trays.

Manifest constants

SDL_TRAYENTRY_BUTTON
enum SDL_TRAYENTRY_BUTTON;

Make the entry a simple button. Required.

SDL_TRAYENTRY_CHECKBOX
enum SDL_TRAYENTRY_CHECKBOX;

Make the entry a checkbox. Required.

SDL_TRAYENTRY_CHECKED
enum SDL_TRAYENTRY_CHECKED;

Make the entry checked. This is valid only for checkboxes. Optional.

SDL_TRAYENTRY_DISABLED
enum SDL_TRAYENTRY_DISABLED;

Make the entry disabled. Optional.

SDL_TRAYENTRY_SUBMENU
enum SDL_TRAYENTRY_SUBMENU;

Prepare the entry to have a submenu. Required

Structs

SDL_Tray
struct SDL_Tray

An opaque handle representing a toplevel system tray object.

SDL_TrayEntry
struct SDL_TrayEntry

An opaque handle representing an entry on a system tray object.

SDL_TrayMenu
struct SDL_TrayMenu

An opaque handle representing a menu/submenu on a system tray object.

See Also

Meta

License

Subject to the terms of the Zlib License, as written in the LICENSE file.

Authors

Luna Nielsen