Re: Equivalent to gtk_drag_get_source_widget()?



On Wednesday 09 November 2005 06:40, Matthias Kaeppler wrote:
> Chris Vine wrote:
> > 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.
>
> True.
>
> > You should not really need to know either what object the data was
> > dragged from either.
>
> I do, because I need some form of this check:
>
> if (source == target)
>     don't do anything;
> else
>     issue some operation
>
> This is to prevent the user from issueing an operation on the same
> widget when it's only allowed from one widget to another.

This is only a problem if the same widget is set to be a drag source and a 
drag destination.  Is that the case?  You can check it in other ways anyway, 
such as by reference to the data supplied by the drag_data_get() signal 
handler (GTK+) or the signal_drag_data_get() signal or on_drag_data_get() 
method (gtkmm).

You might find chapter 18 of the GTK+ tutorial helpful at 
http://www.gtk.org/tutorial/c1920.html .  (It is directly translatable to 
gtkmm).

Chris




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