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