~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to src/gtk-ctree.adb

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2008-07-31 18:10:47 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20080731181047-6m1y25zjad0p2yjr
Tags: 2.12.0-2

Correct the project files to add a Library_ALI_Dir and correct the
Library_Name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
--               GtkAda - Ada95 binding for Gtk+/Gnome               --
3
3
--                                                                   --
4
4
--   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --
 
5
--                 Copyright (C) 2000-2008, AdaCore                  --
5
6
--                                                                   --
6
7
-- This library is free software; you can redistribute it and/or     --
7
8
-- modify it under the terms of the GNU General Public               --
25
25
with Unchecked_Deallocation;
26
26
with Gtk.Style;    use Gtk.Style;
27
27
 
 
28
with Ada.Unchecked_Conversion;
 
29
 
 
30
with Glib.Type_Conversion_Hooks;
 
31
 
28
32
package body Gtk.Ctree is
29
33
 
 
34
   package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
 
35
     (Get_Type'Access, Gtk_Ctree_Record);
 
36
   pragma Warnings (Off, Type_Conversion);
 
37
 
30
38
   Compare_Drag_Func_Key : constant String :=
31
 
     "_GtkAda_Ctree_Compare_Drag_Func" & ASCII.NUL;
 
39
                             "_GtkAda_Ctree_Compare_Drag_Func" & ASCII.NUL;
 
40
 
 
41
   function To_Address is new Ada.Unchecked_Conversion
 
42
     (Gtk_Ctree_Compare_Drag_Func, System.Address);
 
43
   function From_Address is new Ada.Unchecked_Conversion
 
44
     (System.Address, Gtk_Ctree_Compare_Drag_Func);
32
45
   --
33
46
   --  The key that will be used to store the address of the Ada
34
47
   --  Compare_Drag_Func function.
1101
1114
 
1102
1115
      function Get_User_Data
1103
1116
        (Object : in System.Address;
1104
 
         Key    : in String) return Gtk_Ctree_Compare_Drag_Func;
 
1117
         Key    : in String) return System.Address;
1105
1118
      pragma Import (C, Get_User_Data, "gtk_object_get_data");
1106
1119
      --  External binding: gtk_object_get_data
1107
1120
 
1109
1122
      Local_Ctree : constant Gtk_Ctree :=
1110
1123
        Gtk_Ctree (Get_User_Data (Ctree, Local_Ctree_Stub));
1111
1124
 
1112
 
      Cmp_Func : constant Gtk_Ctree_Compare_Drag_Func :=
1113
 
        Get_User_Data (Object => Ctree, Key => Compare_Drag_Func_Key);
 
1125
      Cmp_Func : constant Gtk_Ctree_Compare_Drag_Func := From_Address
 
1126
        (Get_User_Data (Object => Ctree, Key => Compare_Drag_Func_Key));
1114
1127
 
1115
1128
   begin
1116
1129
      return Boolean'Pos
1131
1144
 
1132
1145
      procedure Set_User_Data (Object : in System.Address;
1133
1146
                               Name   : in String;
1134
 
                               Data   : in Gtk_Ctree_Compare_Drag_Func);
 
1147
                               Data   : in System.Address);
1135
1148
      pragma Import (C, Set_User_Data, "gtk_object_set_data");
1136
1149
      --  External binding: gtk_object_set_data
1137
1150
 
1139
1152
      if Cmp_Func = null then
1140
1153
         Internal (Get_Object (Ctree), System.Null_Address);
1141
1154
      else
1142
 
         Set_User_Data (Get_Object (Ctree), Compare_Drag_Func_Key, Cmp_Func);
 
1155
         Set_User_Data
 
1156
           (Get_Object (Ctree), Compare_Drag_Func_Key,
 
1157
            To_Address (Cmp_Func)
 
1158
           );
1143
1159
         Internal (Get_Object (Ctree), C_Compare_Drag_Func'Address);
1144
1160
         --
1145
1161
         --  It is not possible to store directly the Ada Cmp_Func into