Re: Equivalent to gtk_drag_get_source_widget()?



On Sunday 06 November 2005 17:17, Matthias Kaeppler wrote:
> Hi,
>
> in a drag and drop signal handler I see no way to figure out which
> widgets are the source and target of the drag and drop operation.
> Gdk::DragContext can only return pointers to the source and target
> /windows/ but that's of little help if one or both aren't windows.
>
> I noticed a function in the GTK+ reference manual called
> gtk_drag_get_source_widget() which returns a pointer to the source
> /widget/, which is what I would need, but I can't find an equivalent
> function in gtkmm.
>
> Is there any? And is there also some function to retrieve the target
> widget of a dnd operation?

The drag_data_received signal in GTK+ will pass the target widget as its first 
paramater.  The gtkmm equivalent does not, but there is a good reason for 
that, namely that the receiving object knows what it is.  The 
Gtk::Widget::on_drag_data_received() method will be called on the object 
which received the drag.

You should not really need to know either what object the data was dragged 
from either.  First, it may not be in the same address space as the process 
receiving the drag (gtk_drag_get_source_widget() will return NULL in that 
case, and where it is in the same address space you can store it in a 
variable assessible to both widgets if you really need it).  Secondly, if you 
want to notify the source object that the drag has been completed there are 
signals available for that, via gtk_drag_finish() (or the gtkmm equivalent).

Chris




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