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

An opaque handle representing a toplevel system tray object. More...

Inheritance diagram for SDL::Tray:
Inheritance graph
[legend]

Public Member Functions

constexpr Tray ()=default
 Default ctor.
 
constexpr Tray (const TrayRaw resource)
 Constructs from TrayParam. More...
 
constexpr Tray (const Tray &other)=delete
 Copy constructor.
 
constexpr Tray (Tray &&other)
 Move constructor.
 
constexpr Tray (const TrayRef &other)=delete
 
constexpr Tray (TrayRef &&other)=delete
 
 Tray (SurfaceParam icon, StringParam tooltip)
 Create an icon to be placed in the operating system's tray, or equivalent. More...
 
 ~Tray ()
 Destructor.
 
Trayoperator= (Tray other)
 Assignment operator.
 
constexpr TrayRaw get () const
 Retrieves underlying TrayRaw.
 
constexpr TrayRaw release ()
 Retrieves underlying TrayRaw and clear this.
 
constexpr auto operator<=> (const Tray &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator TrayParam () const
 Converts to TrayParam.
 
void Destroy ()
 Destroys a tray object. More...
 
void SetIcon (SurfaceParam icon)
 Updates the system tray icon's icon. More...
 
void SetTooltip (StringParam tooltip)
 Updates the system tray icon's tooltip. More...
 
TrayMenu CreateMenu ()
 Create a menu for a system tray. More...
 
TrayMenu GetMenu () const
 Gets a previously created tray menu. More...
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ Tray() [1/2]

constexpr SDL::Tray::Tray ( const TrayRaw  resource)
inlineexplicitconstexpr
Parameters
resourcea TrayRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

◆ Tray() [2/2]

SDL::Tray::Tray ( SurfaceParam  icon,
StringParam  tooltip 
)
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.

Parameters
icona surface to be used as icon. May be nullptr.
tooltipa tooltip to be displayed when the mouse hovers the icon in UTF-8 encoding. Not supported on all platforms. May be nullptr.
Postcondition
The newly created system tray icon.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Tray.CreateMenu
Tray.GetMenu
Tray.Destroy

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