Drag'n Drop



Hi you,

I'm playing with "Drag and Drop", and works fine, but, I don't know how to
change the icon (and cursor) attached to pointer when "drag" begins.
I'm using this code:

 /* Drag Source */
 gtk_drag_source_set(wid, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
        target_table, 1, GDK_ACTION_LINK|GDK_ACTION_COPY);

 gtk_signal_connect(GTK_OBJECT(wid), "drag_data_get", GTK_SIGNAL_FUNC(dragFunc),
NULL);

 pixm = gdk_pixmap_colormap_create_from_xpm_d(NULL,
gtk_widget_get_colormap(wid), &mask, NULL, drag);

 gtk_drag_source_set_icon(wid, gtk_widget_get_colormap(wid), pixm, mask);

    ...

 /* Drag Dest (Drop) */
 gtk_drag_dest_set(wid, GTK_DEST_DEFAULT_ALL,
        target_table, 1, GDK_ACTION_LINK);
 gtk_signal_connect(GTK_OBJECT(wid), "drag_data_received",
GTK_SIGNAL_FUNC(dropFunc), NULL);

...


All works fine, but the icon is the default icon, not the mine (I've checked the
pixm and it's OK).

What more is needed for changing the icon ?

Another question: It's possible to "gtk_selection_data_set()" (in dragFunc()) a
pointer to something ?


Thanks,


            - José Miguel





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