SDL_tray.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * # CategoryTray
  20. *
  21. * SDL offers a way to add items to the "system tray" (more correctly called
  22. * the "notification area" on Windows). On platforms that offer this concept,
  23. * an SDL app can add a tray icon, submenus, checkboxes, and clickable
  24. * entries, and register a callback that is fired when the user clicks on
  25. * these pieces.
  26. */
  27. #ifndef SDL_tray_h_
  28. #define SDL_tray_h_
  29. #include <SDL3/SDL_stdinc.h>
  30. #include <SDL3/SDL_error.h>
  31. #include <SDL3/SDL_properties.h>
  32. #include <SDL3/SDL_surface.h>
  33. #include <SDL3/SDL_video.h>
  34. #include <SDL3/SDL_begin_code.h>
  35. /* Set up for C function definitions, even when using C++ */
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /**
  40. * An opaque handle representing a toplevel system tray object.
  41. *
  42. * \since This struct is available since SDL 3.2.0.
  43. */
  44. typedef struct SDL_Tray SDL_Tray;
  45. /**
  46. * An opaque handle representing a menu/submenu on a system tray object.
  47. *
  48. * \since This struct is available since SDL 3.2.0.
  49. */
  50. typedef struct SDL_TrayMenu SDL_TrayMenu;
  51. /**
  52. * An opaque handle representing an entry on a system tray object.
  53. *
  54. * \since This struct is available since SDL 3.2.0.
  55. */
  56. typedef struct SDL_TrayEntry SDL_TrayEntry;
  57. /**
  58. * Flags that control the creation of system tray entries.
  59. *
  60. * Some of these flags are required; exactly one of them must be specified at
  61. * the time a tray entry is created. Other flags are optional; zero or more of
  62. * those can be OR'ed together with the required flag.
  63. *
  64. * \since This datatype is available since SDL 3.2.0.
  65. *
  66. * \sa SDL_InsertTrayEntryAt
  67. */
  68. typedef Uint32 SDL_TrayEntryFlags;
  69. #define SDL_TRAYENTRY_BUTTON 0x00000001u /**< Make the entry a simple button. Required. */
  70. #define SDL_TRAYENTRY_CHECKBOX 0x00000002u /**< Make the entry a checkbox. Required. */
  71. #define SDL_TRAYENTRY_SUBMENU 0x00000004u /**< Prepare the entry to have a submenu. Required */
  72. #define SDL_TRAYENTRY_DISABLED 0x80000000u /**< Make the entry disabled. Optional. */
  73. #define SDL_TRAYENTRY_CHECKED 0x40000000u /**< Make the entry checked. This is valid only for checkboxes. Optional. */
  74. /**
  75. * A callback that is invoked when a tray entry is selected.
  76. *
  77. * \param userdata an optional pointer to pass extra data to the callback when
  78. * it will be invoked.
  79. * \param entry the tray entry that was selected.
  80. *
  81. * \since This datatype is available since SDL 3.2.0.
  82. *
  83. * \sa SDL_SetTrayEntryCallback
  84. */
  85. typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry);
  86. /**
  87. * A callback that is invoked when the tray icon is clicked.
  88. *
  89. * \param userdata an optional pointer to pass extra data to the callback when
  90. * it will be invoked. May be NULL.
  91. * \param tray the tray that was clicked.
  92. * \returns true to show the tray menu after the callback returns, false to
  93. * skip showing the menu. This return value is only used for left and
  94. * right click callbacks; other mouse events ignore the return value.
  95. *
  96. * \since This datatype is available since SDL 3.6.0.
  97. *
  98. * \sa SDL_CreateTrayWithProperties
  99. */
  100. typedef bool (SDLCALL *SDL_TrayClickCallback)(void *userdata, SDL_Tray *tray);
  101. /**
  102. * Create an icon to be placed in the operating system's tray, or equivalent.
  103. *
  104. * Many platforms advise not using a system tray unless persistence is a
  105. * necessary feature. Avoid needlessly creating a tray icon, as the user may
  106. * feel like it clutters their interface.
  107. *
  108. * Using tray icons require the video subsystem.
  109. *
  110. * \param icon a surface to be used as icon. May be NULL.
  111. * \param tooltip a tooltip to be displayed when the mouse hovers the icon in
  112. * UTF-8 encoding. Not supported on all platforms. May be NULL.
  113. * \returns The newly created system tray icon.
  114. *
  115. * \threadsafety This function should only be called on the main thread.
  116. *
  117. * \since This function is available since SDL 3.2.0.
  118. *
  119. * \sa SDL_CreateTrayWithProperties
  120. * \sa SDL_CreateTrayMenu
  121. * \sa SDL_GetTrayMenu
  122. * \sa SDL_DestroyTray
  123. */
  124. extern SDL_DECLSPEC SDL_Tray * SDLCALL SDL_CreateTray(SDL_Surface *icon, const char *tooltip);
  125. /**
  126. * Create an icon to be placed in the operating system's tray, or equivalent.
  127. *
  128. * Many platforms advise not using a system tray unless persistence is a
  129. * necessary feature. Avoid needlessly creating a tray icon, as the user may
  130. * feel like it clutters their interface.
  131. *
  132. * Using tray icons require the video subsystem.
  133. *
  134. * These are the supported properties:
  135. *
  136. * - `SDL_PROP_TRAY_CREATE_ICON_POINTER`: an SDL_Surface to be used as the
  137. * tray icon. May be NULL.
  138. * - `SDL_PROP_TRAY_CREATE_TOOLTIP_STRING`: a tooltip to be displayed when the
  139. * mouse hovers the icon in UTF-8 encoding. Not supported on all platforms.
  140. * May be NULL.
  141. * - `SDL_PROP_TRAY_CREATE_USERDATA_POINTER`: an optional pointer to associate
  142. * with the tray, which will be passed to click callbacks. May be NULL.
  143. * - `SDL_PROP_TRAY_CREATE_LEFTCLICK_CALLBACK_POINTER`: an
  144. * SDL_TrayClickCallback to be invoked when the tray icon is left-clicked.
  145. * Not supported on all platforms. The callback should return true to show
  146. * the default menu, or false to skip showing it. May be NULL.
  147. * - `SDL_PROP_TRAY_CREATE_RIGHTCLICK_CALLBACK_POINTER`: an
  148. * SDL_TrayClickCallback to be invoked when the tray icon is right-clicked.
  149. * Not supported on all platforms. The callback should return true to show
  150. * the default menu, or false to skip showing it. May be NULL.
  151. * - `SDL_PROP_TRAY_CREATE_MIDDLECLICK_CALLBACK_POINTER`: an
  152. * SDL_TrayClickCallback to be invoked when the tray icon is middle-clicked.
  153. * Not supported on all platforms. May be NULL.
  154. *
  155. * \param props the properties to use.
  156. * \returns The newly created system tray icon.
  157. *
  158. * \threadsafety This function should only be called on the main thread.
  159. *
  160. * \since This function is available since SDL 3.6.0.
  161. *
  162. * \sa SDL_CreateTray
  163. * \sa SDL_CreateTrayMenu
  164. * \sa SDL_GetTrayMenu
  165. * \sa SDL_DestroyTray
  166. */
  167. extern SDL_DECLSPEC SDL_Tray * SDLCALL SDL_CreateTrayWithProperties(SDL_PropertiesID props);
  168. #define SDL_PROP_TRAY_CREATE_ICON_POINTER "SDL.tray.create.icon"
  169. #define SDL_PROP_TRAY_CREATE_TOOLTIP_STRING "SDL.tray.create.tooltip"
  170. #define SDL_PROP_TRAY_CREATE_USERDATA_POINTER "SDL.tray.create.userdata"
  171. #define SDL_PROP_TRAY_CREATE_LEFTCLICK_CALLBACK_POINTER "SDL.tray.create.leftclick_callback"
  172. #define SDL_PROP_TRAY_CREATE_RIGHTCLICK_CALLBACK_POINTER "SDL.tray.create.rightclick_callback"
  173. #define SDL_PROP_TRAY_CREATE_MIDDLECLICK_CALLBACK_POINTER "SDL.tray.create.middleclick_callback"
  174. /**
  175. * Updates the system tray icon's icon.
  176. *
  177. * \param tray the tray icon to be updated.
  178. * \param icon the new icon. May be NULL.
  179. *
  180. * \threadsafety This function should be called on the thread that created the
  181. * tray.
  182. *
  183. * \since This function is available since SDL 3.2.0.
  184. *
  185. * \sa SDL_CreateTray
  186. */
  187. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon);
  188. /**
  189. * Updates the system tray icon's tooltip.
  190. *
  191. * \param tray the tray icon to be updated.
  192. * \param tooltip the new tooltip in UTF-8 encoding. May be NULL.
  193. *
  194. * \threadsafety This function should be called on the thread that created the
  195. * tray.
  196. *
  197. * \since This function is available since SDL 3.2.0.
  198. *
  199. * \sa SDL_CreateTray
  200. */
  201. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip);
  202. /**
  203. * Create a menu for a system tray.
  204. *
  205. * This should be called at most once per tray icon.
  206. *
  207. * This function does the same thing as SDL_CreateTraySubmenu(), except that
  208. * it takes a SDL_Tray instead of a SDL_TrayEntry.
  209. *
  210. * A menu does not need to be destroyed; it will be destroyed with the tray.
  211. *
  212. * \param tray the tray to bind the menu to.
  213. * \returns the newly created menu.
  214. *
  215. * \threadsafety This function should be called on the thread that created the
  216. * tray.
  217. *
  218. * \since This function is available since SDL 3.2.0.
  219. *
  220. * \sa SDL_CreateTray
  221. * \sa SDL_GetTrayMenu
  222. * \sa SDL_GetTrayMenuParentTray
  223. */
  224. extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray);
  225. /**
  226. * Create a submenu for a system tray entry.
  227. *
  228. * This should be called at most once per tray entry.
  229. *
  230. * This function does the same thing as SDL_CreateTrayMenu, except that it
  231. * takes a SDL_TrayEntry instead of a SDL_Tray.
  232. *
  233. * A menu does not need to be destroyed; it will be destroyed with the tray.
  234. *
  235. * \param entry the tray entry to bind the menu to.
  236. * \returns the newly created menu.
  237. *
  238. * \threadsafety This function should be called on the thread that created the
  239. * tray.
  240. *
  241. * \since This function is available since SDL 3.2.0.
  242. *
  243. * \sa SDL_InsertTrayEntryAt
  244. * \sa SDL_GetTraySubmenu
  245. * \sa SDL_GetTrayMenuParentEntry
  246. */
  247. extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *entry);
  248. /**
  249. * Gets a previously created tray menu.
  250. *
  251. * You should have called SDL_CreateTrayMenu() on the tray object. This
  252. * function allows you to fetch it again later.
  253. *
  254. * This function does the same thing as SDL_GetTraySubmenu(), except that it
  255. * takes a SDL_Tray instead of a SDL_TrayEntry.
  256. *
  257. * A menu does not need to be destroyed; it will be destroyed with the tray.
  258. *
  259. * \param tray the tray entry to bind the menu to.
  260. * \returns the newly created menu.
  261. *
  262. * \threadsafety This function should be called on the thread that created the
  263. * tray.
  264. *
  265. * \since This function is available since SDL 3.2.0.
  266. *
  267. * \sa SDL_CreateTray
  268. * \sa SDL_CreateTrayMenu
  269. */
  270. extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTrayMenu(SDL_Tray *tray);
  271. /**
  272. * Gets a previously created tray entry submenu.
  273. *
  274. * You should have called SDL_CreateTraySubmenu() on the entry object. This
  275. * function allows you to fetch it again later.
  276. *
  277. * This function does the same thing as SDL_GetTrayMenu(), except that it
  278. * takes a SDL_TrayEntry instead of a SDL_Tray.
  279. *
  280. * A menu does not need to be destroyed; it will be destroyed with the tray.
  281. *
  282. * \param entry the tray entry to bind the menu to.
  283. * \returns the newly created menu.
  284. *
  285. * \threadsafety This function should be called on the thread that created the
  286. * tray.
  287. *
  288. * \since This function is available since SDL 3.2.0.
  289. *
  290. * \sa SDL_InsertTrayEntryAt
  291. * \sa SDL_CreateTraySubmenu
  292. */
  293. extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entry);
  294. /**
  295. * Returns a list of entries in the menu, in order.
  296. *
  297. * \param menu The menu to get entries from.
  298. * \param count An optional pointer to obtain the number of entries in the
  299. * menu.
  300. * \returns a NULL-terminated list of entries within the given menu. The
  301. * pointer becomes invalid when any function that inserts or deletes
  302. * entries in the menu is called.
  303. *
  304. * \threadsafety This function should be called on the thread that created the
  305. * tray.
  306. *
  307. * \since This function is available since SDL 3.2.0.
  308. *
  309. * \sa SDL_RemoveTrayEntry
  310. * \sa SDL_InsertTrayEntryAt
  311. */
  312. extern SDL_DECLSPEC const SDL_TrayEntry ** SDLCALL SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count);
  313. /**
  314. * Removes a tray entry.
  315. *
  316. * \param entry The entry to be deleted.
  317. *
  318. * \threadsafety This function should be called on the thread that created the
  319. * tray.
  320. *
  321. * \since This function is available since SDL 3.2.0.
  322. *
  323. * \sa SDL_GetTrayEntries
  324. * \sa SDL_InsertTrayEntryAt
  325. */
  326. extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry);
  327. /**
  328. * Insert a tray entry at a given position.
  329. *
  330. * If label is NULL, the entry will be a separator. Many functions won't work
  331. * for an entry that is a separator.
  332. *
  333. * An entry does not need to be destroyed; it will be destroyed with the tray.
  334. *
  335. * \param menu the menu to append the entry to.
  336. * \param pos the desired position for the new entry. Entries at or following
  337. * this place will be moved. If pos is -1, the entry is appended.
  338. * \param label the text to be displayed on the entry, in UTF-8 encoding, or
  339. * NULL for a separator.
  340. * \param flags a combination of flags, some of which are mandatory.
  341. * \returns the newly created entry, or NULL if pos is out of bounds.
  342. *
  343. * \threadsafety This function should be called on the thread that created the
  344. * tray.
  345. *
  346. * \since This function is available since SDL 3.2.0.
  347. *
  348. * \sa SDL_TrayEntryFlags
  349. * \sa SDL_GetTrayEntries
  350. * \sa SDL_RemoveTrayEntry
  351. * \sa SDL_GetTrayEntryParent
  352. */
  353. extern SDL_DECLSPEC SDL_TrayEntry * SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags);
  354. /**
  355. * Sets the label of an entry.
  356. *
  357. * An entry cannot change between a separator and an ordinary entry; that is,
  358. * it is not possible to set a non-NULL label on an entry that has a NULL
  359. * label (separators), or to set a NULL label to an entry that has a non-NULL
  360. * label. The function will silently fail if that happens.
  361. *
  362. * \param entry the entry to be updated.
  363. * \param label the new label for the entry in UTF-8 encoding.
  364. *
  365. * \threadsafety This function should be called on the thread that created the
  366. * tray.
  367. *
  368. * \since This function is available since SDL 3.2.0.
  369. *
  370. * \sa SDL_GetTrayEntries
  371. * \sa SDL_InsertTrayEntryAt
  372. * \sa SDL_GetTrayEntryLabel
  373. */
  374. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label);
  375. /**
  376. * Gets the label of an entry.
  377. *
  378. * If the returned value is NULL, the entry is a separator.
  379. *
  380. * \param entry the entry to be read.
  381. * \returns the label of the entry in UTF-8 encoding.
  382. *
  383. * \threadsafety This function should be called on the thread that created the
  384. * tray.
  385. *
  386. * \since This function is available since SDL 3.2.0.
  387. *
  388. * \sa SDL_GetTrayEntries
  389. * \sa SDL_InsertTrayEntryAt
  390. * \sa SDL_SetTrayEntryLabel
  391. */
  392. extern SDL_DECLSPEC const char * SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *entry);
  393. /**
  394. * Sets whether or not an entry is checked.
  395. *
  396. * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
  397. *
  398. * \param entry the entry to be updated.
  399. * \param checked true if the entry should be checked; false otherwise.
  400. *
  401. * \threadsafety This function should be called on the thread that created the
  402. * tray.
  403. *
  404. * \since This function is available since SDL 3.2.0.
  405. *
  406. * \sa SDL_GetTrayEntries
  407. * \sa SDL_InsertTrayEntryAt
  408. * \sa SDL_GetTrayEntryChecked
  409. */
  410. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked);
  411. /**
  412. * Gets whether or not an entry is checked.
  413. *
  414. * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
  415. *
  416. * \param entry the entry to be read.
  417. * \returns true if the entry is checked; false otherwise.
  418. *
  419. * \threadsafety This function should be called on the thread that created the
  420. * tray.
  421. *
  422. * \since This function is available since SDL 3.2.0.
  423. *
  424. * \sa SDL_GetTrayEntries
  425. * \sa SDL_InsertTrayEntryAt
  426. * \sa SDL_SetTrayEntryChecked
  427. */
  428. extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry);
  429. /**
  430. * Sets whether or not an entry is enabled.
  431. *
  432. * \param entry the entry to be updated.
  433. * \param enabled true if the entry should be enabled; false otherwise.
  434. *
  435. * \threadsafety This function should be called on the thread that created the
  436. * tray.
  437. *
  438. * \since This function is available since SDL 3.2.0.
  439. *
  440. * \sa SDL_GetTrayEntries
  441. * \sa SDL_InsertTrayEntryAt
  442. * \sa SDL_GetTrayEntryEnabled
  443. */
  444. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled);
  445. /**
  446. * Gets whether or not an entry is enabled.
  447. *
  448. * \param entry the entry to be read.
  449. * \returns true if the entry is enabled; false otherwise.
  450. *
  451. * \threadsafety This function should be called on the thread that created the
  452. * tray.
  453. *
  454. * \since This function is available since SDL 3.2.0.
  455. *
  456. * \sa SDL_GetTrayEntries
  457. * \sa SDL_InsertTrayEntryAt
  458. * \sa SDL_SetTrayEntryEnabled
  459. */
  460. extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry);
  461. /**
  462. * Sets a callback to be invoked when the entry is selected.
  463. *
  464. * \param entry the entry to be updated.
  465. * \param callback a callback to be invoked when the entry is selected.
  466. * \param userdata an optional pointer to pass extra data to the callback when
  467. * it will be invoked.
  468. *
  469. * \threadsafety This function should be called on the thread that created the
  470. * tray.
  471. *
  472. * \since This function is available since SDL 3.2.0.
  473. *
  474. * \sa SDL_GetTrayEntries
  475. * \sa SDL_InsertTrayEntryAt
  476. */
  477. extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata);
  478. /**
  479. * Simulate a click on a tray entry.
  480. *
  481. * \param entry The entry to activate.
  482. *
  483. * \threadsafety This function should be called on the thread that created the
  484. * tray.
  485. *
  486. * \since This function is available since SDL 3.2.0.
  487. */
  488. extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry);
  489. /**
  490. * Destroys a tray object.
  491. *
  492. * This also destroys all associated menus and entries.
  493. *
  494. * \param tray the tray icon to be destroyed.
  495. *
  496. * \threadsafety This function should be called on the thread that created the
  497. * tray.
  498. *
  499. * \since This function is available since SDL 3.2.0.
  500. *
  501. * \sa SDL_CreateTray
  502. */
  503. extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray);
  504. /**
  505. * Gets the menu containing a certain tray entry.
  506. *
  507. * \param entry the entry for which to get the parent menu.
  508. * \returns the parent menu.
  509. *
  510. * \threadsafety This function should be called on the thread that created the
  511. * tray.
  512. *
  513. * \since This function is available since SDL 3.2.0.
  514. *
  515. * \sa SDL_InsertTrayEntryAt
  516. */
  517. extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *entry);
  518. /**
  519. * Gets the entry for which the menu is a submenu, if the current menu is a
  520. * submenu.
  521. *
  522. * Either this function or SDL_GetTrayMenuParentTray() will return non-NULL
  523. * for any given menu.
  524. *
  525. * \param menu the menu for which to get the parent entry.
  526. * \returns the parent entry, or NULL if this menu is not a submenu.
  527. *
  528. * \threadsafety This function should be called on the thread that created the
  529. * tray.
  530. *
  531. * \since This function is available since SDL 3.2.0.
  532. *
  533. * \sa SDL_CreateTraySubmenu
  534. * \sa SDL_GetTrayMenuParentTray
  535. */
  536. extern SDL_DECLSPEC SDL_TrayEntry * SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu);
  537. /**
  538. * Gets the tray for which this menu is the first-level menu, if the current
  539. * menu isn't a submenu.
  540. *
  541. * Either this function or SDL_GetTrayMenuParentEntry() will return non-NULL
  542. * for any given menu.
  543. *
  544. * \param menu the menu for which to get the parent enttrayry.
  545. * \returns the parent tray, or NULL if this menu is a submenu.
  546. *
  547. * \threadsafety This function should be called on the thread that created the
  548. * tray.
  549. *
  550. * \since This function is available since SDL 3.2.0.
  551. *
  552. * \sa SDL_CreateTrayMenu
  553. * \sa SDL_GetTrayMenuParentEntry
  554. */
  555. extern SDL_DECLSPEC SDL_Tray * SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu);
  556. /**
  557. * Update the trays.
  558. *
  559. * This is called automatically by the event loop and is only needed if you're
  560. * using trays but aren't handling SDL events.
  561. *
  562. * \threadsafety This function should only be called on the main thread.
  563. *
  564. * \since This function is available since SDL 3.2.0.
  565. */
  566. extern SDL_DECLSPEC void SDLCALL SDL_UpdateTrays(void);
  567. /* Ends C function definitions when using C++ */
  568. #ifdef __cplusplus
  569. }
  570. #endif
  571. #include <SDL3/SDL_close_code.h>
  572. #endif /* SDL_tray_h_ */