SDL offers a way to add items to the "system tray" (more correctly called the "notification area" on Windows).
More...
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.
◆ DetachedTrayEntry
This is designed as resource types to cases where ownership might not be required.
◆ TrayCallback
- Parameters
-
userdata | an optional pointer to pass extra data to the callback when it will be invoked. |
entry | the tray entry that was selected. |
- Since
- This datatype is available since SDL 3.2.0.
- See also
- TrayEntryBase.SetCallback
◆ TrayCB
◆ TrayEntryFlags
Some of these flags are required; exactly one of them must be specified at the time a tray entry is created. Other flags are optional; zero or more of those can be OR'ed together with the required flag.
- Since
- This datatype is available since SDL 3.2.0.
- See also
- TrayMenu.InsertEntry
◆ CreateMenu()
◆ GetEntries()
std::span< TrayEntry > SDL::TrayMenu::GetEntries |
( |
| ) |
|
|
inline |
- Returns
- a nullptr-terminated list of entries within the given menu. The pointer becomes invalid when any function that inserts or deletes entries in the menu is called.
- Thread safety:
- This function should be called on the thread that created the tray.
- Since
- This function is available since SDL 3.2.0.
- See also
- TrayEntryRef.Remove
-
TrayMenu.InsertEntry
◆ GetMenu()
TrayMenu SDL::TrayBase::GetMenu |
( |
| ) |
const |
|
inline |
◆ GetParentEntry()
◆ GetParentTray()
TrayRef SDL::TrayMenu::GetParentTray |
( |
| ) |
const |
|
inline |
◆ InsertEntry()
If label is nullptr, the entry will be a separator. Many functions won't work for an entry that is a separator.
An entry does not need to be destroyed; it will be destroyed with the tray.
- Parameters
-
pos | the desired position for the new entry. Entries at or following this place will be moved. If pos is -1, the entry is appended. |
label | the text to be displayed on the entry, in UTF-8 encoding, or nullptr for a separator. |
flags | a combination of flags, some of which are mandatory. |
- Returns
- the newly created entry, or nullptr if pos is out of bounds.
- Thread safety:
- This function should be called on the thread that created the tray.
- Since
- This function is available since SDL 3.2.0.
- See also
- TrayMenu.AppendEntry
-
TrayEntryFlags
-
TrayMenu.GetEntries
-
TrayEntryRef.Remove
-
TrayEntryBase.GetParent
◆ UpdateTrays()
void SDL::UpdateTrays |
( |
| ) |
|
|
inline |
This is called automatically by the event loop and is only needed if you're using trays but aren't handling SDL events.
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
◆ TRAYENTRY_BUTTON
◆ TRAYENTRY_CHECKBOX
◆ TRAYENTRY_CHECKED
constexpr TrayEntryFlags SDL::TRAYENTRY_CHECKED = SDL_TRAYENTRY_CHECKED |
|
constexpr |
This is valid only for checkboxes. Optional.
◆ TRAYENTRY_DISABLED
◆ TRAYENTRY_SUBMENU