1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. pragma Ada_2005; 
  25.  
  26. pragma Warnings (Off, "*is already use-visible*"); 
  27. with Glib;               use Glib; 
  28. with Glib.Types;         use Glib.Types; 
  29. with Gtk.Selection_Data; use Gtk.Selection_Data; 
  30. with Gtk.Tree_Model;     use Gtk.Tree_Model; 
  31.  
  32. package Gtk.Tree_Drag_Source is 
  33.  
  34.    type Gtk_Tree_Drag_Source is new Glib.Types.GType_Interface; 
  35.    Null_Gtk_Tree_Drag_Source : constant Gtk_Tree_Drag_Source; 
  36.  
  37.    ------------------ 
  38.    -- Constructors -- 
  39.    ------------------ 
  40.  
  41.    function Get_Type return Glib.GType; 
  42.    pragma Import (C, Get_Type, "gtk_tree_drag_source_get_type"); 
  43.  
  44.    ------------- 
  45.    -- Methods -- 
  46.    ------------- 
  47.  
  48.    function Drag_Data_Delete 
  49.       (Self : Gtk_Tree_Drag_Source; 
  50.        Path : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; 
  51.    --  Asks the Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source to delete the row at 
  52.    --  Path, because it was moved somewhere else via drag-and-drop. Returns 
  53.    --  False if the deletion fails because Path no longer exists, or for some 
  54.    --  model-specific reason. Should robustly handle a Path no longer found in 
  55.    --  the model! 
  56.    --  "path": row that was being dragged 
  57.  
  58.    function Drag_Data_Get 
  59.       (Self           : Gtk_Tree_Drag_Source; 
  60.        Path           : Gtk.Tree_Model.Gtk_Tree_Path; 
  61.        Selection_Data : Gtk.Selection_Data.Gtk_Selection_Data) 
  62.        return Boolean; 
  63.    --  Asks the Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source to fill in 
  64.    --  Selection_Data with a representation of the row at Path. 
  65.    --  Selection_Data->target gives the required type of the data. Should 
  66.    --  robustly handle a Path no longer found in the model! 
  67.    --  "path": row that was dragged 
  68.    --  "selection_data": a Gtk.Selection_Data.Gtk_Selection_Data to fill with 
  69.    --  data from the dragged row 
  70.  
  71.    function Row_Draggable 
  72.       (Self : Gtk_Tree_Drag_Source; 
  73.        Path : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; 
  74.    --  Asks the Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source whether a particular 
  75.    --  row can be used as the source of a DND operation. If the source doesn't 
  76.    --  implement this interface, the row is assumed draggable. 
  77.    --  "path": row on which user is initiating a drag 
  78.  
  79.    --------------- 
  80.    -- Functions -- 
  81.    --------------- 
  82.  
  83.    function Set_Row_Drag_Data 
  84.       (Selection_Data : Gtk.Selection_Data.Gtk_Selection_Data; 
  85.        Tree_Model     : Gtk.Tree_Model.Gtk_Tree_Model; 
  86.        Path           : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; 
  87.    --  Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used in 
  88.    --  a drag_data_get handler. 
  89.    --  "selection_data": some Gtk.Selection_Data.Gtk_Selection_Data 
  90.    --  "tree_model": a Gtk.Tree_Model.Gtk_Tree_Model 
  91.    --  "path": a row in Tree_Model 
  92.  
  93.    procedure Get_Row_Drag_Data 
  94.       (Selection_Data : Gtk.Selection_Data.Gtk_Selection_Data; 
  95.        Tree_Model     : out Gtk.Tree_Model.Gtk_Tree_Model; 
  96.        Path           : out Gtk.Tree_Model.Gtk_Tree_Path; 
  97.        succes         : out Boolean); 
  98.    --  Obtains a Tree_Model and Path from selection data of target type 
  99.    --  GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. 
  100.    --  This function can only be used if Selection_Data originates from the 
  101.    --  same process that's calling this function, because a pointer to the tree 
  102.    --  model is being passed around. If you aren't in the same process, then 
  103.    --  you'll get memory corruption. In the 
  104.    --  Gtk.Tree_Drag_Dest.Gtk_Tree_Drag_Dest drag_data_received handler, you 
  105.    --  can assume that selection data of type GTK_TREE_MODEL_ROW is in from the 
  106.    --  current process. The returned path must be freed with 
  107.    --  Gtk.Tree_Model.Path_Free. 
  108.    --  "selection_data": a Gtk.Selection_Data.Gtk_Selection_Data 
  109.    --  "tree_model": a Gtk.Tree_Model.Gtk_Tree_Model 
  110.    --  "path": row in Tree_Model 
  111.  
  112.    ---------------- 
  113.    -- Interfaces -- 
  114.    ---------------- 
  115.    --  This class implements several interfaces. See Glib.Types 
  116.    -- 
  117.    --  - "Gtk_Tree_Drag_Source" 
  118.  
  119.    function "+" (W : Gtk_Tree_Drag_Source) return Gtk_Tree_Drag_Source; 
  120.    pragma Inline ("+"); 
  121.  
  122. private 
  123.  
  124. Null_Gtk_Tree_Drag_Source : constant Gtk_Tree_Drag_Source := 
  125.    Gtk_Tree_Drag_Source (Glib.Types.Null_Interface); 
  126. end Gtk.Tree_Drag_Source;