1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2005 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. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  This package implements the notion of tab stops, to be used in the 
  25. --  context of a pango.layout or its higher level interface Gtk.Text_View. 
  26. -- 
  27. --  This package allows you to define precise location (in pixels) in the 
  28. --  layout on which the <tab> character in the text will be aligned. This 
  29. --  allows you to easily align columns of text even when using a proportional 
  30. --  font for instance. This is similar to the standard interface that most 
  31. --  word processing tools provide through tab stops in their ruler bars. 
  32.  
  33. --  <group>Pango, font handling</group> 
  34.  
  35. with Glib; 
  36.  
  37. package Pango.Tabs is 
  38.  
  39.    type Pango_Tab_Array is limited private; 
  40.    Null_Tab_Array : constant Pango_Tab_Array; 
  41.    --  This type contains an array of tab stops. Each such stop has an 
  42.    --  alignment and a position. Several methods are provided to create such 
  43.    --  an array, either by spacing out the stops regularly, or by positioning 
  44.    --  them by yourself. 
  45.  
  46.    type Pango_Tab_Align is (Pango_Tab_Left); 
  47.    pragma Convention (C, Pango_Tab_Align); 
  48.    --  This structure specifies where a tab stop appears relative to the text. 
  49.  
  50.    procedure Pango_New 
  51.      (Tab_Array           : out Pango_Tab_Array; 
  52.       Initial_Size        : Glib.Gint; 
  53.       Positions_In_Pixels : Boolean := True); 
  54.    --  Create an array of Initial_Size tab stops. The position of these stops 
  55.    --  will be specified in pixel units if Position_In_Pixels is True, or in 
  56.    --  Pango units otherwise (see Pango.Enums.Pango_Scale). 
  57.    --  All stops are initially at position 0. 
  58.    --  It is legal to create an array of size 0. 
  59.  
  60.    function Get_Type return Glib.GType; 
  61.    --  Return the internal type associated with a Pango_Tab_Array 
  62.  
  63.    procedure Copy 
  64.      (Src    : Pango_Tab_Array; 
  65.       Target : out Pango_Tab_Array); 
  66.    --  Return a newly allocated copy of Src. 
  67.  
  68.    procedure Free (Tab_Array : Pango_Tab_Array); 
  69.    --  Free the memory occupied by Tab_Array 
  70.  
  71.    function Get_Size (Tab_Array : Pango_Tab_Array) return Glib.Gint; 
  72.    --  Return the number of tab stops in Tab_Array. 
  73.  
  74.    procedure Resize 
  75.      (Tab_Array : Pango_Tab_Array; 
  76.       New_Size  : Glib.Gint); 
  77.    --  Resize Tab_Array. You must then initialize any stop that was added as a 
  78.    --  result of growing the array. 
  79.  
  80.    procedure Set_Tab 
  81.      (Tab_Array : Pango_Tab_Array; 
  82.       Tab_Index : Glib.Gint; 
  83.       Alignment : Pango_Tab_Align := Pango_Tab_Left; 
  84.       Location  : Glib.Gint); 
  85.    --  Set the alignment and location of a tab stop. 
  86.    --  Location is either in pixel units or in pango units, depending on how 
  87.    --  Tab_Array was created. 
  88.    --  Tab_Index starts at 0. 
  89.  
  90.    procedure Get_Tab 
  91.      (Tab_Array : Pango_Tab_Array; 
  92.       Tab_Index : Glib.Gint; 
  93.       Alignment : out Pango_Tab_Align; 
  94.       Location  : out Glib.Gint); 
  95.    --  Return the alignment and location of a tab stop. 
  96.    --  Tab_Index starts at 0. 
  97.  
  98.    function Get_Positions_In_Pixels 
  99.      (Tab_Array : Pango_Tab_Array) return Boolean; 
  100.    --  Whether the position of tab stops is in pixel units, or in pango units. 
  101.  
  102. private 
  103.    type Pango_Tab_Array is new Glib.C_Proxy; 
  104.  
  105.    Null_Tab_Array : constant Pango_Tab_Array := null; 
  106.  
  107.    pragma Import (C, Get_Type, "pango_tab_array_get_type"); 
  108.    pragma Import (C, Free,     "pango_tab_array_free"); 
  109.    pragma Import (C, Get_Size, "pango_tab_array_get_size"); 
  110.    pragma Import (C, Resize,   "pango_tab_array_resize"); 
  111.    pragma Import (C, Set_Tab,  "pango_tab_array_set_tab"); 
  112.    pragma Import (C, Get_Tab,  "pango_tab_array_get_tab"); 
  113. end Pango.Tabs; 
  114.  
  115. --  missing: 
  116. --  pango_tab_array_new_with_positions 
  117. --  pango_tab_array_get_tabs