SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::TrayMenu Class Reference

An opaque handle representing a menu/submenu on a system tray object. More...

Public Member Functions

constexpr TrayMenu (SDL_TrayMenu *trayMenu={})
 Wraps TrayMenu.
 
constexpr bool operator== (const TrayMenu &other) const =default
 Default comparison operator.
 
constexpr bool operator== (SDL_TrayMenu *trayMenu) const
 Compares with the underlying type.
 
constexpr operator SDL_TrayMenu * () const
 Unwraps to the underlying TrayMenu.
 
constexpr operator bool () const
 Check if valid.
 
std::span< TrayEntryGetEntries ()
 Returns a list of entries in the menu, in order.
 
DetachedTrayEntry InsertEntry (int pos, StringParam label, TrayEntryFlags flags)
 Insert a tray entry at a given position.
 
DetachedTrayEntry AppendEntry (StringParam label, TrayEntryFlags flags)
 Appends a tray entry.
 
TrayEntryRef GetParentEntry () const
 Gets the entry for which the menu is a submenu, if the current menu is a submenu.
 
TrayRef GetParentTray () const
 Gets the tray for which this menu is the first-level menu, if the current menu isn't a submenu.
 

Detailed Description

Since
This struct is available since SDL 3.2.0.

Constructor & Destructor Documentation

◆ TrayMenu()

constexpr SDL::TrayMenu::TrayMenu ( SDL_TrayMenu *  trayMenu = {})
inlineconstexpr
Parameters
trayMenuthe value to be wrapped

Member Function Documentation

◆ AppendEntry()

DetachedTrayEntry SDL::TrayMenu::AppendEntry ( StringParam  label,
TrayEntryFlags  flags 
)
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.

Parameters
labelthe text to be displayed on the entry, in UTF-8 encoding, or nullptr for a separator.
flagsa 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.InsertEntry
TrayEntryFlags
TrayMenu.GetEntries
TrayEntryBase.Remove
TrayEntryBase.GetParent

◆ operator bool()

constexpr SDL::TrayMenu::operator bool ( ) const
inlineexplicitconstexpr
Returns
True if valid state, false otherwise.

◆ operator SDL_TrayMenu *()

constexpr SDL::TrayMenu::operator SDL_TrayMenu * ( ) const
inlineconstexpr
Returns
the underlying TrayMenu *.

The documentation for this class was generated from the following file: