File: pango-tabs.ads

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (116 lines) | stat: -rw-r--r-- 5,079 bytes parent folder | download | duplicates (5)
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
-----------------------------------------------------------------------
--               GtkAda - Ada95 binding for Gtk+/Gnome               --
--                                                                   --
--                Copyright (C) 2005 AdaCore                         --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, 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    --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
-- General Public License for more details.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-----------------------------------------------------------------------

--  This package implements the notion of tab stops, to be used in the
--  context of a pango.layout or its higher level interface Gtk.Text_View.
--
--  This package allows you to define precise location (in pixels) in the
--  layout on which the <tab> character in the text will be aligned. This
--  allows you to easily align columns of text even when using a proportional
--  font for instance. This is similar to the standard interface that most
--  word processing tools provide through tab stops in their ruler bars.

--  <group>Pango, font handling</group>

with Glib;

package Pango.Tabs is

   type Pango_Tab_Array is limited private;
   Null_Tab_Array : constant Pango_Tab_Array;
   --  This type contains an array of tab stops. Each such stop has an
   --  alignment and a position. Several methods are provided to create such
   --  an array, either by spacing out the stops regularly, or by positioning
   --  them by yourself.

   type Pango_Tab_Align is (Pango_Tab_Left);
   pragma Convention (C, Pango_Tab_Align);
   --  This structure specifies where a tab stop appears relative to the text.

   procedure Pango_New
     (Tab_Array           : out Pango_Tab_Array;
      Initial_Size        : Glib.Gint;
      Positions_In_Pixels : Boolean := True);
   --  Create an array of Initial_Size tab stops. The position of these stops
   --  will be specified in pixel units if Position_In_Pixels is True, or in
   --  Pango units otherwise (see Pango.Enums.Pango_Scale).
   --  All stops are initially at position 0.
   --  It is legal to create an array of size 0.

   function Get_Type return Glib.GType;
   --  Return the internal type associated with a Pango_Tab_Array

   procedure Copy
     (Src    : Pango_Tab_Array;
      Target : out Pango_Tab_Array);
   --  Return a newly allocated copy of Src.

   procedure Free (Tab_Array : Pango_Tab_Array);
   --  Free the memory occupied by Tab_Array

   function Get_Size (Tab_Array : Pango_Tab_Array) return Glib.Gint;
   --  Return the number of tab stops in Tab_Array.

   procedure Resize
     (Tab_Array : Pango_Tab_Array;
      New_Size  : Glib.Gint);
   --  Resize Tab_Array. You must then initialize any stop that was added as a
   --  result of growing the array.

   procedure Set_Tab
     (Tab_Array : Pango_Tab_Array;
      Tab_Index : Glib.Gint;
      Alignment : Pango_Tab_Align := Pango_Tab_Left;
      Location  : Glib.Gint);
   --  Set the alignment and location of a tab stop.
   --  Location is either in pixel units or in pango units, depending on how
   --  Tab_Array was created.
   --  Tab_Index starts at 0.

   procedure Get_Tab
     (Tab_Array : Pango_Tab_Array;
      Tab_Index : Glib.Gint;
      Alignment : out Pango_Tab_Align;
      Location  : out Glib.Gint);
   --  Return the alignment and location of a tab stop.
   --  Tab_Index starts at 0.

   function Get_Positions_In_Pixels
     (Tab_Array : Pango_Tab_Array) return Boolean;
   --  Whether the position of tab stops is in pixel units, or in pango units.

private
   type Pango_Tab_Array is new Glib.C_Proxy;

   Null_Tab_Array : constant Pango_Tab_Array := null;

   pragma Import (C, Get_Type, "pango_tab_array_get_type");
   pragma Import (C, Free,     "pango_tab_array_free");
   pragma Import (C, Get_Size, "pango_tab_array_get_size");
   pragma Import (C, Resize,   "pango_tab_array_resize");
   pragma Import (C, Set_Tab,  "pango_tab_array_set_tab");
   pragma Import (C, Get_Tab,  "pango_tab_array_get_tab");
end Pango.Tabs;

--  missing:
--  pango_tab_array_new_with_positions
--  pango_tab_array_get_tabs