|
SDL3pp
A slim C++ wrapper for SDL3
|
SDL offers a way to add items to the "system tray" (more correctly called the "notification area" on Windows). More...

Classes | |
| struct | SDL::TrayParam |
| Safely wrap Tray for non owning parameters. More... | |
| struct | SDL::TrayEntryParam |
| Safely wrap TrayEntry for non owning parameters. More... | |
| class | SDL::Tray |
| An opaque handle representing a toplevel system tray object. More... | |
| struct | SDL::TrayRef |
| Semi-safe reference for Tray. More... | |
| class | SDL::TrayMenu |
| An opaque handle representing a menu/submenu on a system tray object. More... | |
| class | SDL::TrayEntry |
| An opaque handle representing an entry on a system tray object. More... | |
| struct | SDL::TrayEntryScoped |
| RAII owning version TrayEntry. More... | |
Typedefs | |
| using | SDL::TrayRaw = SDL_Tray * |
| Alias to raw representation for Tray. | |
| using | SDL::TrayMenuRaw = SDL_TrayMenu * |
| Alias to raw representation for TrayMenu. | |
| using | SDL::TrayEntryRaw = SDL_TrayEntry * |
| Alias to raw representation for TrayEntry. | |
| using | SDL::TrayEntryFlags = Uint32 |
| Flags that control the creation of system tray entries. More... | |
| using | SDL::TrayCallback = SDL_TrayCallback |
| A callback that is invoked when a tray entry is selected. More... | |
| using | SDL::TrayCB = std::function< void(TrayEntryRaw)> |
| A callback that is invoked when a tray entry is selected. More... | |
Functions | |
| Tray | SDL::CreateTray (SurfaceParam icon, StringParam tooltip) |
| Create an icon to be placed in the operating system's tray, or equivalent. More... | |
| void | SDL::SetTrayIcon (TrayParam tray, SurfaceParam icon) |
| Updates the system tray icon's icon. More... | |
| void | SDL::SetTrayTooltip (TrayParam tray, StringParam tooltip) |
| Updates the system tray icon's tooltip. More... | |
| TrayMenu | SDL::CreateTrayMenu (TrayParam tray) |
| Create a menu for a system tray. More... | |
| TrayMenu | SDL::CreateTraySubmenu (TrayEntryParam entry) |
| Create a submenu for a system tray entry. More... | |
| TrayMenu | SDL::GetTrayMenu (TrayParam tray) |
| Gets a previously created tray menu. More... | |
| TrayMenu | SDL::GetTraySubmenu (TrayEntryParam entry) |
| Gets a previously created tray entry submenu. More... | |
| std::span< TrayEntry > | SDL::GetTrayEntries (TrayMenu menu) |
| Returns a list of entries in the menu, in order. More... | |
| void | SDL::RemoveTrayEntry (TrayEntryRaw entry) |
| Removes a tray entry. More... | |
| TrayEntry | SDL::InsertTrayEntryAt (TrayMenu menu, int pos, StringParam label, TrayEntryFlags flags) |
| Insert a tray entry at a given position. More... | |
| void | SDL::SetTrayEntryLabel (TrayEntryParam entry, StringParam label) |
| Sets the label of an entry. More... | |
| const char * | SDL::GetTrayEntryLabel (TrayEntryParam entry) |
| Gets the label of an entry. More... | |
| void | SDL::SetTrayEntryChecked (TrayEntryParam entry, bool checked) |
| Sets whether or not an entry is checked. More... | |
| bool | SDL::GetTrayEntryChecked (TrayEntryParam entry) |
| Gets whether or not an entry is checked. More... | |
| void | SDL::SetTrayEntryEnabled (TrayEntryParam entry, bool enabled) |
| Sets whether or not an entry is enabled. More... | |
| bool | SDL::GetTrayEntryEnabled (TrayEntryParam entry) |
| Gets whether or not an entry is enabled. More... | |
| void | SDL::SetTrayEntryCallback (TrayEntryParam entry, TrayCallback callback, void *userdata) |
| Sets a callback to be invoked when the entry is selected. More... | |
| void | SDL::ClickTrayEntry (TrayEntryParam entry) |
| Simulate a click on a tray entry. More... | |
| void | SDL::DestroyTray (TrayRaw tray) |
| Destroys a tray object. More... | |
| TrayMenu | SDL::GetTrayEntryParent (TrayEntryParam entry) |
| Gets the menu containing a certain tray entry. More... | |
| TrayEntryParam | SDL::GetTrayMenuParentEntry (TrayMenuRaw menu) |
| Gets the entry for which the menu is a submenu, if the current menu is a submenu. More... | |
| TrayParam | SDL::GetTrayMenuParentTray (TrayMenuRaw menu) |
| Gets the tray for which this menu is the first-level menu, if the current menu isn't a submenu. More... | |
| void | SDL::UpdateTrays () |
| Update the trays. More... | |
| void | SDL::Tray::SetIcon (SurfaceParam icon) |
| Updates the system tray icon's icon. More... | |
| void | SDL::Tray::SetTooltip (StringParam tooltip) |
| Updates the system tray icon's tooltip. More... | |
| TrayMenu | SDL::Tray::CreateMenu () |
| Create a menu for a system tray. More... | |
| TrayMenu | SDL::TrayEntry::CreateSubmenu () |
| Create a submenu for a system tray entry. More... | |
| TrayMenu | SDL::Tray::GetMenu () const |
| Gets a previously created tray menu. More... | |
| TrayMenu | SDL::TrayEntry::GetSubmenu () |
| Gets a previously created tray entry submenu. More... | |
| std::span< TrayEntry > | SDL::TrayMenu::GetEntries () |
| Returns a list of entries in the menu, in order. More... | |
| void | SDL::TrayEntry::Remove () |
| Removes a tray entry. More... | |
| TrayEntry | SDL::TrayMenu::InsertEntry (int pos, StringParam label, TrayEntryFlags flags) |
| Insert a tray entry at a given position. More... | |
| void | SDL::TrayEntry::SetLabel (StringParam label) |
| Sets the label of an entry. More... | |
| const char * | SDL::TrayEntry::GetLabel () const |
| Gets the label of an entry. More... | |
| void | SDL::TrayEntry::SetChecked (bool checked) |
| Sets whether or not an entry is checked. More... | |
| bool | SDL::TrayEntry::GetChecked () const |
| Gets whether or not an entry is checked. More... | |
| void | SDL::TrayEntry::SetEnabled (bool enabled) |
| Sets whether or not an entry is enabled. More... | |
| bool | SDL::TrayEntry::GetEnabled () const |
| Gets whether or not an entry is enabled. More... | |
| void | SDL::TrayEntry::SetCallback (TrayCallback callback, void *userdata) |
| Sets a callback to be invoked when the entry is selected. More... | |
| void | SDL::TrayEntry::Click () |
| Simulate a click on a tray entry. More... | |
| void | SDL::Tray::Destroy () |
| Destroys a tray object. More... | |
| TrayMenu | SDL::TrayEntry::GetParent () |
| Gets the menu containing a certain tray entry. More... | |
| TrayEntryParam | SDL::TrayMenu::GetParentEntry () const |
| Gets the entry for which the menu is a submenu, if the current menu is a submenu. More... | |
| TrayParam | SDL::TrayMenu::GetParentTray () const |
| Gets the tray for which this menu is the first-level menu, if the current menu isn't a submenu. More... | |
Variables | |
| constexpr TrayEntryFlags | SDL::TRAYENTRY_BUTTON |
| Make the entry a simple button. Required. More... | |
| constexpr TrayEntryFlags | SDL::TRAYENTRY_CHECKBOX |
| Make the entry a checkbox. Required. More... | |
| constexpr TrayEntryFlags | SDL::TRAYENTRY_SUBMENU |
| Prepare the entry to have a submenu. Required. More... | |
| constexpr TrayEntryFlags | SDL::TRAYENTRY_DISABLED |
| Make the entry disabled. Optional. More... | |
| constexpr TrayEntryFlags | SDL::TRAYENTRY_CHECKED = SDL_TRAYENTRY_CHECKED |
| Make the entry checked. This is valid only for checkboxes. Optional. | |
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.
| using SDL::TrayCallback = typedef SDL_TrayCallback |
| userdata | an optional pointer to pass extra data to the callback when it will be invoked. |
| entry | the tray entry that was selected. |
| using SDL::TrayCB = typedef std::function<void(TrayEntryRaw)> |
| entry | the tray entry that was selected. |
| using SDL::TrayEntryFlags = typedef Uint32 |
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.
|
inline |
|
inline |
| entry | The entry to activate. |
|
inline |
This should be called at most once per tray icon.
This function does the same thing as TrayEntry.CreateSubmenu(), except that it takes a Tray instead of a TrayEntry.
A menu does not need to be destroyed; it will be destroyed with the tray.
|
inline |
This should be called at most once per tray entry.
This function does the same thing as Tray.CreateMenu, except that it takes a TrayEntry instead of a Tray.
A menu does not need to be destroyed; it will be destroyed with the tray.
|
inline |
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.
| icon | a surface to be used as icon. May be nullptr. |
| tooltip | a tooltip to be displayed when the mouse hovers the icon in UTF-8 encoding. Not supported on all platforms. May be nullptr. |
This should be called at most once per tray icon.
This function does the same thing as TrayEntry.CreateSubmenu(), except that it takes a Tray instead of a TrayEntry.
A menu does not need to be destroyed; it will be destroyed with the tray.
| tray | the tray to bind the menu to. |
|
inline |
This should be called at most once per tray entry.
This function does the same thing as Tray.CreateMenu, except that it takes a TrayEntry instead of a Tray.
A menu does not need to be destroyed; it will be destroyed with the tray.
| entry | the tray entry to bind the menu to. |
|
inline |
|
inline |
|
inline |
The entry must have been created with the TRAYENTRY_CHECKBOX flag.
|
inline |
|
inline |
|
inline |
If the returned value is nullptr, the entry is a separator.
|
inline |
You should have called Tray.CreateMenu() on the tray object. This function allows you to fetch it again later.
This function does the same thing as TrayEntry.GetSubmenu(), except that it takes a Tray instead of a TrayEntry.
A menu does not need to be destroyed; it will be destroyed with the tray.
|
inline |
|
inline |
Either this function or TrayMenu.GetParentTray() will return non-nullptr for any given menu.
|
inline |
Either this function or TrayMenu.GetParentEntry() will return non-nullptr for any given menu.
|
inline |
You should have called TrayEntry.CreateSubmenu() on the entry object. This function allows you to fetch it again later.
This function does the same thing as Tray.GetMenu(), except that it takes a TrayEntry instead of a Tray.
A menu does not need to be destroyed; it will be destroyed with the tray.
| menu | The menu to get entries from. |
|
inline |
The entry must have been created with the TRAYENTRY_CHECKBOX flag.
| entry | the entry to be read. |
|
inline |
| entry | the entry to be read. |
|
inline |
If the returned value is nullptr, the entry is a separator.
| entry | the entry to be read. |
|
inline |
| entry | the entry for which to get the parent menu. |
You should have called Tray.CreateMenu() on the tray object. This function allows you to fetch it again later.
This function does the same thing as TrayEntry.GetSubmenu(), except that it takes a Tray instead of a TrayEntry.
A menu does not need to be destroyed; it will be destroyed with the tray.
| tray | the tray entry to bind the menu to. |
|
inline |
Either this function or TrayMenu.GetParentTray() will return non-nullptr for any given menu.
| menu | the menu for which to get the parent entry. |
|
inline |
Either this function or TrayMenu.GetParentEntry() will return non-nullptr for any given menu.
| menu | the menu for which to get the parent enttrayry. |
|
inline |
You should have called TrayEntry.CreateSubmenu() on the entry object. This function allows you to fetch it again later.
This function does the same thing as Tray.GetMenu(), except that it takes a TrayEntry instead of a Tray.
A menu does not need to be destroyed; it will be destroyed with the tray.
| entry | the tray entry to bind the menu to. |
|
inline |
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.
| 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. |
|
inline |
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.
| menu | the menu to append the entry to. |
| 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. |
|
inline |
|
inline |
| entry | The entry to be deleted. |
|
inline |
| callback | a callback to be invoked when the entry is selected. |
| userdata | an optional pointer to pass extra data to the callback when it will be invoked. |
|
inline |
The entry must have been created with the TRAYENTRY_CHECKBOX flag.
| checked | true if the entry should be checked; false otherwise. |
|
inline |
| enabled | true if the entry should be enabled; false otherwise. |
|
inline |
|
inline |
An entry cannot change between a separator and an ordinary entry; that is, it is not possible to set a non-nullptr label on an entry that has a nullptr label (separators), or to set a nullptr label to an entry that has a non-nullptr label. The function will silently fail if that happens.
| label | the new label for the entry in UTF-8 encoding. |
|
inline |
|
inline |
| entry | the entry to be updated. |
| callback | a callback to be invoked when the entry is selected. |
| userdata | an optional pointer to pass extra data to the callback when it will be invoked. |
|
inline |
The entry must have been created with the TRAYENTRY_CHECKBOX flag.
| entry | the entry to be updated. |
| checked | true if the entry should be checked; false otherwise. |
|
inline |
| entry | the entry to be updated. |
| enabled | true if the entry should be enabled; false otherwise. |
|
inline |
An entry cannot change between a separator and an ordinary entry; that is, it is not possible to set a non-nullptr label on an entry that has a nullptr label (separators), or to set a nullptr label to an entry that has a non-nullptr label. The function will silently fail if that happens.
| entry | the entry to be updated. |
| label | the new label for the entry in UTF-8 encoding. |
|
inline |
|
inline |
|
inline |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |