1------------------------------------------------------------------------------ 2-- GtkAda - Ada95 binding for Gtk+/Gnome -- 3-- -- 4-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 5-- Copyright (C) 1998-2015, AdaCore -- 6-- -- 7-- This library is free software; you can redistribute it and/or modify it -- 8-- under terms of the GNU General Public License as published by the Free -- 9-- Software Foundation; either version 3, or (at your option) any later -- 10-- version. This library is distributed in the hope that it will be useful, -- 11-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- 12-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- 13-- -- 14-- As a special exception under Section 7 of GPL version 3, you are granted -- 15-- additional permissions described in the GCC Runtime Library Exception, -- 16-- version 3.1, as published by the Free Software Foundation. -- 17-- -- 18-- You should have received a copy of the GNU General Public License and -- 19-- a copy of the GCC Runtime Library Exception along with this program; -- 20-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 21-- <http://www.gnu.org/licenses/>. -- 22-- -- 23------------------------------------------------------------------------------ 24 25with Unchecked_Conversion; 26 27package body Glib.Gnodes is 28 29 --------------- 30 -- Destroy -- 31 --------------- 32 33 procedure Destroy (Node : in out Gnode) is 34 procedure Internal (Node : Gnode); 35 pragma Import (C, Internal, "g_node_destroy"); 36 begin 37 Internal (Node); 38 Node := null; 39 end Destroy; 40 41 ------------------- 42 -- Is_Ancestor -- 43 ------------------- 44 45 function Is_Ancestor (Node : Gnode; 46 Descendant : Gnode) return Boolean is 47 function Internal (Node : Gnode; 48 Descendant : Gnode) return Gboolean; 49 pragma Import (C, Internal, "g_node_is_ancestor"); 50 begin 51 return Internal (Node, Descendant) /= 0; 52 end Is_Ancestor; 53 54 --------------- 55 -- Is_Leaf -- 56 --------------- 57 58 function Is_Leaf (Node : Gnode) return Boolean is 59 function Internal (Node : Gnode) return Gboolean; 60 pragma Import (C, Internal, "ada_gnode_is_leaf"); 61 begin 62 return Internal (Node) /= 0; 63 end Is_Leaf; 64 65 --------------- 66 -- Is_Root -- 67 --------------- 68 69 function Is_Root (Node : Gnode) return Boolean is 70 function Internal (Node : Gnode) return Gboolean; 71 pragma Import (C, Internal, "ada_gnode_is_root"); 72 begin 73 return Internal (Node) /= 0; 74 end Is_Root; 75 76 --------------- 77 -- N_Nodes -- 78 --------------- 79 80 function N_Nodes (Root : Gnode; 81 Flags : Glib_Traverse_Flags) return Guint is 82 function Internal 83 (Root : Gnode; Flags : Glib_Traverse_Flags) return Guint; 84 pragma Import (C, Internal, "g_node_n_nodes"); 85 86 begin 87 return Internal (Root, Flags); 88 end N_Nodes; 89 90 ---------------- 91 -- Gnode_Data -- 92 ---------------- 93 94 package body Gnode_Data is 95 96 function Convert is new Unchecked_Conversion (Element_Access, Gnode); 97 98 ---------------- 99 -- Glib_New -- 100 ---------------- 101 102 procedure Glib_New (Node : out Gnode; 103 Data : Element_Access) is 104 begin 105 Node := Convert (Data); 106 end Glib_New; 107 108 end Gnode_Data; 109 110end Glib.Gnodes; 111