sdlCreateTray function
Create an icon to be placed in the operating system's tray, or equivalent.
Many platforms advise not using a system tray unless persistence is a necessary feature. Avoid needlessly creating a tray icon, as the user may feel like it clutters their interface.
Using tray icons require the video subsystem.
\param icon a surface to be used as icon. May be NULL. \param tooltip a tooltip to be displayed when the mouse hovers the icon. Not supported on all platforms. May be NULL. \returns The newly created system tray icon.
\since This function is available since SDL 3.2.0.
\sa SDL_CreateTrayMenu \sa SDL_GetTrayMenu \sa SDL_DestroyTray
extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
Implementation
Pointer<SdlTray> sdlCreateTray(Pointer<SdlSurface> icon, String? tooltip) {
final sdlCreateTrayLookupFunction = libSdl3.lookupFunction<
Pointer<SdlTray> Function(
Pointer<SdlSurface> icon, Pointer<Utf8> tooltip),
Pointer<SdlTray> Function(
Pointer<SdlSurface> icon, Pointer<Utf8> tooltip)>('SDL_CreateTray');
final tooltipPointer = tooltip != null ? tooltip.toNativeUtf8() : nullptr;
final result = sdlCreateTrayLookupFunction(icon, tooltipPointer);
calloc.free(tooltipPointer);
return result;
}