1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2000-2010 AdaCore                    -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  Like all modern GUI toolkits, GtkAda has a full support for drag-and-drop 
  31. --  operations. This is a mechanism for interactively transferring data between 
  32. --  two widgets, either in the same application or in two different 
  33. --  applications. The user clicks on a widget (called a "drag source"), and, 
  34. --  while keeping the mouse button pressed, moves it to another widget, where 
  35. --  the mouse button is released (this other widget is called a "drop site"). 
  36. --  As a result, and if both widgets can handle the same type of data, some 
  37. --  data is either copied or moved to this new widget. 
  38. -- 
  39. --  This is a very intuitive way, in some cases, to enhance the usability of 
  40. --  your application, although you should carefully consider whether this 
  41. --  should be used or not. 
  42. -- 
  43. --  GtkAda supports several drag-and-drop protocols, so as to be able to 
  44. --  communicate with the maximum number of applications. These protocols are 
  45. --  Xdnd and Motif. 
  46. -- 
  47. --  Below is a summary of what is needed to add drag-and-drop capabilities to 
  48. --  your application. We highly recommend that you look at, and understand, 
  49. --  the example in testgtk (create_dnd.adb), before using these features in 
  50. --  your own application. 
  51. -- 
  52. --  See also the package Gtk.Selection, that contains some lower subprograms 
  53. --  and data types that are used when implementing drag-and-drop. 
  54. -- 
  55. --  - Defining a widget as a possible drag source 
  56. -- 
  57. --  You need to call Source_Set, specifying which mouse buttons can activate 
  58. --  the drag, which types of data will be given, and which kind of action 
  59. --  will be performed. 
  60. --  You then need to connect to the signal "drag_data_get", that will be 
  61. --  emitted when the user has dropped the item and GtkAda needs to find the 
  62. --  data. You must call Selection_Data_Set in the handler to set the actual 
  63. --  data. 
  64. --  You can also connect the widget to "drag_data_delete", which will be 
  65. --  called whenever the data set for the selection is no longer required and 
  66. --  should be deleted. The signal will be emitted only if the drop site 
  67. --  requests it, or if the selected action for the drag-and-drop operation 
  68. --  was Action_Move. It will not be called automatically for an Action_Copy. 
  69. --  Note that the callback might be called several times, if for instance this 
  70. --  was an Action_Move, and the drop site requires explicitly to delete the 
  71. --  data in its call to Finish. 
  72. -- 
  73. --  - Defining a widget as a possible drop site 
  74. -- 
  75. --  You need to call Dest_Set, specifying which types of Data are accepted 
  76. --  by the widget, which actions are recognized, and whether you accept drops 
  77. --  from external applications. 
  78. --  You also need to connect to "drag_data_received", that will be emitted 
  79. --  when the user has dropped some data on the widget. The handler should 
  80. --  call Finish, to warn the source widget that the drag and drop operation 
  81. --  is finished, and whether it was successful or not. 
  82. --  </description> 
  83. --  <c_version>2.16.6</c_version> 
  84. --  <group>Inter-Process communication</group> 
  85. --  <testgtk>create_dnd.adb</testgtk> 
  86.  
  87. with Gdk.Bitmap; 
  88. with Gdk.Color; 
  89. with Gdk.Dnd;        use Gdk.Dnd; 
  90. with Gdk.Event; 
  91. with Gdk.Pixmap; 
  92. with Gdk.Pixbuf; 
  93. with Gdk.Types; 
  94. with Gdk.Window; 
  95.  
  96. with Gtk.Widget; 
  97. with Gtk.Selection;  use Gtk.Selection; 
  98.  
  99. package Gtk.Dnd is 
  100.  
  101.    ------------------- 
  102.    -- Dest_Defaults -- 
  103.    ------------------- 
  104.  
  105.    type Dest_Defaults is new Integer; 
  106.    --  Specify the various types of action that will be taken on behalf of the 
  107.    --  user for a drag destination site. 
  108.  
  109.    Dest_No_Default        : constant Dest_Defaults; 
  110.    --  No default behavior is provided for the drop site, this is your own 
  111.    --  responsabily. You need to handler the "drag_drop" signal yourself. 
  112.  
  113.    Dest_Default_Motion    : constant Dest_Defaults; 
  114.    --  If set for a widget, GtkAda, during a drag over this widget will check 
  115.    --  if the drag matches this widget's list of possible targets and 
  116.    --  actions. gdk_drag_status is called as appropriate. 
  117.  
  118.    Dest_Default_Highlight : constant Dest_Defaults; 
  119.    --  If set for a widget, GtkAda will draw a highlight on this widget as 
  120.    --  long as a drag is over this widget and the wiget drag format and action 
  121.    --  is acceptable. 
  122.  
  123.    Dest_Default_Drop      : constant Dest_Defaults; 
  124.    --  If set for a widget, when a drop occurs, GtkAda+ will check if the drag 
  125.    --  matches this widget's list of possible targets and actions. If so, 
  126.    --  GtkAda will call Get_Data on behalf of the widget. Whether or not 
  127.    --  the drop is succesful, GtkAda will call Drag_Finish. If the 
  128.    --  action was a move, then if the drag was succesful, then True will be 
  129.    --  passed for the delete parameter to Finish. 
  130.  
  131.    Dest_Default_All       : constant Dest_Defaults; 
  132.    --  If set, specifies that all default actions should be taken. 
  133.  
  134.    ------------------------------------------ 
  135.    -- Setting up a widget as a destination -- 
  136.    ------------------------------------------ 
  137.  
  138.    procedure Dest_Set 
  139.      (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  140.       Flags   : Dest_Defaults := Dest_No_Default; 
  141.       Targets : Target_Entry_Array := Any_Target_Entry; 
  142.       Actions : Drag_Action := Action_Any); 
  143.    --  Set a widget as a potential drop destination. 
  144.    -- 
  145.    --  Flags specifies what action GtkAda should take on behalf of a widget for 
  146.    --  drops onto that widget. The Targets and Actions fields are used only 
  147.    --  if Dest_Default_Motion or Dest_Default_Drop are given. 
  148.    -- 
  149.    --  Targets indicates the drop types that Widget accepts. If no item from 
  150.    --  Targets matches the list of targets emitted by the source (as set in 
  151.    --  Source_Set), then the drop will be considered illegal and refused. 
  152.    -- 
  153.    --  Actions is a bitmask of possible actions for a drop onto Widget. At 
  154.    --  least of the actions must be in common with what was set for the source 
  155.    --  in Source_Set, or the drop is considered illegal. 
  156.  
  157.    --  if Flags = Dest_No_Default, no default behavior is provided, and 
  158.    --  Targets and Actions are simply ignored. 
  159.  
  160.    procedure Dest_Set_Proxy 
  161.      (Widget          : access Gtk.Widget.Gtk_Widget_Record'Class; 
  162.       Proxy_Window    : Gdk.Window.Gdk_Window; 
  163.       Protocol        : Drag_Protocol; 
  164.       Use_Coordinates : Boolean); 
  165.    --  Set this widget as a proxy for drops to another window. 
  166.    --  All drag events on Widget will be forwarded to Proxy_Window. 
  167.    --  Protocol is the drag protocol that Proxy_Window accepts. You can use 
  168.    --  Gdk.Drag.Get_Protocol to determine this. 
  169.    --  If Use_Coordinates is True, send the same coordinates to the destination 
  170.    --  because it is an embedded subwindow. 
  171.  
  172.    procedure Dest_Unset 
  173.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  174.    --  Clear information about a drop destination set with Dest_Set. The 
  175.    --  widget will no longer receive notification of drags. 
  176.  
  177.    procedure Dest_Set_Target_List 
  178.      (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class; 
  179.       Target_List : Gtk.Selection.Target_List); 
  180.    function Dest_Get_Target_List 
  181.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return Target_List; 
  182.    --  Sets the target types that this widget can accept from drag-and-drop. 
  183.    --  The widget must first be made into a drag destination with 
  184.    --  Dest_Set. 
  185.  
  186.    procedure Dest_Add_Image_Targets 
  187.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  188.    procedure Dest_Add_Text_Targets 
  189.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  190.    procedure Dest_Add_Uri_Targets 
  191.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  192.    --  Add the image/text/URI targets supported by Gtk_Selection to the target 
  193.    --  list of the drag destination. The targets are added with Info = 0. If 
  194.    --  you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and 
  195.    --  Dest_Set_Target_List 
  196.  
  197.    function Dest_Find_Target 
  198.      (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class; 
  199.       Context     : Gdk.Dnd.Drag_Context; 
  200.       Target_List : Gtk.Selection.Target_List) return Gdk.Types.Gdk_Atom; 
  201.    --  Looks for a match between the targets set for context and the 
  202.    --  Target_List, returning the first matching target, otherwise returning 
  203.    --  GDK_NONE. Target_List should usually be the return value from 
  204.    --  Dest_Get_Target_List, but some widgets may have different valid targets 
  205.    --  for different parts of the widget; in that case, they will have to 
  206.    --  implement a drag_motion handler that passes the correct target list to 
  207.    --  this function. 
  208.  
  209.    function Dest_Get_Track_Motion 
  210.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) 
  211.       return Boolean; 
  212.    procedure Dest_Set_Track_Motion 
  213.      (Widget       : access Gtk.Widget.Gtk_Widget_Record'Class; 
  214.       Track_Motion : Boolean); 
  215.    --  Control whether the widget emits drag-motion and drag-leave 
  216.    --  events regardless of the targets and the Dest_Default_Motion 
  217.    --  flag. 
  218.    -- 
  219.    --  This may be used when a widget wants to do generic 
  220.    --  actions regardless of the targets that the source offers. 
  221.  
  222.    ------------------------------------- 
  223.    -- Setting up a widget as a source -- 
  224.    ------------------------------------- 
  225.  
  226.    procedure Source_Set 
  227.      (Widget            : access Gtk.Widget.Gtk_Widget_Record'Class; 
  228.       Start_Button_Mask : Gdk.Types.Gdk_Modifier_Type; 
  229.       Targets           : Target_Entry_Array; 
  230.       Actions           : Drag_Action); 
  231.    --  Set up a widget so that GtkAda will start a drag operation when the 
  232.    --  user clicks and drags on the widget. The widget must have a window. 
  233.    -- 
  234.    --  Targets is the list of targets that the drag can provide. The first 
  235.    --  possible target accepted by the drop site will be used. For instance, 
  236.    --  if Targets contains "text/plain" and "text/url", and the drop site only 
  237.    --  accepts "text/url", this will be the one used. However, if the drop site 
  238.    --  also accepts "text/plain", the latter will be prefered. 
  239.    -- 
  240.    --  Widget needs to be able to convert the data to any of the types in 
  241.    --  Target, as any of them might be requested by the drop site. 
  242.    -- 
  243.    --  Actions is a list of possible actions for drags from Widget. At least 
  244.    --  one of the actions must be in common with the drop site for the 
  245.    --  drag-and-drop operation to succeed. 
  246.  
  247.    procedure Source_Unset (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  248.    --  Undo the effects of Source_Set 
  249.  
  250.    procedure Source_Set_Target_List 
  251.      (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class; 
  252.       Target_List : Gtk.Selection.Target_List); 
  253.    function Source_Get_Target_List 
  254.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return Target_List; 
  255.    --  Changes the target types that this widget offers for drag-and-drop. The 
  256.    --  widget must first be made into a drag source with Source_Set. 
  257.  
  258.    procedure Source_Add_Image_Targets 
  259.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  260.    procedure Source_Add_Text_Targets 
  261.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  262.    procedure Source_Add_Uri_Targets 
  263.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  264.    --  Add the writable image/text/URI targets supported by Gtk_Selection to 
  265.    --  the target list of the drag source. The targets are added with Info = 0. 
  266.    --  If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, 
  267.    --  and Source_Set_Target_List 
  268.    --  Widget: a #GtkWidget that's is a drag source 
  269.  
  270.    procedure Source_Set_Icon 
  271.      (Widget   : access Gtk.Widget.Gtk_Widget_Record'Class; 
  272.       Colormap : Gdk.Color.Gdk_Colormap; 
  273.       Pixmap   : Gdk.Pixmap.Gdk_Pixmap; 
  274.       Mask     : Gdk.Bitmap.Gdk_Bitmap); 
  275.    procedure Source_Set_Icon_Pixbuf 
  276.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class; 
  277.       Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf); 
  278.    procedure Source_Set_Icon_Stock 
  279.      (Widget   : access Gtk.Widget.Gtk_Widget_Record'Class; 
  280.       Stock_Id : String); 
  281.    procedure Source_Set_Icon_Name 
  282.      (Widget    : access Gtk.Widget.Gtk_Widget_Record'Class; 
  283.       Icon_Name : String); 
  284.    --  Set the icon that will be used for drags from a particular widget. 
  285.    --  GtkAda retains a reference count for the arguments, and will release 
  286.    --  them when they are no longer needed. 
  287.  
  288.    --------------------------------- 
  289.    -- The drag-and-drop operation -- 
  290.    --------------------------------- 
  291.  
  292.    procedure Finish 
  293.      (Context : Drag_Context; 
  294.       Success : Boolean; 
  295.       Del     : Boolean; 
  296.       Time    : Guint32 := 0); 
  297.    --  Inform the drag source that the drop is finished, and that the data of 
  298.    --  the drag will no longer be required. 
  299.    --  Success should indicate whether the drop was successful. 
  300.    --  Del should be set to True if the source should delete the original 
  301.    --  data (this should be True for a move). 
  302.  
  303.    procedure Get_Data 
  304.      (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  305.       Context : Drag_Context; 
  306.       Target  : Gdk.Types.Gdk_Atom; 
  307.       Time    : Guint32 := 0); 
  308.    --  Get the data associated with a drag. When the data is received or the 
  309.    --  retrieval fails, GtkAda will emit a "drag_data_received" 
  310.    --  signal. Failure of the retrieval is indicated by the length field of 
  311.    --  the selection_data signal parameter being negative. However, when 
  312.    --  Get_Data is called implicitely because the Drag_Default_Drop was set, 
  313.    --  then the widget will not receive notification of failed drops. 
  314.    -- 
  315.    --  Target is the target (form of the data) to retrieve. 
  316.    --  Time is a timestamp to retrive the data, and will be given to 
  317.    --  "drag_data_motion" or "drag_data_drop" signals. 
  318.  
  319.    function Get_Source_Widget 
  320.      (Context : Drag_Context) return Gtk.Widget.Gtk_Widget; 
  321.    --  Determine the source widget for a drag. 
  322.    --  If the drag is occuring within a single application, this function 
  323.    --  returns the source widget. Otherwise, it returns null. 
  324.  
  325.    procedure Highlight (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  326.    --  Draw a highlight around a widget. 
  327.  
  328.    procedure Unhighlight (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  329.    --  Remove a highlight set by Highlight. 
  330.  
  331.    function Drag_Begin 
  332.      (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  333.       Targets : Target_List; 
  334.       Actions : Drag_Action; 
  335.       Button  : Gint; 
  336.       Event   : Gdk.Event.Gdk_Event) return Drag_Context; 
  337.    --  Initiate a drag on the source side. The function only needs to be used 
  338.    --  when the application is starting drags itself, and is not needed when 
  339.    --  Source_Set is used. 
  340.    --  Targets is the list of targets (data formats) in which the source can 
  341.    --  provide the data. 
  342.    --  Actions is a bitmask of the allowed drag actions for this drag. 
  343.    --  Button is the button the user clicked to start the drag. 
  344.    --  Event is the event that triggered the start of the drag. 
  345.  
  346.    function Check_Threshold 
  347.      (Widget    : access Gtk.Widget.Gtk_Widget_Record'Class; 
  348.       Start_X   : Gint; 
  349.       Start_Y   : Gint; 
  350.       Current_X : Gint; 
  351.       Current_Y : Gint) return Boolean; 
  352.    --  Checks to see if a mouse drag starting at (Start_X, Start_Y) and ending 
  353.    --  at (Current_X, Current_Y) has passed the GTK drag threshhold, and thus 
  354.    --  should trigger the beginning of a drag-and-drop operation. 
  355.    --  Return True if the drag threshold has been passed. 
  356.  
  357.    ----------- 
  358.    -- Icons -- 
  359.    ----------- 
  360.  
  361.    procedure Set_Icon_Widget 
  362.      (Context : Drag_Context; 
  363.       Widget  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  364.       Hot_X   : Gint; 
  365.       Hot_Y   : Gint); 
  366.    --  Change the icon for a drag. 
  367.    --  GtkAda will not destroy the icon, so if you don't want it to persist, 
  368.    --  you should connect to the "drag_end" signal and destroy it yourself. 
  369.    --  Context is the reference to the current drag operation. 
  370.    --  Widget is the toplevel window to use as an icon. (Hot_X, Hot_Y) is the 
  371.    --  coordinates of the hot point (that will be just under the mouse) within 
  372.    --  Widget. 
  373.  
  374.    procedure Set_Icon_Pixmap 
  375.      (Context  : Drag_Context; 
  376.       Colormap : Gdk.Color.Gdk_Colormap; 
  377.       Pixmap   : Gdk.Pixmap.Gdk_Pixmap; 
  378.       Mask     : Gdk.Bitmap.Gdk_Bitmap; 
  379.       Hot_X    : Gint; 
  380.       Hot_Y    : Gint); 
  381.    --  Sets a given pixmap as the icon for a given drag. GtkAda retains a 
  382.    --  reference count for the arguments, and will release them when they are 
  383.    --  no longer needed. 
  384.    --  (Hot_X, Hot_Y) is the coordinates of the hotspot within Pixmap. 
  385.  
  386.    procedure Set_Icon_Default (Context : Drag_Context); 
  387.    --  Set the icon for a particular drag to the default icon. 
  388.    --  This must be called with a context for the source side of a drag. 
  389.  
  390.    procedure Set_Icon_Pixbuf 
  391.      (Context : Drag_Context; 
  392.       Pixbuf  : Gdk.Pixbuf.Gdk_Pixbuf; 
  393.       Hot_X   : Gint; 
  394.       Hot_Y   : Gint); 
  395.    --  Sets Pixbuf as the icon for a given drag. 
  396.    --  Context: the context for a drag. (This must be called 
  397.    --             with a  context for the source side of a drag) 
  398.    --  Pixbuf: the Gdk_Pixbuf to use as the drag icon. 
  399.    --  Hot_x: the X offset within the pixbuf of the hotspot. 
  400.    --  Hot_y: the Y offset within the pixbuf of the hotspot. 
  401.  
  402.    procedure Set_Icon_Stock 
  403.      (Context  : Drag_Context; 
  404.       Stock_Id : String; 
  405.       Hot_X    : Gint; 
  406.       Hot_Y    : Gint); 
  407.    --  Sets the icon for a given drag from a stock ID 
  408.    --  Context: the context for a drag. (This must be called 
  409.    --             with a  context for the source side of a drag) 
  410.    --  Stock: the ID of the stock icon to use for the drag. 
  411.    --  Hot_x: the X offset within the icon of the hotspot. 
  412.    --  Hot_y: the Y offset within the icon of the hotspot. 
  413.  
  414.    procedure Set_Icon_Name 
  415.      (Context   : Drag_Context; 
  416.       Icon_Name : String; 
  417.       Hot_X     : Gint; 
  418.       Hot_Y     : Gint); 
  419.    --  Sets the icon for a given drag from a named themed icon. See 
  420.    --  the docs for Gtk_Icon_Theme for more details. Note that the 
  421.    --  size of the icon depends on the icon theme (the icon is 
  422.    --  loaded at the symbolic size GTK_ICON_SIZE_DND), thus 
  423.    --  Hot_X and Hot_Y have to be used with care. 
  424.  
  425.    ----------------- 
  426.    -- Obsolescent -- 
  427.    ----------------- 
  428.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  429.    --  from future versions of gtk+ (and therefore GtkAda). 
  430.    --  To find out whether your code uses any of these, we recommend compiling 
  431.    --  with the -gnatwj switch 
  432.    --  <doc_ignore> 
  433.  
  434.    procedure Set_Default_Icon 
  435.      (Colormap : Gdk.Color.Gdk_Colormap; 
  436.       Pixmap   : Gdk.Pixmap.Gdk_Pixmap; 
  437.       Mask     : Gdk.Bitmap.Gdk_Bitmap; 
  438.       Hot_X    : Gint; 
  439.       Hot_Y    : Gint); 
  440.    pragma Obsolescent; --  Set_Default_Icon 
  441.    --  Change the default drag icon. GtkAda retains a reference count for the 
  442.    --  arguments, and will release them when they are no longer needed. 
  443.    --  This procedure is deprecated. 
  444.  
  445.    --  </doc_ignore> 
  446.  
  447.    ------------- 
  448.    -- Signals -- 
  449.    ------------- 
  450.  
  451.    --  <signals> 
  452.    --  The following new signals are defined for the class 
  453.    --  Gtk.Widget.Gtk_Widget to support drag-and-drop. 
  454.    --  Please note that no default marshaller is provided in GtkAda for these 
  455.    --  handlers, and that you will have to use the general form of callbacks 
  456.    --  instead, getting the value of the parameters directly from the 
  457.    --  Gtk_Args structure. 
  458.    -- 
  459.    --  - "drag_begin"   (source side) 
  460.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  461.    --                       Context : Drag_Context); 
  462.    -- 
  463.    --    A new drag-and-drop operation has just been started from Widget. This 
  464.    --    callback can be used for instance to modify the visual aspect of the 
  465.    --    widget, so as to give a visual clue as to what widget is the source. 
  466.    -- 
  467.    --  - "drag_end"     (source side) 
  468.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  469.    --                       Context : Drag_Context); 
  470.    -- 
  471.    --    The drag-and-drop operation that was started from the widget has been 
  472.    --    completed, and the standard set of the widget can be restored. 
  473.    -- 
  474.    --  - "drag_data_get"  (source side) 
  475.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  476.    --                       Context : Drag_Context; 
  477.    --                       Data    : Selection_Data; 
  478.    --                       Info    : Guint; 
  479.    --                       Time    : Guint); 
  480.    -- 
  481.    --    This should be connected to every drag source. 
  482.    --    This is used to request the actual data to be transfered to the drop 
  483.    --    site once the drop has been done. 
  484.    --    Info is the type of the expected Data, and is in fact the third 
  485.    --    field of the Target_Entry record, whose value you have define 
  486.    --    yourself. 
  487.    --    Data should be modified to include a pointer or a copy of the data, 
  488.    --    through Selection_Data_Set. 
  489.    -- 
  490.    --  - "drag_data_delete"  (source side) 
  491.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  492.    --                       Context : Drag_Context); 
  493.    -- 
  494.    --    This handler is called whenever the drop site of a drag-and-drop 
  495.    --    operation has decided that the data should be deleted, or 
  496.    --    automaticallyif the selected action was Action_Move. 
  497.    --    Widget is the drag source. 
  498.    -- 
  499.    --  - "drag_leave"  (target side) 
  500.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  501.    --                       Context : Drag_Context; 
  502.    --                       Time    : Guint); 
  503.  
  504.    --    Signal emitted whenever a drag-and-drop operation is being performed, 
  505.    --    and the mouse has just left the area covered by a widget on the 
  506.    --    screen. This can be used to restore the default visual aspect of the 
  507.    --    widget. This is also emitted when the drop has been performed on the 
  508.    --    widget. 
  509.    -- 
  510.    --  - "drag_motion"  (target side) 
  511.    --    function Handler (Widget  : access Gtk_Widget_Record'Class; 
  512.    --                      Context : Drag_Context; 
  513.    --                      X       : Gint; 
  514.    --                      Y       : Gint; 
  515.    --                      Time    : Guint) 
  516.    --                     return Boolean; 
  517.    -- 
  518.    --    This is called every time the user is doing a dnd operation, and 
  519.    --    the mouse is currently over Widget (but not released yet). 
  520.    --    This can be used to change the visual aspect of Widget to provide 
  521.    --    visual clues to the user. The "opposite" signal is drag_leave. 
  522.    -- 
  523.    --    The return value is ignored if Dest_Default_Motion was set when 
  524.    --    Source_Set was called. This handler should return True if Widget 
  525.    --    acknowledges that it is a possible drop site for the particular 
  526.    --    targets provided by the drag source. 
  527.    -- 
  528.    --  - "drag_drop"  (target side) 
  529.    --    function Handler (Widget  : access Gtk_Widget_Record'Class; 
  530.    --                      Context : Drag_Context; 
  531.    --                      X       : Gint; 
  532.    --                      Y       : Gint; 
  533.    --                      Time    : Guint) 
  534.    --                     return Boolean; 
  535.    -- 
  536.    --    This is called whenever a drop is about to be performed on the widget. 
  537.    --    Note that this is called even if no common target type has been found 
  538.    --    between the drag source and the drop site. Thus, you will need to 
  539.    --    analyze the result of Get_Targets (Context) to find the possible 
  540.    --    targets. 
  541.    --    The data is sent separately through the "drag_data_received" signal, 
  542.    --    and might not even be available when "drag_drop" is emitted. 
  543.    --    This signal is mostly used if you have chosen not to use any of the 
  544.    --    default behavior when calling Dest_Set. Otherwise, everything is 
  545.    --    already handled directly by GtkAda. 
  546.    -- 
  547.    --    This handler should return True if Widget acknowledges that it is a 
  548.    --    possible drop site for the particular targets provided by the drag 
  549.    --    source. 
  550.    -- 
  551.    --  - "drag_data_received"  (target_side) 
  552.    --    procedure Handler (Widget  : access Gtk_Widget_Record'Class; 
  553.    --                       Context : Drag_Context; 
  554.    --                       X       : Gint; 
  555.    --                       Y       : Gint; 
  556.    --                       Data    : Selection_Data; 
  557.    --                       Info    : Guint; 
  558.    --                       Time    : Guint); 
  559.    -- 
  560.    --    This signal should be connected to every drop site. 
  561.    --    The handler is called every time some new data has been dropped onto 
  562.    --    Widget. (X, Y) are the mouse coordinates, relative to the widget's 
  563.    --    window, where the data was dropped. Info is the type of the data, 
  564.    --    has set in the third field of the Target_Entry record, and Data 
  565.    --    contains a pointer to the actual data. 
  566.    -- 
  567.    --  </signals> 
  568.  
  569. private 
  570.    Dest_No_Default        : constant Dest_Defaults := 0; 
  571.    Dest_Default_Motion    : constant Dest_Defaults := 2 ** 0; 
  572.    Dest_Default_Highlight : constant Dest_Defaults := 2 ** 1; 
  573.    Dest_Default_Drop      : constant Dest_Defaults := 2 ** 2; 
  574.    Dest_Default_All       : constant Dest_Defaults := 7; 
  575.  
  576.    pragma Import (C, Set_Icon_Pixmap, "gtk_drag_set_icon_pixmap"); 
  577.    pragma Import (C, Set_Icon_Default, "gtk_drag_set_icon_default"); 
  578.    pragma Import (C, Set_Default_Icon, "gtk_drag_set_default_icon"); 
  579. end Gtk.Dnd;