SDL_CreateTrayMenu(3)

πŸ’– SDL_CreateTrayMenu πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages β€” this one's SDL_CreateTrayMenu(3) and it's lowkey the moment your system tray icon gets a whole menu to call its own. 🌸


✨ NAME ✨

SDL_CreateTrayMenu β€” Create a menu for a system tray. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_tray.h>

SDL_TrayMenu * SDL_CreateTrayMenu(SDL_Tray *tray);

πŸ’… DESCRIPTION πŸ’…

so here's the tea: this should be called at most once per tray icon. that's it, that's the rule. one menu per icon, don't be greedy. πŸ™ˆ

This function does the same thing as SDL_CreateTraySubmenu(), except that it takes a SDL_Tray instead of a SDL_TrayEntry. same energy, different parameter, iykyk. ✨

And the best part?? A menu does not need to be destroyed β€” it will be destroyed with the tray. no cleanup era required, it's giving self-sufficient queen behavior. πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • tray β€” the tray to bind the menu to. that's your girl, the tray icon getting the glow-up. πŸ’–

⭐ RETURN VALUE ⭐

Returns the newly created menu. fresh out the oven, still warm. πŸ”₯


🧚 THREAD SAFETY 🧚

This function should be called on the thread that created the tray. fr fr, don't be out here calling it from some random thread β€” stay loyal to the one that birthed the tray. 😭


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on anything older, it's not you, it's the version. πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, bestie, they're all part of the same friend group. 🫢


and that's the whole page!! brought to you by the fine folks at Simple Directmedia Layer, version SDL 3.4.18 β€” slay, iconic, no cap. πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from