dnd internals questions.



I want to change the drag icon used by clist for drags.

I noticed only a few of the widget implement drag_begin. 
This seems to be where the icon is set if is not to be the
default. I am not sure I understand exactly how the "no icon"
mode of clist works. Anyone have a clear idea how this works?

I was able to get the drag icons to work by adding the following
to gtkclist.c:gtk_clist_drag_begin

  if (GTK_CLIST_USE_DRAG_ICONS (clist))
    {
      /*
	get the site pixmap if there is one 
      */


      struct /* _GtkDragSourceSite  */
      {
	GdkModifierType    start_button_mask;
	GtkTargetList     *target_list;        /* Targets for drag data */
	GdkDragAction      actions;            /* Possible actions */
	GdkColormap       *colormap;	         /* Colormap for drag icon */
	GdkPixmap         *pixmap;             /* Icon for drag data */
	GdkBitmap         *mask;

	/* Stored button press information to detect drag beginning */
	gint               state;
	gint               x, y;
      } *site;

      site = gtk_object_get_data ( GTK_OBJECT ( widget ),
"gtk-site-data" );

      if ( site != NULL &&
	   site -> colormap && site -> pixmap &&
	   site -> mask )
	{
	  gtk_drag_source_set_icon ( widget, 
				     site -> colormap,
				     site -> pixmap,
				     site -> mask);
	}
      else 
	{
	  /* if there was no pixmap, use the default */
	  gtk_drag_set_icon_default (context);
	}
    }

The thing that bothers me is that it seems that GtkDragSourceSite was 
intended to be private to gtkdnd.c. Is there a better way to implement 
this?

Also, is it possible to control the drag icon used by which modifiers 
( ctrl, alt, shift ) are held down when the drag begins?

thanks,
Todd.
-- 
   | Todd Dukes                      E-MAIL:  tdukes@ibmoto.com |
   | Motorola Somerset                  Phone:   (512) 424-8008 |
   | 6200 Bridgepoint Parkway Building #4 MS OE70               |
   | Austin, Texas 78730                                        |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]