RE: [gtkmm] Purpose of Gtk::TargetEntry



Ohrnberger, Erik wrote:
> 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?)

Yes, but it doesn't need to be the "first" one.
 
> 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?

I don't understand. Do you meant that it should be "murrayapp" instead of
"STRING"? Or in addition to the existing ones?

> 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.

I'm fairly sure it can be better, but I'm not sure what you are suggesting.

By the way, it is already a bit nicer in gtkmm 2.4 because it uses more C++
types there and has more convenient method overloads.

Murray Cumming
www.murrayc.com
murrayc usa net



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