mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
dnd: Add more surface apis
The new function, gtk_drag_source_set_icon_surface, is for setting a drag source icon without using GdkPixbuf.
This commit is contained in:
parent
d3fc937b4d
commit
493f5d6b18
@ -5365,6 +5365,7 @@ gtk_drag_set_icon_default
|
||||
gtk_drag_check_threshold
|
||||
gtk_drag_source_set
|
||||
gtk_drag_source_set_icon_pixbuf
|
||||
gtk_drag_source_set_icon_surface
|
||||
gtk_drag_source_set_icon_name
|
||||
gtk_drag_source_set_icon_gicon
|
||||
gtk_drag_source_unset
|
||||
|
@ -373,6 +373,32 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
|
||||
site->image_def = gtk_image_definition_new_pixbuf (pixbuf, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_source_set_icon_surface: (method)
|
||||
* @widget: a #GtkWidget
|
||||
* @surface: the cairo surface for the drag icon
|
||||
*
|
||||
* Sets the icon that will be used for drags from a particular widget
|
||||
* from a cairo surface. GTK+ retains a reference for @surface and will
|
||||
* release it when it is no longer needed.
|
||||
*
|
||||
* Since: 3.94
|
||||
*/
|
||||
void
|
||||
gtk_drag_source_set_icon_surface (GtkWidget *widget,
|
||||
cairo_surface_t *surface)
|
||||
{
|
||||
GtkDragSourceSite *site;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
site = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
|
||||
g_return_if_fail (site != NULL);
|
||||
|
||||
g_clear_pointer (&site->image_def, gtk_image_definition_unref);
|
||||
site->image_def = gtk_image_definition_new_surface (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_source_set_icon_name: (method)
|
||||
* @widget: a #GtkWidget
|
||||
|
@ -62,6 +62,9 @@ void gtk_drag_source_add_uri_targets (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
|
||||
GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
void gtk_drag_source_set_icon_surface (GtkWidget *widget,
|
||||
cairo_surface_t *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_source_set_icon_name (GtkWidget *widget,
|
||||
const gchar *icon_name);
|
||||
|
Loading…
Reference in New Issue
Block a user