Commit 1988e137 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add a special size for drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)

Sun Jun 24 21:34:32 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
	drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)

	* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
	with un'reffing wrong list reported by Jeff Franks.

	* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.

	* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
	for the default icon. Remove inline XPM.

	* gtk/gtkstock.h gtk/gtkiconfactory.c:
	Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
	is used for GTK_STOCK_DND, but it is a bit too small.)

	* gtk/stock-icons/stock_dnd_multiple.png
	gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.

	* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
	TRUE when starting a drag. In other cases, we are
	just observing. (#52995)

	* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
	function to set the icon for a drag from a GdkPixbuf
	or stock ID.

	* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
	Likewise, for drag sources.

	* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
	(Now should be done using the stock system.)
parent 24a325c6
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Jun 24 21:34:32 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkenums.h gtk/gtkiconfactory.c: Add a special size for
drag-and-drop GTK_ICON_SIZE_DND (Default to 32x32)
* gtk/gtkdnd.c (gtk_drag_dest_set_target_list): Fix problem
with un'reffing wrong list reported by Jeff Franks.
* gtk/gtkdnd.[ch] (_gtk_drag_{source,}dest_handle_event): _prefix.
* gtk/gtkdnd.c (gtk_drag_set_icon_default): Use GTK_STOCK_DND
for the default icon. Remove inline XPM.
* gtk/gtkstock.h gtk/gtkiconfactory.c:
Add GTK_STOCK_DND GTK_STOCK_DND_MULTIPLE (Currently, stock_new
is used for GTK_STOCK_DND, but it is a bit too small.)
* gtk/stock-icons/stock_dnd_multiple.png
gtk/stock-icons/Makefile.am: New stock icon moved from gnome-libs.
* gtk/gtkdnd.c (gtk_drag_source_event_cb): Only return
TRUE when starting a drag. In other cases, we are
just observing. (#52995)
* gtk/gtkdnd.[ch] (gtk_drag_set_icon_{stock,pixbuf}): Add
function to set the icon for a drag from a GdkPixbuf
or stock ID.
* gtk/gtkdnd.[ch] (gtk_drag_source_set_icon_{stock,pixbuf}):
Likewise, for drag sources.
* gtk/gtkdnd.h: Deprecate gtk_drag_set_default_icon.
(Now should be done using the stock system.)
Sun Jun 24 12:06:47 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch] (gtk_text_view_set_text_window_size):
......
Sun Apr 15 15:04:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtkdnd.sgml: Move some of the function docs to the
C files.
Thu Jun 21 12:31:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk-sections.txt: Update a bit.
......
......@@ -3545,9 +3545,6 @@ gtk_drag_check_threshold
gtk_drag_source_set
gtk_drag_source_set_icon
gtk_drag_source_unset
<SUBSECTION Internals>
gtk_drag_source_handle_event
gtk_drag_dest_handle_event
</SECTION>
......
......@@ -1394,6 +1394,22 @@ This function is not usually used by users.
@tree_column:
@titles:
<!-- ##### FUNCTION gtk_drag_dest_handle_event ##### -->
<para>
Internal function.
</para>
@toplevel:
@event:
<!-- ##### FUNCTION gtk_drag_source_handle_event ##### -->
<para>
Internal function.
</para>
@widget:
@event:
<!-- ##### FUNCTION gtk_editable_changed ##### -->
<para>
Causes the "changed" signal to be emitted.
......@@ -1942,6 +1958,15 @@ Creates a border around the arrows of a #GtkSpinButton. The type of border is de
@first:
@second:
<!-- ##### FUNCTION gtk_text_view_set_text_window_size ##### -->
<para>
</para>
@text_view:
@width:
@height:
<!-- ##### FUNCTION gtk_trace_referencing ##### -->
<para>
Private: print debugging information while doing a gtk_object_ref() or
......
......@@ -265,56 +265,43 @@ gtk_drag_source_set() is used.
<!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
<para>
Change the icon for a widget to a given widget. GTK+
will not destroy the icon, so if you don't want
it to persist, you should connect to the "drag_end"
signal and destroy it yourself.
</para>
@context: the context for a drag. (This must be called
with a context for the source side of a drag)
@widget: A toplevel window to use as an icon.
@hot_x: The X offset within @widget of the hotspot.
@hot_y: The Y offset within @widget of the hotspot.
@context:
@widget:
@hot_x:
@hot_y:
<!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
<para>
Sets a given pixmap as the icon for a given drag.
GTK+ retains a reference count for the arguments, and
will release them when they are no longer needed.
</para>
@context: the context for a drag. (This must be called
with a context for the source side of a drag)
@colormap: the colormap of the icon
@pixmap: the image data for the icon
@mask: the transparency mask for an image.
@hot_x: The X offset within @widget of the hotspot.
@hot_y: The Y offset within @widget of the hotspot.
@context:
@colormap:
@pixmap:
@mask:
@hot_x:
@hot_y:
<!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
<para>
Set the icon for a particular drag to the default
icon.
</para>
@context: the context for a drag. (This must be called
with a context for the source side of a drag)
@context:
<!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
<para>
Change the default drag icon. GTK+ retains a reference count for the
arguments, and will release them when they are no longer needed.
</para>
@colormap: the colormap of the icon
@pixmap: the image data for the icon
@mask: the transparency mask for an image.
@hot_x: The X offset within @widget of the hotspot.
@hot_y: The Y offset within @widget of the hotspot.
@colormap:
@pixmap:
@mask:
@hot_x:
@hot_y:
<!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
......@@ -347,16 +334,12 @@ widget. The widget must have a window.
<!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
<para>
Sets the icon that will be used for drags from a
particular widget. GTK+ retains a reference count
for the arguments, and will release them when
they are no longer needed.
</para>
@widget: a #GtkWidget
@colormap: the colormap of the icon
@pixmap: the image data for the icon
@mask: the transparency mask for an image.
@widget:
@colormap:
@pixmap:
@mask:
<!-- ##### FUNCTION gtk_drag_source_unset ##### -->
......@@ -367,21 +350,3 @@ Undo the effects of gtk_drag_source_set().
@widget: a #GtkWidget
<!-- ##### FUNCTION gtk_drag_source_handle_event ##### -->
<para>
Internal function.
</para>
@widget:
@event:
<!-- ##### FUNCTION gtk_drag_dest_handle_event ##### -->
<para>
Internal function.
</para>
@toplevel:
@event:
......@@ -62,6 +62,7 @@ looking up the icon to use for a given stock ID.
@GTK_ICON_SIZE_SMALL_TOOLBAR:
@GTK_ICON_SIZE_LARGE_TOOLBAR:
@GTK_ICON_SIZE_BUTTON:
@GTK_ICON_SIZE_DND:
@GTK_ICON_SIZE_DIALOG:
<!-- ##### FUNCTION gtk_icon_source_copy ##### -->
......
......@@ -242,16 +242,6 @@ types related to the text widget and how they work together.
@size:
<!-- ##### FUNCTION gtk_text_view_set_text_window_size ##### -->
<para>
</para>
@text_view:
@width:
@height:
<!-- ##### FUNCTION gtk_text_view_forward_display_line ##### -->
<para>
......
......@@ -39,9 +39,11 @@
#include "gdk/gdkkeysyms.h"
#include "gtkdnd.h"
#include "gtkimage.h"
#include "gtkinvisible.h"
#include "gtkmain.h"
#include "gtksignal.h"
#include "gtkstock.h"
#include "gtkwindow.h"
static GSList *drag_widgets = NULL;
......@@ -67,9 +69,17 @@ struct _GtkDragSourceSite
GdkModifierType start_button_mask;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction actions; /* Possible actions */
/* Drag icon */
GtkImageType icon_type;
union
{
GtkImagePixmapData pixmap;
GtkImagePixbufData pixbuf;
GtkImageStockData stock;
} icon_data;
GdkColormap *colormap; /* Colormap for drag icon */
GdkPixmap *pixmap; /* Icon for drag data */
GdkBitmap *mask;
/* Stored button press information to detect drag beginning */
gint state;
......@@ -349,45 +359,6 @@ static struct {
static const gint n_drag_cursors = sizeof (drag_cursors) / sizeof (drag_cursors[0]);
/* XPM */
static const char *drag_default_xpm[] = {
"32 32 3 1",
" c None",
". c #000000",
"+ c #FFFFFF",
" ",
" ",
" .. ",
" ..+. ",
" ..++.. ",
" ...++++. ",
" ...++++++.. ",
" ...+++++++++. ",
" ...+++++++++++.. ",
" ..+.++++++++++++.. ",
" .++.++++++++++++.. ",
" .+++.++++++++++++.. ",
" .++++.++++++++++++. ",
" .+++.+++++++++++++.. ",
" .++.+++++++++++++++.. ",
" .+.+++++++++++++++++.. ",
" ..+++++++++++++++++++.. ",
" ..++++++++++++++++++++. ",
" .++++++++++++++++++++.. ",
" ..+++++++++++++++++.. ",
" .++++++++++++++++.. ",
" ..+++++++++++++... ",
" .++++++++++++.. ",
" ..+++++++++.. ",
" .++++++++.. ",
" ..++++++.. ",
" .+++++.. ",
" .++.. ",
" ... ",
" .. ",
" ",
" "};
/*********************
* Utility functions *
*********************/
......@@ -983,7 +954,7 @@ gtk_drag_dest_set_target_list (GtkWidget *widget,
}
if (target_list)
gtk_target_list_ref (site->target_list);
gtk_target_list_ref (target_list);
if (site->target_list)
gtk_target_list_unref (site->target_list);
......@@ -993,7 +964,7 @@ gtk_drag_dest_set_target_list (GtkWidget *widget,
/*************************************************************
* gtk_drag_dest_handle_event:
* _gtk_drag_dest_handle_event:
* Called from widget event handling code on Drag events
* for destinations.
*
......@@ -1004,7 +975,7 @@ gtk_drag_dest_set_target_list (GtkWidget *widget,
*************************************************************/
void
gtk_drag_dest_handle_event (GtkWidget *toplevel,
_gtk_drag_dest_handle_event (GtkWidget *toplevel,
GdkEvent *event)
{
GtkDragDestInfo *info;
......@@ -1894,6 +1865,8 @@ gtk_drag_source_set (GtkWidget *widget,
else
{
site = g_new0 (GtkDragSourceSite, 1);
site->icon_type = GTK_IMAGE_EMPTY;
gtk_signal_connect (GTK_OBJECT (widget), "button_press_event",
GTK_SIGNAL_FUNC (gtk_drag_source_event_cb),
......@@ -1942,16 +1915,48 @@ gtk_drag_source_unset (GtkWidget *widget)
}
}
/*************************************************************
* gtk_drag_source_set_icon:
* Set an icon for drags from this source.
* arguments:
* colormap: Colormap for this icon
* pixmap:
* mask
* results:
*************************************************************/
static void
gtk_drag_source_unset_icon (GtkDragSourceSite *site)
{
switch (site->icon_type)
{
case GTK_IMAGE_EMPTY:
break;
case GTK_IMAGE_PIXMAP:
if (site->icon_data.pixmap.pixmap)
gdk_pixmap_unref (site->icon_data.pixmap.pixmap);
if (site->icon_data.pixmap.mask)
gdk_pixmap_unref (site->icon_data.pixmap.mask);
break;
case GTK_IMAGE_PIXBUF:
g_object_unref (G_OBJECT (site->icon_data.pixbuf.pixbuf));
break;
case GTK_IMAGE_STOCK:
g_free (G_OBJECT (site->icon_data.stock.stock_id));
break;
default:
g_assert_not_reached();
break;
}
site->icon_type = GTK_IMAGE_EMPTY;
if (site->colormap)
gdk_colormap_unref (site->colormap);
site->colormap = NULL;
}
/**
* gtk_drag_source_set_icon:
* @widget: a #GtkWidget
* @colormap: the colormap of the icon
* @pixmap: the image data for the icon
* @mask: the transparency mask for an image.
*
* Sets the icon that will be used for drags from a particular widget
* from a pixmap/mask. GTK+ retains a reference count for the
* arguments, and will release them when they are no longer needed.
* Use gtk_drag_source_set_icon_pixbuf() instead.
**/
void
gtk_drag_source_set_icon (GtkWidget *widget,
GdkColormap *colormap,
......@@ -1961,40 +1966,81 @@ gtk_drag_source_set_icon (GtkWidget *widget,
GtkDragSourceSite *site;
g_return_if_fail (widget != NULL);
g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (GDK_IS_PIXMAP (pixmap));
g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
g_return_if_fail (site != NULL);
if (site->colormap)
gdk_colormap_unref (site->colormap);
if (site->pixmap)
gdk_pixmap_unref (site->pixmap);
if (site->mask)
gdk_pixmap_unref (site->mask);
gdk_colormap_ref (colormap);
gdk_pixmap_ref (pixmap);
if (mask)
gdk_pixmap_ref (mask);
gtk_drag_source_unset_icon (site);
site->icon_type = GTK_IMAGE_PIXMAP;
site->icon_data.pixmap.pixmap = pixmap;
site->icon_data.pixmap.mask = mask;
site->colormap = colormap;
if (colormap)
gdk_colormap_ref (colormap);
}
/**
* gtk_drag_source_set_icon_pixbuf:
* @widget: a #GtkWidget
* @pixbuf: the #GdkPixbuf for the drag icon
*
* Sets the icon that will be used for drags from a particular widget
* from a #GdkPixbuf. GTK+ retains a reference count @pixbuf.
* and will release it when it is no longer needed.
**/
void
gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
GdkPixbuf *pixbuf)
{
GtkDragSourceSite *site;
site->pixmap = pixmap;
if (pixmap)
gdk_pixmap_ref (pixmap);
g_return_if_fail (widget != NULL);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
site->mask = mask;
if (mask)
gdk_pixmap_ref (mask);
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
g_return_if_fail (site != NULL);
gdk_pixbuf_ref (pixbuf);
gtk_drag_source_unset_icon (site);
site->icon_type = GTK_IMAGE_PIXBUF;
site->icon_data.pixbuf.pixbuf = pixbuf;
}
/*************************************************************
* gtk_drag_set_icon_window:
* Set a widget as the icon for a drag.
* arguments:
* context:
* widget:
* hot_x: Hot spot
* hot_y:
* results:
*************************************************************/
/**
* gtk_drag_source_set_icon_stock:
* @widget: a #GtkWidget
* @stock: the ID of the stock icon to use..
* @size: size at which to render the stock icon
*
* Sets the icon that will be used for drags from a particular to
* a stock icon.
**/
void
gtk_drag_source_set_icon_stock (GtkWidget *widget,
const gchar *stock_id)
{
GtkDragSourceSite *site;
g_return_if_fail (widget != NULL);
g_return_if_fail (stock_id != NULL);
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
g_return_if_fail (site != NULL);
gtk_drag_source_unset_icon (site);
site->icon_data.stock.stock_id = g_strdup (stock_id);
}
static void
gtk_drag_set_icon_window (GdkDragContext *context,
......@@ -2028,17 +2074,19 @@ gtk_drag_set_icon_window (GdkDragContext *context,
info->destroy_icon = destroy_on_release;
}
/*************************************************************
/**
* gtk_drag_set_icon_widget:
* Set a widget as the icon for a drag.
* arguments:
* context:
* widget:
* hot_x: Hot spot
* hot_y:
* results:
*************************************************************/
* @context: the context for a drag. (This must be called
with a context for the source side of a drag)
* @widget: a toplevel window to use as an icon.
* @hot_x: the X offset within @widget of the hotspot.
* @hot_y: the Y offset within @widget of the hotspot.
*
* Changes the icon for a widget to a given widget. GTK+
* will not destroy the icon, so if you don't want
* it to persist, you should connect to the "drag_end"
* signal and destroy it yourself.
**/