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

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

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

Public Member Functions

 TrayBase (SurfaceBase &icon, StringParam tooltip)
 Create an icon to be placed in the operating system's tray, or equivalent.
 
void SetIcon (SurfaceBase &icon)
 Updates the system tray icon's icon.
 
void SetTooltip (StringParam tooltip)
 Updates the system tray icon's tooltip.
 
TrayMenu CreateMenu ()
 Create a menu for a system tray.
 
TrayMenu GetMenu () const
 Gets a previously created tray menu.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_Tray * >
constexpr Resource (SDL_Tray * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_Tray * get () const
 Return contained resource;.
 
constexpr SDL_Tray * release (SDL_Tray * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_Tray * operator-> () const
 Access to fields.
 
constexpr SDL_Tray * operator-> ()
 Access to fields.
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
Category:
Resource
See also
Tray
TrayRef

Constructor & Destructor Documentation

◆ TrayBase()

SDL::TrayBase::TrayBase ( SurfaceBase 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
TrayBase.CreateMenu
TrayBase.GetMenu

Member Function Documentation

◆ SetIcon()

void SDL::TrayBase::SetIcon ( SurfaceBase icon)
inline
Parameters
iconthe new icon. May be nullptr.
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
TrayBase.TrayBase

◆ SetTooltip()

void SDL::TrayBase::SetTooltip ( StringParam  tooltip)
inline
Parameters
tooltipthe new tooltip in UTF-8 encoding. May be nullptr.
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
TrayBase.TrayBase

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