1------------------------------------------------------------------------------
2--                                                                          --
3--      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       --
4--                     Copyright (C) 2000-2015, AdaCore                     --
5--                                                                          --
6-- This library is free software;  you can redistribute it and/or modify it --
7-- under terms of the  GNU General Public License  as published by the Free --
8-- Software  Foundation;  either version 3,  or (at your  option) any later --
9-- version. This library is distributed in the hope that it will be useful, --
10-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
12--                                                                          --
13-- As a special exception under Section 7 of GPL version 3, you are granted --
14-- additional permissions described in the GCC Runtime Library Exception,   --
15-- version 3.1, as published by the Free Software Foundation.               --
16--                                                                          --
17-- You should have received a copy of the GNU General Public License and    --
18-- a copy of the GCC Runtime Library Exception along with this program;     --
19-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
20-- <http://www.gnu.org/licenses/>.                                          --
21--                                                                          --
22------------------------------------------------------------------------------
23
24--  <description>
25--  A Pango.Tabs.Pango_Tab_Array struct contains an array of tab stops. Each
26--  tab stop has an alignment and a position.
27--
28--  </description>
29pragma Ada_2005;
30
31pragma Warnings (Off, "*is already use-visible*");
32with Glib;                    use Glib;
33with Glib.Generic_Properties; use Glib.Generic_Properties;
34
35package Pango.Tabs is
36
37   type Pango_Tab_Array is new Glib.C_Boxed with null record;
38   Null_Pango_Tab_Array : constant Pango_Tab_Array;
39
40   function From_Object (Object : System.Address) return Pango_Tab_Array;
41   function From_Object_Free (B : access Pango_Tab_Array'Class) return Pango_Tab_Array;
42   pragma Inline (From_Object_Free, From_Object);
43
44   type Pango_Tab_Align is (
45      Pango_Tab_Left);
46   pragma Convention (C, Pango_Tab_Align);
47   --  A Pango.Tabs.Pango_Tab_Align specifies where a tab stop appears
48   --  relative to the text.
49
50   ----------------------------
51   -- Enumeration Properties --
52   ----------------------------
53
54   package Pango_Tab_Align_Properties is
55      new Generic_Internal_Discrete_Property (Pango_Tab_Align);
56   type Property_Pango_Tab_Align is new Pango_Tab_Align_Properties.Property;
57
58   ------------------
59   -- Constructors --
60   ------------------
61
62   procedure Gdk_New
63      (Self                : out Pango_Tab_Array;
64       Initial_Size        : Gint;
65       Positions_In_Pixels : Boolean);
66   --  Creates an array of Initial_Size tab stops. Tab stops are specified in
67   --  pixel units if Positions_In_Pixels is True, otherwise in Pango units.
68   --  All stops are initially at position 0.
69   --  "initial_size": Initial number of tab stops to allocate, can be 0
70   --  "positions_in_pixels": whether positions are in pixel units
71
72   function Pango_Tab_Array_New
73      (Initial_Size        : Gint;
74       Positions_In_Pixels : Boolean) return Pango_Tab_Array;
75   --  Creates an array of Initial_Size tab stops. Tab stops are specified in
76   --  pixel units if Positions_In_Pixels is True, otherwise in Pango units.
77   --  All stops are initially at position 0.
78   --  "initial_size": Initial number of tab stops to allocate, can be 0
79   --  "positions_in_pixels": whether positions are in pixel units
80
81   function Get_Type return Glib.GType;
82   pragma Import (C, Get_Type, "pango_tab_array_get_type");
83
84   -------------
85   -- Methods --
86   -------------
87
88   function Copy (Self : Pango_Tab_Array) return Pango_Tab_Array;
89   --  Copies a Pango.Tabs.Pango_Tab_Array
90
91   procedure Free (Self : Pango_Tab_Array);
92   --  Frees a tab array and associated resources.
93
94   function Get_Positions_In_Pixels (Self : Pango_Tab_Array) return Boolean;
95   --  Returns True if the tab positions are in pixels, False if they are in
96   --  Pango units.
97
98   function Get_Size (Self : Pango_Tab_Array) return Gint;
99   --  Gets the number of tab stops in Tab_Array.
100
101   procedure Get_Tab
102      (Self      : Pango_Tab_Array;
103       Tab_Index : Gint;
104       Alignment : out Pango_Tab_Align;
105       Location  : out Gint);
106   --  Gets the alignment and position of a tab stop.
107   --  "tab_index": tab stop index
108   --  "alignment": location to store alignment, or null
109   --  "location": location to store tab position, or null
110
111   procedure Set_Tab
112      (Self      : Pango_Tab_Array;
113       Tab_Index : Gint;
114       Alignment : Pango_Tab_Align;
115       Location  : Gint);
116   --  Sets the alignment and location of a tab stop. Alignment must always be
117   --  PANGO_TAB_LEFT in the current implementation.
118   --  "tab_index": the index of a tab stop
119   --  "alignment": tab alignment
120   --  "location": tab location in Pango units
121
122   procedure Resize (Self : Pango_Tab_Array; New_Size : Gint);
123   --  Resizes a tab array. You must subsequently initialize any tabs that
124   --  were added as a result of growing the array.
125   --  "new_size": new size of the array
126
127private
128
129   Null_Pango_Tab_Array : constant Pango_Tab_Array := (Glib.C_Boxed with null record);
130
131end Pango.Tabs;
132