gtkada_24.0.0_80c56171/src/generated/gtk-container.adb

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
------------------------------------------------------------------------------
--                                                                          --
--      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       --
--                     Copyright (C) 2000-2022, AdaCore                     --
--                                                                          --
-- This library is free software;  you can redistribute it and/or modify it --
-- under terms of the  GNU General Public License  as published by the Free --
-- Software  Foundation;  either version 3,  or (at your  option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
------------------------------------------------------------------------------

pragma Style_Checks (Off);
pragma Warnings (Off, "*is already use-visible*");
with Ada.Unchecked_Conversion;
with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks;
with Gtk.Arguments;              use Gtk.Arguments;
with Gtkada.Bindings;            use Gtkada.Bindings;
pragma Warnings(Off);  --  might be unused
with Gtkada.Types;               use Gtkada.Types;
pragma Warnings(On);

package body Gtk.Container is

   procedure C_Gtk_Container_Forall
      (Container     : System.Address;
       Callback      : System.Address;
       Callback_Data : System.Address);
   pragma Import (C, C_Gtk_Container_Forall, "gtk_container_forall");
   --  Invokes Callback on each direct child of Container, including children
   --  that are considered "internal" (implementation details of the
   --  container). "Internal" children generally weren't added by the user of
   --  the container, but were added by the container implementation itself.
   --  Most applications should use Gtk.Container.Foreach, rather than
   --  Gtk.Container.Forall.
   --  "callback": a callback
   --  "callback_data": callback user data

   procedure C_Gtk_Container_Foreach
      (Container     : System.Address;
       Callback      : System.Address;
       Callback_Data : System.Address);
   pragma Import (C, C_Gtk_Container_Foreach, "gtk_container_foreach");
   --  Invokes Callback on each non-internal child of Container. See
   --  Gtk.Container.Forall for details on what constitutes an "internal"
   --  child. For all practical purposes, this function should iterate over
   --  precisely those child widgets that were added to the container by the
   --  application with explicit add calls.
   --  It is permissible to remove the child from the Callback handler.
   --  Most applications should use Gtk.Container.Foreach, rather than
   --  Gtk.Container.Forall.
   --  "callback": a callback
   --  "callback_data": callback user data

   function To_Gtk_Callback is new Ada.Unchecked_Conversion
     (System.Address, Gtk_Callback);

   function To_Address is new Ada.Unchecked_Conversion
     (Gtk_Callback, System.Address);

   procedure Internal_Gtk_Callback
      (Widget : System.Address;
       Data   : System.Address);
   pragma Convention (C, Internal_Gtk_Callback);
   --  "widget": the widget to operate on
   --  "data": user-supplied data

   ---------------------------
   -- Internal_Gtk_Callback --
   ---------------------------

   procedure Internal_Gtk_Callback
      (Widget : System.Address;
       Data   : System.Address)
   is
      Func            : constant Gtk_Callback := To_Gtk_Callback (Data);
      Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record;
   begin
      Func (Gtk.Widget.Gtk_Widget (Get_User_Data (Widget, Stub_Gtk_Widget)));
   end Internal_Gtk_Callback;

   package Type_Conversion_Gtk_Container is new Glib.Type_Conversion_Hooks.Hook_Registrator
     (Get_Type'Access, Gtk_Container_Record);
   pragma Unreferenced (Type_Conversion_Gtk_Container);

   ---------
   -- Add --
   ---------

   procedure Add
      (Container : not null access Gtk_Container_Record;
       Widget    : not null access Gtk.Widget.Gtk_Widget_Record'Class)
   is
      procedure Internal
         (Container : System.Address;
          Widget    : System.Address);
      pragma Import (C, Internal, "gtk_container_add");
   begin
      Internal (Get_Object (Container), Get_Object (Widget));
   end Add;

   ------------------
   -- Check_Resize --
   ------------------

   procedure Check_Resize (Container : not null access Gtk_Container_Record) is
      procedure Internal (Container : System.Address);
      pragma Import (C, Internal, "gtk_container_check_resize");
   begin
      Internal (Get_Object (Container));
   end Check_Resize;

   ------------------------
   -- Child_Get_Property --
   ------------------------

   procedure Child_Get_Property
      (Container     : not null access Gtk_Container_Record;
       Child         : not null access Gtk.Widget.Gtk_Widget_Record'Class;
       Property_Name : UTF8_String;
       Value         : in out Glib.Values.GValue)
   is
      procedure Internal
         (Container     : System.Address;
          Child         : System.Address;
          Property_Name : Gtkada.Types.Chars_Ptr;
          Value         : in out Glib.Values.GValue);
      pragma Import (C, Internal, "gtk_container_child_get_property");
      Tmp_Property_Name : Gtkada.Types.Chars_Ptr := New_String (Property_Name);
   begin
      Internal (Get_Object (Container), Get_Object (Child), Tmp_Property_Name, Value);
      Free (Tmp_Property_Name);
   end Child_Get_Property;

   ------------------
   -- Child_Notify --
   ------------------

   procedure Child_Notify
      (Container      : not null access Gtk_Container_Record;
       Child          : not null access Gtk.Widget.Gtk_Widget_Record'Class;
       Child_Property : UTF8_String)
   is
      procedure Internal
         (Container      : System.Address;
          Child          : System.Address;
          Child_Property : Gtkada.Types.Chars_Ptr);
      pragma Import (C, Internal, "gtk_container_child_notify");
      Tmp_Child_Property : Gtkada.Types.Chars_Ptr := New_String (Child_Property);
   begin
      Internal (Get_Object (Container), Get_Object (Child), Tmp_Child_Property);
      Free (Tmp_Child_Property);
   end Child_Notify;

   ---------------------------
   -- Child_Notify_By_Pspec --
   ---------------------------

   procedure Child_Notify_By_Pspec
      (Container : not null access Gtk_Container_Record;
       Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class;
       Pspec     : in out Glib.Param_Spec)
   is
      procedure Internal
         (Container : System.Address;
          Child     : System.Address;
          Pspec     : in out Glib.Param_Spec);
      pragma Import (C, Internal, "gtk_container_child_notify_by_pspec");
   begin
      Internal (Get_Object (Container), Get_Object (Child), Pspec);
   end Child_Notify_By_Pspec;

   ------------------------
   -- Child_Set_Property --
   ------------------------

   procedure Child_Set_Property
      (Container     : not null access Gtk_Container_Record;
       Child         : not null access Gtk.Widget.Gtk_Widget_Record'Class;
       Property_Name : UTF8_String;
       Value         : Glib.Values.GValue)
   is
      procedure Internal
         (Container     : System.Address;
          Child         : System.Address;
          Property_Name : Gtkada.Types.Chars_Ptr;
          Value         : Glib.Values.GValue);
      pragma Import (C, Internal, "gtk_container_child_set_property");
      Tmp_Property_Name : Gtkada.Types.Chars_Ptr := New_String (Property_Name);
   begin
      Internal (Get_Object (Container), Get_Object (Child), Tmp_Property_Name, Value);
      Free (Tmp_Property_Name);
   end Child_Set_Property;

   ----------------
   -- Child_Type --
   ----------------

   function Child_Type
      (Container : not null access Gtk_Container_Record) return GType
   is
      function Internal (Container : System.Address) return GType;
      pragma Import (C, Internal, "gtk_container_child_type");
   begin
      return Internal (Get_Object (Container));
   end Child_Type;

   ------------
   -- Forall --
   ------------

   procedure Forall
      (Container : not null access Gtk_Container_Record;
       Callback  : Gtk_Callback)
   is
   begin
      if Callback = null then
         C_Gtk_Container_Forall (Get_Object (Container), System.Null_Address, System.Null_Address);
      else
         C_Gtk_Container_Forall (Get_Object (Container), Internal_Gtk_Callback'Address, To_Address (Callback));
      end if;
   end Forall;

   package body Forall_User_Data is

      package Users is new Glib.Object.User_Data_Closure
        (User_Data_Type, Destroy);

      function To_Gtk_Callback is new Ada.Unchecked_Conversion
        (System.Address, Gtk_Callback);

      function To_Address is new Ada.Unchecked_Conversion
        (Gtk_Callback, System.Address);

      procedure Internal_Cb (Widget : System.Address; Data : System.Address);
      pragma Convention (C, Internal_Cb);
      --  The type of the callback functions used for e.g. iterating over the
      --  children of a container, see Gtk.Container.Foreach.
      --  "widget": the widget to operate on
      --  "data": user-supplied data

      ------------
      -- Forall --
      ------------

      procedure Forall
         (Container     : not null access Gtk.Container.Gtk_Container_Record'Class;
          Callback      : Gtk_Callback;
          Callback_Data : User_Data_Type)
      is
         D : System.Address;
      begin
         if Callback = null then
            C_Gtk_Container_Forall (Get_Object (Container), System.Null_Address, System.Null_Address);
         else
            D := Users.Build (To_Address (Callback), Callback_Data);
            C_Gtk_Container_Forall (Get_Object (Container), Internal_Cb'Address, D);
            Users.Free_Data (D);
         end if;
      end Forall;

      -----------------
      -- Internal_Cb --
      -----------------

      procedure Internal_Cb (Widget : System.Address; Data : System.Address) is
         D               : constant Users.Internal_Data_Access := Users.Convert (Data);
         Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record;
      begin
         To_Gtk_Callback (D.Func) (Gtk.Widget.Gtk_Widget (Get_User_Data (Widget, Stub_Gtk_Widget)), D.Data.all);
      end Internal_Cb;

   end Forall_User_Data;

   -------------
   -- Foreach --
   -------------

   procedure Foreach
      (Container : not null access Gtk_Container_Record;
       Callback  : Gtk_Callback)
   is
   begin
      if Callback = null then
         C_Gtk_Container_Foreach (Get_Object (Container), System.Null_Address, System.Null_Address);
      else
         C_Gtk_Container_Foreach (Get_Object (Container), Internal_Gtk_Callback'Address, To_Address (Callback));
      end if;
   end Foreach;

   package body Foreach_User_Data is

      package Users is new Glib.Object.User_Data_Closure
        (User_Data_Type, Destroy);

      function To_Gtk_Callback is new Ada.Unchecked_Conversion
        (System.Address, Gtk_Callback);

      function To_Address is new Ada.Unchecked_Conversion
        (Gtk_Callback, System.Address);

      procedure Internal_Cb (Widget : System.Address; Data : System.Address);
      pragma Convention (C, Internal_Cb);
      --  The type of the callback functions used for e.g. iterating over the
      --  children of a container, see Gtk.Container.Foreach.
      --  "widget": the widget to operate on
      --  "data": user-supplied data

      -------------
      -- Foreach --
      -------------

      procedure Foreach
         (Container     : not null access Gtk.Container.Gtk_Container_Record'Class;
          Callback      : Gtk_Callback;
          Callback_Data : User_Data_Type)
      is
         D : System.Address;
      begin
         if Callback = null then
            C_Gtk_Container_Foreach (Get_Object (Container), System.Null_Address, System.Null_Address);
         else
            D := Users.Build (To_Address (Callback), Callback_Data);
            C_Gtk_Container_Foreach (Get_Object (Container), Internal_Cb'Address, D);
            Users.Free_Data (D);
         end if;
      end Foreach;

      -----------------
      -- Internal_Cb --
      -----------------

      procedure Internal_Cb (Widget : System.Address; Data : System.Address) is
         D               : constant Users.Internal_Data_Access := Users.Convert (Data);
         Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record;
      begin
         To_Gtk_Callback (D.Func) (Gtk.Widget.Gtk_Widget (Get_User_Data (Widget, Stub_Gtk_Widget)), D.Data.all);
      end Internal_Cb;

   end Foreach_User_Data;

   ----------------------
   -- Get_Border_Width --
   ----------------------

   function Get_Border_Width
      (Container : not null access Gtk_Container_Record) return Guint
   is
      function Internal (Container : System.Address) return Guint;
      pragma Import (C, Internal, "gtk_container_get_border_width");
   begin
      return Internal (Get_Object (Container));
   end Get_Border_Width;

   ------------------
   -- Get_Children --
   ------------------

   function Get_Children
      (Container : not null access Gtk_Container_Record)
       return Gtk.Widget.Widget_List.Glist
   is
      function Internal (Container : System.Address) return System.Address;
      pragma Import (C, Internal, "gtk_container_get_children");
      Tmp_Return : Gtk.Widget.Widget_List.Glist;
   begin
      Gtk.Widget.Widget_List.Set_Object (Tmp_Return, Internal (Get_Object (Container)));
      return Tmp_Return;
   end Get_Children;

   ---------------------
   -- Get_Focus_Child --
   ---------------------

   function Get_Focus_Child
      (Container : not null access Gtk_Container_Record)
       return Gtk.Widget.Gtk_Widget
   is
      function Internal (Container : System.Address) return System.Address;
      pragma Import (C, Internal, "gtk_container_get_focus_child");
      Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record;
   begin
      return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Container)), Stub_Gtk_Widget));
   end Get_Focus_Child;

   ---------------------------
   -- Get_Focus_Hadjustment --
   ---------------------------

   function Get_Focus_Hadjustment
      (Container : not null access Gtk_Container_Record)
       return Gtk.Adjustment.Gtk_Adjustment
   is
      function Internal (Container : System.Address) return System.Address;
      pragma Import (C, Internal, "gtk_container_get_focus_hadjustment");
      Stub_Gtk_Adjustment : Gtk.Adjustment.Gtk_Adjustment_Record;
   begin
      return Gtk.Adjustment.Gtk_Adjustment (Get_User_Data (Internal (Get_Object (Container)), Stub_Gtk_Adjustment));
   end Get_Focus_Hadjustment;

   ---------------------------
   -- Get_Focus_Vadjustment --
   ---------------------------

   function Get_Focus_Vadjustment
      (Container : not null access Gtk_Container_Record)
       return Gtk.Adjustment.Gtk_Adjustment
   is
      function Internal (Container : System.Address) return System.Address;
      pragma Import (C, Internal, "gtk_container_get_focus_vadjustment");
      Stub_Gtk_Adjustment : Gtk.Adjustment.Gtk_Adjustment_Record;
   begin
      return Gtk.Adjustment.Gtk_Adjustment (Get_User_Data (Internal (Get_Object (Container)), Stub_Gtk_Adjustment));
   end Get_Focus_Vadjustment;

   ------------------------
   -- Get_Path_For_Child --
   ------------------------

   function Get_Path_For_Child
      (Container : not null access Gtk_Container_Record;
       Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class)
       return Gtk.Widget.Gtk_Widget_Path
   is
      function Internal
         (Container : System.Address;
          Child     : System.Address)
          return access Gtk.Widget.Gtk_Widget_Path;
      pragma Import (C, Internal, "gtk_container_get_path_for_child");
   begin
      return From_Object_Free (Internal (Get_Object (Container), Get_Object (Child)));
   end Get_Path_For_Child;

   ---------------------
   -- Get_Resize_Mode --
   ---------------------

   function Get_Resize_Mode
      (Container : not null access Gtk_Container_Record)
       return Gtk.Enums.Gtk_Resize_Mode
   is
      function Internal
         (Container : System.Address) return Gtk.Enums.Gtk_Resize_Mode;
      pragma Import (C, Internal, "gtk_container_get_resize_mode");
   begin
      return Internal (Get_Object (Container));
   end Get_Resize_Mode;

   --------------------
   -- Propagate_Draw --
   --------------------

   procedure Propagate_Draw
      (Container : not null access Gtk_Container_Record;
       Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class;
       Cr        : Cairo.Cairo_Context)
   is
      procedure Internal
         (Container : System.Address;
          Child     : System.Address;
          Cr        : Cairo.Cairo_Context);
      pragma Import (C, Internal, "gtk_container_propagate_draw");
   begin
      Internal (Get_Object (Container), Get_Object (Child), Cr);
   end Propagate_Draw;

   ------------
   -- Remove --
   ------------

   procedure Remove
      (Container : not null access Gtk_Container_Record;
       Widget    : not null access Gtk.Widget.Gtk_Widget_Record'Class)
   is
      procedure Internal
         (Container : System.Address;
          Widget    : System.Address);
      pragma Import (C, Internal, "gtk_container_remove");
   begin
      Internal (Get_Object (Container), Get_Object (Widget));
   end Remove;

   ---------------------
   -- Resize_Children --
   ---------------------

   procedure Resize_Children
      (Container : not null access Gtk_Container_Record)
   is
      procedure Internal (Container : System.Address);
      pragma Import (C, Internal, "gtk_container_resize_children");
   begin
      Internal (Get_Object (Container));
   end Resize_Children;

   ----------------------
   -- Set_Border_Width --
   ----------------------

   procedure Set_Border_Width
      (Container    : not null access Gtk_Container_Record;
       Border_Width : Guint)
   is
      procedure Internal (Container : System.Address; Border_Width : Guint);
      pragma Import (C, Internal, "gtk_container_set_border_width");
   begin
      Internal (Get_Object (Container), Border_Width);
   end Set_Border_Width;

   ---------------------
   -- Set_Focus_Chain --
   ---------------------

   procedure Set_Focus_Chain
      (Container         : not null access Gtk_Container_Record;
       Focusable_Widgets : Gtk.Widget.Widget_List.Glist)
   is
      procedure Internal
         (Container         : System.Address;
          Focusable_Widgets : System.Address);
      pragma Import (C, Internal, "gtk_container_set_focus_chain");
   begin
      Internal (Get_Object (Container), Gtk.Widget.Widget_List.Get_Object (Focusable_Widgets));
   end Set_Focus_Chain;

   ---------------------
   -- Set_Focus_Child --
   ---------------------

   procedure Set_Focus_Child
      (Container : not null access Gtk_Container_Record;
       Child     : access Gtk.Widget.Gtk_Widget_Record'Class)
   is
      procedure Internal
         (Container : System.Address;
          Child     : System.Address);
      pragma Import (C, Internal, "gtk_container_set_focus_child");
   begin
      Internal (Get_Object (Container), Get_Object_Or_Null (GObject (Child)));
   end Set_Focus_Child;

   ---------------------------
   -- Set_Focus_Hadjustment --
   ---------------------------

   procedure Set_Focus_Hadjustment
      (Container  : not null access Gtk_Container_Record;
       Adjustment : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class)
   is
      procedure Internal
         (Container  : System.Address;
          Adjustment : System.Address);
      pragma Import (C, Internal, "gtk_container_set_focus_hadjustment");
   begin
      Internal (Get_Object (Container), Get_Object (Adjustment));
   end Set_Focus_Hadjustment;

   ---------------------------
   -- Set_Focus_Vadjustment --
   ---------------------------

   procedure Set_Focus_Vadjustment
      (Container  : not null access Gtk_Container_Record;
       Adjustment : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class)
   is
      procedure Internal
         (Container  : System.Address;
          Adjustment : System.Address);
      pragma Import (C, Internal, "gtk_container_set_focus_vadjustment");
   begin
      Internal (Get_Object (Container), Get_Object (Adjustment));
   end Set_Focus_Vadjustment;

   ----------------------------
   -- Set_Reallocate_Redraws --
   ----------------------------

   procedure Set_Reallocate_Redraws
      (Container     : not null access Gtk_Container_Record;
       Needs_Redraws : Boolean)
   is
      procedure Internal
         (Container     : System.Address;
          Needs_Redraws : Glib.Gboolean);
      pragma Import (C, Internal, "gtk_container_set_reallocate_redraws");
   begin
      Internal (Get_Object (Container), Boolean'Pos (Needs_Redraws));
   end Set_Reallocate_Redraws;

   ---------------------
   -- Set_Resize_Mode --
   ---------------------

   procedure Set_Resize_Mode
      (Container   : not null access Gtk_Container_Record;
       Resize_Mode : Gtk.Enums.Gtk_Resize_Mode)
   is
      procedure Internal
         (Container   : System.Address;
          Resize_Mode : Gtk.Enums.Gtk_Resize_Mode);
      pragma Import (C, Internal, "gtk_container_set_resize_mode");
   begin
      Internal (Get_Object (Container), Resize_Mode);
   end Set_Resize_Mode;

   -----------------------
   -- Unset_Focus_Chain --
   -----------------------

   procedure Unset_Focus_Chain
      (Container : not null access Gtk_Container_Record)
   is
      procedure Internal (Container : System.Address);
      pragma Import (C, Internal, "gtk_container_unset_focus_chain");
   begin
      Internal (Get_Object (Container));
   end Unset_Focus_Chain;

   use type System.Address;

   function Cb_To_Address is new Ada.Unchecked_Conversion
     (Cb_Gtk_Container_Gtk_Widget_Void, System.Address);
   function Address_To_Cb is new Ada.Unchecked_Conversion
     (System.Address, Cb_Gtk_Container_Gtk_Widget_Void);

   function Cb_To_Address is new Ada.Unchecked_Conversion
     (Cb_GObject_Gtk_Widget_Void, System.Address);
   function Address_To_Cb is new Ada.Unchecked_Conversion
     (System.Address, Cb_GObject_Gtk_Widget_Void);

   function Cb_To_Address is new Ada.Unchecked_Conversion
     (Cb_Gtk_Container_Void, System.Address);
   function Address_To_Cb is new Ada.Unchecked_Conversion
     (System.Address, Cb_Gtk_Container_Void);

   function Cb_To_Address is new Ada.Unchecked_Conversion
     (Cb_GObject_Void, System.Address);
   function Address_To_Cb is new Ada.Unchecked_Conversion
     (System.Address, Cb_GObject_Void);

   procedure Connect
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_Gtk_Container_Gtk_Widget_Void;
       After   : Boolean);

   procedure Connect
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_Gtk_Container_Void;
       After   : Boolean);

   procedure Connect_Slot
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_GObject_Gtk_Widget_Void;
       After   : Boolean;
       Slot    : access Glib.Object.GObject_Record'Class := null);

   procedure Connect_Slot
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_GObject_Void;
       After   : Boolean;
       Slot    : access Glib.Object.GObject_Record'Class := null);

   procedure Marsh_GObject_Gtk_Widget_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address);
   pragma Convention (C, Marsh_GObject_Gtk_Widget_Void);

   procedure Marsh_GObject_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address);
   pragma Convention (C, Marsh_GObject_Void);

   procedure Marsh_Gtk_Container_Gtk_Widget_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address);
   pragma Convention (C, Marsh_Gtk_Container_Gtk_Widget_Void);

   procedure Marsh_Gtk_Container_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address);
   pragma Convention (C, Marsh_Gtk_Container_Void);

   -------------
   -- Connect --
   -------------

   procedure Connect
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_Gtk_Container_Gtk_Widget_Void;
       After   : Boolean)
   is
   begin
      Unchecked_Do_Signal_Connect
        (Object      => Object,
         C_Name      => C_Name,
         Marshaller  => Marsh_Gtk_Container_Gtk_Widget_Void'Access,
         Handler     => Cb_To_Address (Handler),--  Set in the closure
         After       => After);
   end Connect;

   -------------
   -- Connect --
   -------------

   procedure Connect
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_Gtk_Container_Void;
       After   : Boolean)
   is
   begin
      Unchecked_Do_Signal_Connect
        (Object      => Object,
         C_Name      => C_Name,
         Marshaller  => Marsh_Gtk_Container_Void'Access,
         Handler     => Cb_To_Address (Handler),--  Set in the closure
         After       => After);
   end Connect;

   ------------------
   -- Connect_Slot --
   ------------------

   procedure Connect_Slot
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_GObject_Gtk_Widget_Void;
       After   : Boolean;
       Slot    : access Glib.Object.GObject_Record'Class := null)
   is
   begin
      Unchecked_Do_Signal_Connect
        (Object      => Object,
         C_Name      => C_Name,
         Marshaller  => Marsh_GObject_Gtk_Widget_Void'Access,
         Handler     => Cb_To_Address (Handler),--  Set in the closure
         Slot_Object => Slot,
         After       => After);
   end Connect_Slot;

   ------------------
   -- Connect_Slot --
   ------------------

   procedure Connect_Slot
      (Object  : access Gtk_Container_Record'Class;
       C_Name  : Glib.Signal_Name;
       Handler : Cb_GObject_Void;
       After   : Boolean;
       Slot    : access Glib.Object.GObject_Record'Class := null)
   is
   begin
      Unchecked_Do_Signal_Connect
        (Object      => Object,
         C_Name      => C_Name,
         Marshaller  => Marsh_GObject_Void'Access,
         Handler     => Cb_To_Address (Handler),--  Set in the closure
         Slot_Object => Slot,
         After       => After);
   end Connect_Slot;

   -----------------------------------
   -- Marsh_GObject_Gtk_Widget_Void --
   -----------------------------------

   procedure Marsh_GObject_Gtk_Widget_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address)
   is
      pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data);
      H   : constant Cb_GObject_Gtk_Widget_Void := Address_To_Cb (Get_Callback (Closure));
      Obj : constant Glib.Object.GObject := Glib.Object.Convert (Get_Data (Closure));
   begin
      H (Obj, Gtk.Widget.Gtk_Widget (Unchecked_To_Object (Params, 1)));
      exception when E : others => Process_Exception (E);
   end Marsh_GObject_Gtk_Widget_Void;

   ------------------------
   -- Marsh_GObject_Void --
   ------------------------

   procedure Marsh_GObject_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address)
   is
      pragma Unreferenced (Return_Value, N_Params, Params, Invocation_Hint, User_Data);
      H   : constant Cb_GObject_Void := Address_To_Cb (Get_Callback (Closure));
      Obj : constant Glib.Object.GObject := Glib.Object.Convert (Get_Data (Closure));
   begin
      H (Obj);
      exception when E : others => Process_Exception (E);
   end Marsh_GObject_Void;

   -----------------------------------------
   -- Marsh_Gtk_Container_Gtk_Widget_Void --
   -----------------------------------------

   procedure Marsh_Gtk_Container_Gtk_Widget_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address)
   is
      pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data);
      H   : constant Cb_Gtk_Container_Gtk_Widget_Void := Address_To_Cb (Get_Callback (Closure));
      Obj : constant Gtk_Container := Gtk_Container (Unchecked_To_Object (Params, 0));
   begin
      H (Obj, Gtk.Widget.Gtk_Widget (Unchecked_To_Object (Params, 1)));
      exception when E : others => Process_Exception (E);
   end Marsh_Gtk_Container_Gtk_Widget_Void;

   ------------------------------
   -- Marsh_Gtk_Container_Void --
   ------------------------------

   procedure Marsh_Gtk_Container_Void
      (Closure         : GClosure;
       Return_Value    : Glib.Values.GValue;
       N_Params        : Glib.Guint;
       Params          : Glib.Values.C_GValues;
       Invocation_Hint : System.Address;
       User_Data       : System.Address)
   is
      pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data);
      H   : constant Cb_Gtk_Container_Void := Address_To_Cb (Get_Callback (Closure));
      Obj : constant Gtk_Container := Gtk_Container (Unchecked_To_Object (Params, 0));
   begin
      H (Obj);
      exception when E : others => Process_Exception (E);
   end Marsh_Gtk_Container_Void;

   ------------
   -- On_Add --
   ------------

   procedure On_Add
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_Gtk_Container_Gtk_Widget_Void;
       After : Boolean := False)
   is
   begin
      Connect (Self, "add" & ASCII.NUL, Call, After);
   end On_Add;

   ------------
   -- On_Add --
   ------------

   procedure On_Add
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_GObject_Gtk_Widget_Void;
       Slot  : not null access Glib.Object.GObject_Record'Class;
       After : Boolean := False)
   is
   begin
      Connect_Slot (Self, "add" & ASCII.NUL, Call, After, Slot);
   end On_Add;

   ---------------------
   -- On_Check_Resize --
   ---------------------

   procedure On_Check_Resize
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_Gtk_Container_Void;
       After : Boolean := False)
   is
   begin
      Connect (Self, "check-resize" & ASCII.NUL, Call, After);
   end On_Check_Resize;

   ---------------------
   -- On_Check_Resize --
   ---------------------

   procedure On_Check_Resize
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_GObject_Void;
       Slot  : not null access Glib.Object.GObject_Record'Class;
       After : Boolean := False)
   is
   begin
      Connect_Slot (Self, "check-resize" & ASCII.NUL, Call, After, Slot);
   end On_Check_Resize;

   ---------------
   -- On_Remove --
   ---------------

   procedure On_Remove
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_Gtk_Container_Gtk_Widget_Void;
       After : Boolean := False)
   is
   begin
      Connect (Self, "remove" & ASCII.NUL, Call, After);
   end On_Remove;

   ---------------
   -- On_Remove --
   ---------------

   procedure On_Remove
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_GObject_Gtk_Widget_Void;
       Slot  : not null access Glib.Object.GObject_Record'Class;
       After : Boolean := False)
   is
   begin
      Connect_Slot (Self, "remove" & ASCII.NUL, Call, After, Slot);
   end On_Remove;

   ------------------------
   -- On_Set_Focus_Child --
   ------------------------

   procedure On_Set_Focus_Child
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_Gtk_Container_Gtk_Widget_Void;
       After : Boolean := False)
   is
   begin
      Connect (Self, "set-focus-child" & ASCII.NUL, Call, After);
   end On_Set_Focus_Child;

   ------------------------
   -- On_Set_Focus_Child --
   ------------------------

   procedure On_Set_Focus_Child
      (Self  : not null access Gtk_Container_Record;
       Call  : Cb_GObject_Gtk_Widget_Void;
       Slot  : not null access Glib.Object.GObject_Record'Class;
       After : Boolean := False)
   is
   begin
      Connect_Slot (Self, "set-focus-child" & ASCII.NUL, Call, After, Slot);
   end On_Set_Focus_Child;

end Gtk.Container;