sdlSetTrayEntryLabel function tray

void sdlSetTrayEntryLabel(
  1. Pointer<SdlTrayEntry> entry,
  2. String? label
)

Sets the label of an entry.

An entry cannot change between a separator and an ordinary entry; that is, it is not possible to set a non-NULL label on an entry that has a NULL label (separators), or to set a NULL label to an entry that has a non-NULL label. The function will silently fail if that happens.

\param entry the entry to be updated. \param label the new label for the entry in UTF-8 encoding.

\threadsafety This function should be called on the thread that created the tray.

\since This function is available since SDL 3.2.0.

\sa SDL_GetTrayEntries \sa SDL_InsertTrayEntryAt \sa SDL_GetTrayEntryLabel

extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)

Implementation

void sdlSetTrayEntryLabel(Pointer<SdlTrayEntry> entry, String? label) {
  final sdlSetTrayEntryLabelLookupFunction = _libSdl
      .lookupFunction<
        Void Function(Pointer<SdlTrayEntry> entry, Pointer<Utf8> label),
        void Function(Pointer<SdlTrayEntry> entry, Pointer<Utf8> label)
      >('SDL_SetTrayEntryLabel');
  final labelPointer = label != null ? label.toNativeUtf8() : nullptr;
  final result = sdlSetTrayEntryLabelLookupFunction(entry, labelPointer);
  calloc.free(labelPointer);
  return result;
}