SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Protected 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 (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr Tray (const TrayRaw resource) noexcept
 Constructs from TrayParam. More...
 
constexpr Tray (Tray &&other) noexcept
 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.
 
constexpr Trayoperator= (Tray &&other) noexcept
 Assignment operator.
 
constexpr TrayRaw get () const noexcept
 Retrieves underlying TrayRaw.
 
constexpr TrayRaw release () noexcept
 Retrieves underlying TrayRaw and clear this.
 
constexpr auto operator<=> (const Tray &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
constexpr operator TrayParam () const noexcept
 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...
 

Protected Member Functions

constexpr Tray (const Tray &other) noexcept=default
 Copy constructor.
 
constexpr Trayoperator= (const Tray &other) noexcept=default
 Assignment operator.
 

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)
inlineexplicitconstexprnoexcept
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: