Class (GI Struct)

Gtk-3.0GtkSelectionDataAbstract

Index

Constructors

Properties

Methods

  • Retrieves the raw data of the selection along with its length.

    Returns Uint8Array

    the raw data of the selection

  • Retrieves the format of the selection.

    Returns number

    the format of the selection.

  • Retrieves the length of the raw data of the selection.

    Returns number

    the length of the data of the selection.

  • Gets the contents of selection_data as an array of targets. This can be used to interpret the results of getting the standard TARGETS target that is always supplied for any selection.

    Returns [boolean, Gdk.Atom[]]

    true if selection_data contains a valid array of targets, otherwise false.

  • Gets the contents of the selection data as a UTF-8 string.

    Returns string

    if the selection data contained a recognized text type and it could be converted to UTF-8, a newly allocated string containing the converted text, otherwise null. If the result is non-null it must be freed with g_free().

  • Gets the contents of the selection data as array of URIs.

    Since 3.24.37, this may involve using the FileTransfer portal to send files between sandboxed apps.

    Returns string[]

    if the selection data contains a list of URIs, a newly allocated null-terminated string array containing the URIs, otherwise null. If the result is non-null it must be freed with g_strfreev().

  • Stores new data into a Gtk.SelectionData object. Should only be called from a selection handler callback. Zero-terminates the stored data.

    Parameters

    • type: Gdk.Atom

      the type of selection data

    • format: number

      format (number of bits in a unit)

    • data: string | Uint8Array<ArrayBufferLike>

      pointer to the data (will be copied)

    Returns void

  • Sets the contents of the selection from a UTF-8 encoded string. The string is converted to the form determined by selection_data->target.

    Parameters

    • str: string

      a UTF-8 string

    • len: number

      the length of str, or -1 if str is nul-terminated.

    Returns boolean

    true if the selection was successfully set, otherwise false.

  • Sets the contents of the selection from a list of URIs. The string is converted to the form determined by selection_data->target.

    Since 3.24.37, this may involve using the FileTransfer portal to send files between sandboxed apps.

    Parameters

    • uris: string[]

      a null-terminated array of strings holding URIs

    Returns boolean

    true if the selection was successfully set, otherwise false.

  • Given a Gtk.SelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide a GdkPixbuf.Pixbuf.

    Parameters

    • writable: boolean

      whether to accept only targets for which GTK+ knows how to convert a pixbuf into the format

    Returns boolean

    true if selection_data holds a list of targets, and a suitable target for images is included, otherwise false.

  • Given a Gtk.SelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide text.

    Returns boolean

    true if selection_data holds a list of targets, and a suitable target for text is included, otherwise false.

  • Given a Gtk.SelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide a list or URIs.

    Returns boolean

    true if selection_data holds a list of targets, and a suitable target for URI lists is included, otherwise false.