## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --          GtkAda - Ada95 binding for the Gimp Toolkit              --

3.     --                                                                   --

4.     --                     Copyright (C) 2006-2013, AdaCore              --

5.     --                                                                   --

6.     -- This library is free software; you can redistribute it and/or     --

7.     -- modify it under the terms of the GNU General Public               --

8.     -- License as published by the Free Software Foundation; either      --

9.     -- version 2 of the License, or (at your option) any later version.  --

10.     --                                                                   --

11.     -- This library is distributed in the hope that it will be useful,   --

12.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

13.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

14.     -- General Public License for more details.                          --

15.     --                                                                   --

16.     -- You should have received a copy of the GNU General Public         --

17.     -- License along with this library; if not, write to the             --

18.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

19.     -- Boston, MA 02111-1307, USA.                                       --

20.     --                                                                   --

21.     -- As a special exception, if other files instantiate generics from  --

22.     -- this unit, or you link this unit with other files to produce an   --

23.     -- executable, this  unit  does not  by itself cause  the resulting  --

24.     -- executable to be covered by the GNU General Public License. This  --

25.     -- exception does not however invalidate any other reasons why the   --

26.     -- executable file  might be covered by the  GNU Public License.     --

27.     -----------------------------------------------------------------------

29.     --  This package is purely internal to GtkAda.

30.     --  It was moved out of Gtkada.Bindings for elaboration circularity issues

32.     with Ada.Unchecked_Conversion;

33.     with System;

35.     package Gtkada.CTo API docTo specTo body is

37.        -------------

38.        --  Arrays --

39.        -------------

40.        --  The following functions ease bindings: when a C function returns an

41.        --  array or a pointer to an array, it returns a C array, ie which doesn't

42.        --  contain bounds. The size of the array is generally reported separately.

43.        --  The following definitions are suitable for use internally in the

44.        --  binding, but should not, when possible, be made visble to the user,

45.        --  since they don't behave like usual Ada arrays ('Last is irrelevant for

46.        --  instance).

47.        --

48.        --  For instance, if a C function has the following profile:

49.        --      gint* get_sizes (GtkIconTheme* theme);  --  0 terminated array

50.        --  when the binding is:

51.        --      function Internal (Theme) return Unbounded_Gint_Array_Access;

52.        --  and you need to compute for yourself the number of elements, and

53.        --  return a Glib.Gint_Array to the user.

54.        --

55.        --  If the C function has the following profile:

56.        --      gboolean get_attach_points (theme, GdkPoint** p, gint* n);

57.        --  then the binding is:

58.        --      function Internal (Theme  : System.Address;

59.        --                         Points : out Unbounded_Points_Array_Access;

60.        --                         N      : access Gint) return Gboolean;

61.        --  and you do the following:

62.        --      R : aliased Unbounded_Points_Array_Access;

63.        --      N : aliased Gint;

64.        --      Tmp : constant Gboolean :=

65.        --         Internal (.., R'Unchecked_Access, N'Unchecked_Access);

66.        --      Result : Gdk_Points_Array (1 .. Natural (N)) :=

67.        --         To_Gint_Array (R, Natural (N));

68.        --      Free (R);

69.        --      return Result;

71.        generic

72.           type T is private;

73.           Null_T : TTo API docTo spec;

74.           type Index is (<>);

75.           type T_Array is array (IndexTo API docTo spec range <>) of TTo API docTo spec;

76.        package Unbounded_ArraysTo API docTo body is

77.           type Unbounded_Array

78.             is array (IndexTo API docTo spec range IndexTo API docTo spec'Val (1) .. IndexTo API docTo spec'Last) of TTo API docTo spec;

79.           pragma Convention (CTo API docTo specTo body, Unbounded_ArrayTo API docTo spec);

80.           type Unbounded_Array_Access is access Unbounded_ArrayTo API docTo spec;

82.           procedure G_FreeTo API docTo body (Arr : Unbounded_Array_AccessTo API docTo spec);

84.           function To_ArrayTo API docTo body

85.             (Arr : Unbounded_Array_AccessTo API docTo spec; N : IndexTo API docTo spec) return T_ArrayTo API docTo spec;

87.           function Convert is new Ada.Unchecked_Conversion

88.             (System.Address, Unbounded_Array_AccessTo API docTo spec);

90.        private

91.           pragma Import (CTo API docTo specTo body, G_FreeTo API docTo spec, "g_free");

92.        end Unbounded_ArraysTo API docTo specTo body;

94.     end Gtkada.CTo API docTo specTo body;