[gtkmm] Purpose of Gtk::TargetEntry



I have a question specific to Drag and Drop.  I've checked out the drag and
drop examples as well as the documentation.  With regard to TargetEntry, the
documentation states that:

Things are dragged from sources to be dropped on destinations. Each source
and destination has information about the data formats that it can send or
receive, provided by Gtk::TargetEntry items. A drop destination will only
accept a dragged item if they both share a compatible Gtk::TargetEntry item.
Appropriate signals will then be emitted, telling the signal handlers which
Gtk::TargetEntry was used.

The drag and drop example uses this:

//Targets:
m_listTargets.push_back( Gtk::TargetEntry("STRING", 0, TARGET_STRING) );
m_listTargets.push_back( Gtk::TargetEntry("text/plain", 0, TARGET_STRING) );
m_listTargets.push_back( Gtk::TargetEntry("application/x-rootwin-drop", 0,
TARGET_ROOTWIN) );

It sounds like the source widget's target entries set in the drag_source_set
call are being matched to the drop site's target entries set in the
drag_dest_set call, and that the first string entry needs to match in order
for the dest widget to accept the drop. (Have I got all that correct in my
mind?)

If that's the case, would it make sense for sources to list their
application class name for example, and have the destinations with the
larger list of names of what they can accept?

Just seems like the example given leaves some of this aspect of D&D rather
ambiguous, and I believe that there is some real powerful filtering
capabilities in there, just need a little more info. to make use of them.

Thanks for the help.

	Erik.



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