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

« back to all changes in this revision

Viewing changes to src/gtk-container.adb

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-08-11 09:46:51 UTC
  • mfrom: (6.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20080811094651-9mjd6acwa98ffw5c
Tags: 2.12.0-2ubuntu1
Add lpia to supported architectures.

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               --
21
21
--                                                                   --
22
22
-----------------------------------------------------------------------
23
23
 
24
 
with System;         use System;
25
 
with Glib.Values;    use Glib.Values;
26
 
with Gtk.Adjustment; use Gtk.Adjustment;
27
 
with Gtk.Enums;      use Gtk.Enums;
28
 
with Gtk.Widget;     use Gtk.Widget;
 
24
with Gtkada.Bindings; use Gtkada.Bindings;
 
25
with System;          use System;
 
26
with Glib.Values;     use Glib.Values;
 
27
with Gtk.Adjustment;  use Gtk.Adjustment;
 
28
with Gtk.Enums;       use Gtk.Enums;
 
29
with Gtk.Widget;      use Gtk.Widget;
 
30
 
 
31
with Glib.Type_Conversion_Hooks;
29
32
 
30
33
package body Gtk.Container is
31
34
 
 
35
   package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
 
36
     (Get_Type'Access, Gtk_Container_Record);
 
37
   pragma Warnings (Off, Type_Conversion);
 
38
 
32
39
   procedure Internal_Gtk_Callback
33
40
     (Widget : System.Address; Data : Gtk_Callback);
34
41
   pragma Convention (C, Internal_Gtk_Callback);
101
108
      procedure Internal
102
109
        (Container : System.Address;
103
110
         Func      : System.Address;
104
 
         Data      : Gtk_Callback);
 
111
         Data      : System.Address);
105
112
      pragma Import (C, Internal, "gtk_container_forall");
106
113
   begin
107
 
      Internal (Get_Object (Container), Internal_Gtk_Callback'Address, Func);
 
114
      Internal
 
115
        (Get_Object (Container), Internal_Gtk_Callback'Address,
 
116
         Func.all'Address);
108
117
   end Forall;
109
118
 
110
119
   -------------
118
127
      procedure Internal
119
128
        (Container : System.Address;
120
129
         Func      : System.Address;
121
 
         Data      : Gtk_Callback);
 
130
         Data      : System.Address);
122
131
      pragma Import (C, Internal, "gtk_container_foreach");
123
132
   begin
124
 
      Internal (Get_Object (Container), Internal_Gtk_Callback'Address, Func);
 
133
      Internal
 
134
        (Get_Object (Container), Internal_Gtk_Callback'Address,
 
135
         Func.all'Address);
125
136
   end Foreach;
126
137
 
127
138
   -------------
376
387
         Adjustment : System.Address);
377
388
      pragma Import (C, Internal, "gtk_container_set_focus_hadjustment");
378
389
 
379
 
      use type Gtk.Adjustment.Gtk_Adjustment;
380
 
 
381
390
   begin
382
391
      if Adjustment = null then
383
392
         Internal (Get_Object (Container), System.Null_Address);
399
408
         Adjustment : System.Address);
400
409
      pragma Import (C, Internal, "gtk_container_set_focus_vadjustment");
401
410
 
402
 
      use type Gtk.Adjustment.Gtk_Adjustment;
403
 
 
404
411
   begin
405
412
      if Adjustment = null then
406
413
         Internal (Get_Object (Container), System.Null_Address);
591
598
   function Class_List_Child_Properties
592
599
     (Cclass : GObject_Class) return Param_Spec_Array
593
600
   is
594
 
      type Big_Pspec_Array is array (Positive) of Param_Spec;
595
 
      type Big_Pspec is access all Big_Pspec_Array;
596
 
      pragma Convention (C, Big_Pspec);
597
 
 
 
601
      use Pspec_Arrays;
598
602
      function Internal
599
603
        (Cclass       : GObject_Class;
600
 
         N_Properties : access Guint) return Big_Pspec;
 
604
         N_Properties : access Guint) return Unbounded_Array_Access;
601
605
      pragma Import (C, Internal, "gtk_container_class_list_child_properties");
602
606
 
603
607
      Num     : aliased Guint;
604
 
      C_Array : constant Big_Pspec := Internal (Cclass, Num'Access);
 
608
      C_Array : constant Unbounded_Array_Access :=
 
609
        Internal (Cclass, Num'Access);
 
610
      Result  : constant Param_Spec_Array := To_Array (C_Array, Integer (Num));
605
611
 
606
612
   begin
607
 
      --  Implementation is the same as
608
 
      --  Gtk.Widget.Class_List_Style_Properties
609
 
 
610
 
      if C_Array = null then
611
 
         return (1 .. 0 => null);
612
 
      else
613
 
         return Param_Spec_Array (C_Array (1 .. Natural (Num)));
614
 
      end if;
 
613
      --  Do says we should free, but doing so results in double-deallocation
 
614
--      G_Free (C_Array);
 
615
      return Result;
615
616
   end Class_List_Child_Properties;
616
617
 
617
618
end Gtk.Container;