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

An opaque handle representing an entry on a system tray object. More...

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

Public Member Functions

TrayMenu CreateSubmenu ()
 Create a submenu for a system tray entry.
 
TrayMenu GetSubmenu ()
 Gets a previously created tray entry submenu.
 
void SetLabel (StringParam label)
 Sets the label of an entry.
 
const char * GetLabel () const
 Gets the label of an entry.
 
void SetChecked (bool checked)
 Sets whether or not an entry is checked.
 
bool GetChecked () const
 Gets whether or not an entry is checked.
 
void SetEnabled (bool enabled)
 Sets whether or not an entry is enabled.
 
bool GetEnabled () const
 Gets whether or not an entry is enabled.
 
void SetCallback (TrayCB callback)
 Sets a callback to be invoked when the entry is selected.
 
void SetCallback (TrayCallback callback, void *userdata)
 Sets a callback to be invoked when the entry is selected.
 
void Click ()
 Simulate a click on a tray entry.
 
TrayMenu GetParent ()
 Gets the menu containing a certain tray entry.
 
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_TrayEntry * >
constexpr Resource (SDL_TrayEntry * 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_TrayEntry * get () const
 Return contained resource;.
 
constexpr SDL_TrayEntry * release (SDL_TrayEntry * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_TrayEntry * operator-> () const
 Access to fields.
 
constexpr SDL_TrayEntry * operator-> ()
 Access to fields.
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
Category:
Resource
See also
TrayEntry
TrayEntryRef

Member Function Documentation

◆ Click()

void SDL::TrayEntryBase::Click ( )
inline
Thread safety:
This function should be called on the thread that created the tray.
Since
This function is available since SDL 3.2.0.

◆ CreateSubmenu()

TrayMenu SDL::TrayEntryBase::CreateSubmenu ( )
inline

This should be called at most once per tray entry.

This function does the same thing as TrayBase.CreateMenu, except that it takes a TrayEntryBase instead of a TrayBase.

A menu does not need to be destroyed; it will be destroyed with the tray.

Returns
the newly created menu.
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
TrayEntryBase.GetSubmenu
TrayMenu.GetParentEntry

◆ GetChecked()

bool SDL::TrayEntryBase::GetChecked ( ) const
inline

The entry must have been created with the TRAYENTRY_CHECKBOX flag.

Returns
true if the entry is checked; false otherwise.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.SetChecked

◆ GetEnabled()

bool SDL::TrayEntryBase::GetEnabled ( ) const
inline
Returns
true if the entry is enabled; false otherwise.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.SetEnabled

◆ GetLabel()

const char * SDL::TrayEntryBase::GetLabel ( ) const
inline

If the returned value is nullptr, the entry is a separator.

Returns
the label of the entry in UTF-8 encoding.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.SetLabel

◆ GetParent()

TrayMenu SDL::TrayEntryBase::GetParent ( )
inline
Returns
the parent menu.
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

◆ GetSubmenu()

TrayMenu SDL::TrayEntryBase::GetSubmenu ( )
inline

You should have called TrayEntryBase.CreateSubmenu() on the entry object. This function allows you to fetch it again later.

This function does the same thing as TrayBase.GetMenu(), except that it takes a TrayEntryBase instead of a TrayBase.

A menu does not need to be destroyed; it will be destroyed with the tray.

Returns
the newly created menu.
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
TrayEntryBase.CreateSubmenu

◆ SetCallback() [1/2]

void SDL::TrayEntryBase::SetCallback ( TrayCallback  callback,
void *  userdata 
)
inline
Parameters
callbacka callback to be invoked when the entry is selected.
userdataan optional pointer to pass extra data to the callback when it will be invoked.
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.GetEntries
TrayMenu.InsertEntry

◆ SetCallback() [2/2]

void SDL::TrayEntryBase::SetCallback ( TrayCB  callback)
Parameters
callbacka callback to be invoked when the entry is selected.
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.GetEntries
TrayMenu.InsertEntry

◆ SetChecked()

void SDL::TrayEntryBase::SetChecked ( bool  checked)
inline

The entry must have been created with the TRAYENTRY_CHECKBOX flag.

Parameters
checkedtrue if the entry should be checked; false otherwise.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.GetChecked

◆ SetEnabled()

void SDL::TrayEntryBase::SetEnabled ( bool  enabled)
inline
Parameters
enabledtrue if the entry should be enabled; false otherwise.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.GetEnabled

◆ SetLabel()

void SDL::TrayEntryBase::SetLabel ( StringParam  label)
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.

Parameters
labelthe new label for the entry in UTF-8 encoding.
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.GetEntries
TrayMenu.InsertEntry
TrayEntryBase.GetLabel

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