SDL Wiki
[ front page | index | search | recent changes | git repo | offline html ]

SDL_SetTrayMenuOpenCallback

Sets a callback to be invoked when the menu is opened or closed.

Header File

Defined in <SDL3/SDL_tray.h>

Syntax

bool SDL_SetTrayMenuOpenCallback(SDL_TrayMenu *menu, SDL_TrayMenuOpenCallback callback, void *userdata);

Function Parameters

SDL_TrayMenu * menu the menu to be updated.
SDL_TrayMenuOpenCallback callback a callback to be invoked when the menu is opened or closed.
void * userdata an optional pointer to pass extra data to the callback when it will be invoked.

Return Value

(bool) Returns true on success or false on failure; call SDL_GetError() for more information.

Remarks

The callback is invoked before the menu is displayed, so it can be used to update the menu contents, and again after the menu has closed. This works for both tray menus and submenus.

This is not supported on Linux, where the desktop environment doesn't reliably report when a menu is opened and closed.

Thread Safety

This function should be called on the thread that created the tray.

Version

This function is available since SDL 3.6.0.

See Also


CategoryAPI, CategoryAPIFunction, CategoryTray


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.