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. --  <description> 
  25. --  A Gtk.Target_List.Gtk_Target_List structure is a reference counted list of 
  26. --  Gtk_Target_Pair. It is used to represent the same information as a table of 
  27. --  Gtk.Target_Entry.Gtk_Target_Entry, but in an efficient form. This structure 
  28. --  should be treated as opaque. 
  29. -- 
  30. --  </description> 
  31. pragma Ada_2005; 
  32.  
  33. pragma Warnings (Off, "*is already use-visible*"); 
  34. with Gdk.Types;               use Gdk.Types; 
  35. with Glib;                    use Glib; 
  36. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  37. with Gtk.Target_Entry;        use Gtk.Target_Entry; 
  38.  
  39. package Gtk.Target_List is 
  40.  
  41.    type Gtk_Target_List is new Glib.C_Boxed with null record; 
  42.    Null_Gtk_Target_List : constant Gtk_Target_List; 
  43.  
  44.    function From_Object (Object : System.Address) return Gtk_Target_List; 
  45.    function From_Object_Free (B : access Gtk_Target_List'Class) return Gtk_Target_List; 
  46.    pragma Inline (From_Object_Free, From_Object); 
  47.  
  48.    type Gtk_Accel_Flags is mod 2 ** Integer'Size; 
  49.    pragma Convention (C, Gtk_Accel_Flags); 
  50.  
  51.  
  52.    Accel_Visible : constant Gtk_Accel_Flags := 1; 
  53.    Accel_Locked : constant Gtk_Accel_Flags := 2; 
  54.    Accel_Mask : constant Gtk_Accel_Flags := 7; 
  55.  
  56.    ---------------------------- 
  57.    -- Enumeration Properties -- 
  58.    ---------------------------- 
  59.  
  60.    package Gtk_Accel_Flags_Properties is 
  61.       new Generic_Internal_Discrete_Property (Gtk_Accel_Flags); 
  62.    type Property_Gtk_Accel_Flags is new Gtk_Accel_Flags_Properties.Property; 
  63.  
  64.    ------------------ 
  65.    -- Constructors -- 
  66.    ------------------ 
  67.  
  68.    function Get_Type return Glib.GType; 
  69.    pragma Import (C, Get_Type, "gtk_target_list_get_type"); 
  70.  
  71.    ------------- 
  72.    -- Methods -- 
  73.    ------------- 
  74.  
  75.    procedure Add 
  76.       (List   : Gtk_Target_List; 
  77.        Target : Gdk.Types.Gdk_Atom; 
  78.        Flags  : Guint; 
  79.        Info   : Guint); 
  80.    --  Appends another target to a Gtk.Target_List.Gtk_Target_List. 
  81.    --  "target": the interned atom representing the target 
  82.    --  "flags": the flags for this target 
  83.    --  "info": an ID that will be passed back to the application 
  84.  
  85.    procedure Add_Image_Targets 
  86.       (List     : Gtk_Target_List; 
  87.        Info     : Guint; 
  88.        Writable : Boolean); 
  89.    --  Appends the image targets supported by Gtk_Selection to the target 
  90.    --  list. All targets are added with the same Info. 
  91.    --  Since: gtk+ 2.6 
  92.    --  "info": an ID that will be passed back to the application 
  93.    --  "writable": whether to add only targets for which GTK+ knows how to 
  94.    --  convert a pixbuf into the format 
  95.  
  96.    procedure Add_Text_Targets (List : Gtk_Target_List; Info : Guint); 
  97.    --  Appends the text targets supported by Gtk_Selection to the target list. 
  98.    --  All targets are added with the same Info. 
  99.    --  Since: gtk+ 2.6 
  100.    --  "info": an ID that will be passed back to the application 
  101.  
  102.    procedure Add_Uri_Targets (List : Gtk_Target_List; Info : Guint); 
  103.    --  Appends the URI targets supported by Gtk_Selection to the target list. 
  104.    --  All targets are added with the same Info. 
  105.    --  Since: gtk+ 2.6 
  106.    --  "info": an ID that will be passed back to the application 
  107.  
  108.    procedure Find 
  109.       (List   : Gtk_Target_List; 
  110.        Target : Gdk.Types.Gdk_Atom; 
  111.        Info   : in out Guint; 
  112.        Found  : out Boolean); 
  113.    --  Looks up a given target in a Gtk.Target_List.Gtk_Target_List. 
  114.    --  "target": an interned atom representing the target to search for 
  115.    --  "info": a pointer to the location to store application info for target, 
  116.    --  or null 
  117.  
  118.    function Ref (List : Gtk_Target_List) return Gtk_Target_List; 
  119.    --  Increases the reference count of a Gtk.Target_List.Gtk_Target_List by 
  120.    --  one. 
  121.  
  122.    procedure Remove (List : Gtk_Target_List; Target : Gdk.Types.Gdk_Atom); 
  123.    --  Removes a target from a target list. 
  124.    --  "target": the interned atom representing the target 
  125.  
  126.    procedure Unref (List : Gtk_Target_List); 
  127.    --  Decreases the reference count of a Gtk.Target_List.Gtk_Target_List by 
  128.    --  one. If the resulting reference count is zero, frees the list. 
  129.  
  130.    ---------------------- 
  131.    -- GtkAda additions -- 
  132.    ---------------------- 
  133.  
  134.    type Target_Entry_Array is array (Natural range <>) of Gtk_Target_Entry; 
  135.  
  136.    Any_Target_Entry : Target_Entry_Array (1 .. 0); 
  137.    --  To be used for drop sites that accept any kind of data. 
  138.  
  139.    procedure Gtk_New 
  140.      (List   : out Gtk_Target_List; 
  141.       Targets : Target_Entry_Array); 
  142.    --  Creates a new Gtk.Target_List.Gtk_Target_List from an array of 
  143.    --  Gtk.Target_Entry.Gtk_Target_Entry. 
  144.  
  145.    procedure Add_Table 
  146.      (List    : Gtk_Target_List; 
  147.       Targets : Target_Entry_Array); 
  148.    --  Prepends a table of Gtk.Target_Entry.Gtk_Target_Entry to a target list. 
  149.  
  150. private 
  151.  
  152.    Null_Gtk_Target_List : constant Gtk_Target_List := (Glib.C_Boxed with null record); 
  153.  
  154. end Gtk.Target_List;