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