Re: [gtk-list] drag & drop with clist
- From: Renaud <renaud chaillat isr thomson-csf com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] drag & drop with clist
- Date: Fri, 05 May 2000 13:37:01 +0200
There might be other solutions, but this one works :
Connect a callback to the 'drag-data-get' signal emitted by the clist
widget, and set the data associated with the drag in this callback.
To set the data you may use the clist selection.
It will look like this :
void
dnd_cb_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
gpointer data)
{
...
clist = GTK_CLIST(widget);
switch(info) /* check the type of data understood by the target of
the drop */
{
case LIST :
gtk_selection_data_set (selection_data,
selection_data->target /* type of selection data */,
8 /* format : num bits/unit */,
clist->selection /* data pointer, a GList* here */,
strlen(clist->selection) /* length */);
break;
case STRING :
...
break;
case TEXT_URI_LIST :
...
}
}
LIST, STRING, and so on must figure in your GtkTargetEntry array.
On the target side you'll use a callback to the 'drag-data-received'
signal and get a GtkSelectionData* parameter.
Hope this helps,
Renaud
Paul Coates wrote:
>
> I want to make a clist the drag source for a drag and drop
> operation, I have used gtk_drag_source_set and can even drop in another
> window setup as a drop dest but how can I find out what item in the
> clist
> I dragged from ??? I have not had much luck finding examples of drag and
> drop code and this one has been driving me crazy.
>
> Paul
>
> Paul A Coates, Computing Service Web: http://xander.ncl.ac.uk/~npac/
> Newcastle University, Claremont Road, Email: Paul.Coates@ncl.ac.uk
> Newcastle Upon Tyne, NE1 7RU, England Tel: +44-191-222-7986
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]