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

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

Inheritance diagram for SDL::TrayEntryRef:
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 from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< T > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
- Public Member Functions inherited from SDL::Resource< SDL_TrayEntry * >
constexpr Resource (SDL_TrayEntry * resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< SDL_TrayEntry * > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr operator value_type () const
 Converts back to underlying type.
 
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 const SDL_TrayEntry * operator-> () const
 Access to fields.
 
constexpr SDL_TrayEntry * operator-> ()
 Access to fields.
 

Static Public Member Functions

static void reset (SDL_TrayEntry *resource)
 Removes a tray entry.
 

Additional Inherited Members

- Public Types inherited from SDL::Resource< SDL_TrayEntry * >
using value_type = SDL_TrayEntry *
 The raw resource type.
 

Detailed Description

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

Member Function Documentation

◆ Click()

void SDL::TrayEntryRef::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::TrayEntryRef::CreateSubmenu ( )
inline

This should be called at most once per tray entry.

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

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
TrayEntryRef.GetSubmenu
TrayMenu.GetParentEntry

◆ GetChecked()

bool SDL::TrayEntryRef::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
TrayEntryRef.SetChecked

◆ GetEnabled()

bool SDL::TrayEntryRef::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
TrayEntryRef.SetEnabled

◆ GetLabel()

const char * SDL::TrayEntryRef::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
TrayEntryRef.SetLabel

◆ GetParent()

TrayMenu SDL::TrayEntryRef::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::TrayEntryRef::GetSubmenu ( )
inline

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

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

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
TrayEntryRef.CreateSubmenu

◆ reset()

static void SDL::TrayEntryRef::reset ( SDL_TrayEntry *  resource)
inlinestatic
Parameters
resourceThe entry to be deleted.
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() [1/2]

void SDL::TrayEntryRef::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::TrayEntryRef::SetCallback ( TrayCB  callback)
inline
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::TrayEntryRef::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
TrayEntryRef.GetChecked

◆ SetEnabled()

void SDL::TrayEntryRef::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
TrayEntryRef.GetEnabled

◆ SetLabel()

void SDL::TrayEntryRef::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
TrayEntryRef.GetLabel

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