[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-dnd-intro

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 12月 6日 (木) 09:12:42 JST


-------------------------
REMOTE_ADDR = 70.49.50.122
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dnd-intro
-------------------------
@@ -30,7 +30,18 @@
 
 The source locations and/or widgets are those in which the objects to be dragged originally reside, and the destinations are places, widgets or object onto which you wish to drop the dragged objects. These widgets or objects may be different, for instance you may plan to drag an icon from an icon view onto some other viewing area, perhaps a canvas or a text widget. Or they can be one and the same widget and indeed the same object, as is the case when you are reordering rows in a tree view, or items in the text view. In the previous chapter 9, (section: 9.6.2.2), we have already seen our toolbar 'dnd-toolbox.rb' example in which the source and destination are of the same type namely Gtk::Frame, but they are two different objects.
 
-Normally, you have to set up source and destination widgets. There exists a plethora of methods to accomplish this. With the exception of the widgets that support dnd by design, in which you can choose the default dnd behaviour with almost no extra work, you need to register a widget as source or destination or both. When setting up a widget as source or destination widget, you have to identify the drag-object(s), or as we mentioned in previous paragraph, the 'target(s)'. During this registration you also need to specify the((*action*))the dnd system is to take for the item being dragged. This action is defined as a constant in Gdk::DragContext#GdkDragAction and conveys to the Gtk system whether the item is to be copied, moved, removed from the source, and how to react at the destination at the time the drop occurs. Following are few API examples to show different methods used to register source and destination widgets, and the kind of arguments you may be required to supply
  when registering these widgets.
+:Note:
+    All widgets which have their own Gdk::Window can be set as source or destination widgets. A widget that contains its own Gdk::Window must not have Gtk::Widget::NO_WINDOW flag set. You can check for this flag with the Gtk::Widget#no_window? method. (Note that this method returns true if the widget (the receiver object) does not contain the Gdk::Window.)
+
+:There Are Three Different Source And Destination Set-Up Scenarios:
+
+    Normally, you have to set up source and destination widgets. There exists a plethora of methods to accomplish this. However, there are three different situations or circumstances in which you need to set up either source or destination widget for drag-and-drop management. Depending on the combination of the source and destination drag-and-drop widgets you are using in your application, there are many ways to set up (or, as you will soon see, perhaps not at all set up) these source and destination widgets.
+
+    With the exception of the widgets that support dnd by design, (1) for some of which you may simply start using the native dnd facilities without ever setting either the source or the destination widgets (for instance Gtk::TextView is such a widget), and (2) in others, such as Gtk::IconView, or Gtk::TreeView, you can use the default dnd behaviour with almost no extra programming work, (3) for widgets without such native drag-and-drop support you really need to register those widgets as source or destination or both. 
+
+    We hope to look at all of these three situations.  
+
+To explain what are the source and destination drag-and-drop widgets and related issues are, it is best to study how to set these up for widgets without the native dnd support. When setting up such a widget without the native dnd support as source or destination widget, you have to identify the drag-object(s), or as we mentioned in previous paragraph, the 'target(s)'. During this registration you also need to specify the((*action*))the dnd system is to take for the item being dragged. This action is defined as a constant in Gdk::DragContext#GdkDragAction and conveys to the Gtk system whether the item is to be copied, moved, removed from the source, and how to react at the destination at the time the drop occurs. Following are few API examples to show different methods used to register source and destination widgets, and the kind of arguments you may be required to supply when registering these widgets.
 
 You use Gtk::Drag.source_set and Gtk::Drag.dest_set module methods, when source and destination widgets are arbitrary Gtk objects with their own Gdk::Window:
 




ruby-gnome2-cvs メーリングリストの案内
Back to archive index