1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, 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. pragma Ada_2005; 
  25.  
  26. pragma Warnings (Off, "*is already use-visible*"); 
  27. with Glib;                    use Glib; 
  28. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  29. with Glib.Object;             use Glib.Object; 
  30. with Gtkada.Types;            use Gtkada.Types; 
  31. with Pango.Attributes;        use Pango.Attributes; 
  32. with Pango.Context;           use Pango.Context; 
  33. with Pango.Enums;             use Pango.Enums; 
  34. with Pango.Font;              use Pango.Font; 
  35. with Pango.Tabs;              use Pango.Tabs; 
  36.  
  37. package Pango.Layout is 
  38.  
  39.    type Pango_Layout_Record is new GObject_Record with null record; 
  40.    type Pango_Layout is access all Pango_Layout_Record'Class; 
  41.  
  42.    type Pango_Ellipsize_Mode is ( 
  43.       Ellipsize_None, 
  44.       Ellipsize_Start, 
  45.       Ellipsize_Middle, 
  46.       Ellipsize_End); 
  47.    pragma Convention (C, Pango_Ellipsize_Mode); 
  48.    --  The Pango.Layout.Pango_Ellipsize_Mode type describes what sort of (if 
  49.    --  any) ellipsization should be applied to a line of text. In the 
  50.    --  ellipsization process characters are removed from the text in order to 
  51.    --  make it fit to a given width and replaced with an ellipsis. 
  52.  
  53.    type Pango_Layout_Iter is new Glib.C_Boxed with null record; 
  54.    Null_Pango_Layout_Iter : constant Pango_Layout_Iter; 
  55.  
  56.    function From_Object (Object : System.Address) return Pango_Layout_Iter; 
  57.    function From_Object_Free (B : access Pango_Layout_Iter'Class) return Pango_Layout_Iter; 
  58.    pragma Inline (From_Object_Free, From_Object); 
  59.  
  60.    type Pango_Layout_Line is private; 
  61.    function From_Object_Free (B : access Pango_Layout_Line) return Pango_Layout_Line; 
  62.    pragma Inline (From_Object_Free); 
  63.  
  64.    ---------------------------- 
  65.    -- Enumeration Properties -- 
  66.    ---------------------------- 
  67.  
  68.    package Pango_Ellipsize_Mode_Properties is 
  69.       new Generic_Internal_Discrete_Property (Pango_Ellipsize_Mode); 
  70.    type Property_Pango_Ellipsize_Mode is new Pango_Ellipsize_Mode_Properties.Property; 
  71.  
  72.    ------------------ 
  73.    -- Constructors -- 
  74.    ------------------ 
  75.  
  76.    procedure Gdk_New 
  77.       (Layout  : out Pango_Layout; 
  78.        Context : not null access Pango.Context.Pango_Context_Record'Class); 
  79.    --  Create a new Pango.Layout.Pango_Layout object with attributes 
  80.    --  initialized to default values for a particular 
  81.    --  Pango.Context.Pango_Context. 
  82.    --  "context": a Pango.Context.Pango_Context 
  83.  
  84.    procedure Initialize 
  85.       (Layout  : not null access Pango_Layout_Record'Class; 
  86.        Context : not null access Pango.Context.Pango_Context_Record'Class); 
  87.    --  Create a new Pango.Layout.Pango_Layout object with attributes 
  88.    --  initialized to default values for a particular 
  89.    --  Pango.Context.Pango_Context. 
  90.    --  "context": a Pango.Context.Pango_Context 
  91.  
  92.    function Pango_Layout_New 
  93.       (Context : not null access Pango.Context.Pango_Context_Record'Class) 
  94.        return Pango_Layout; 
  95.    --  Create a new Pango.Layout.Pango_Layout object with attributes 
  96.    --  initialized to default values for a particular 
  97.    --  Pango.Context.Pango_Context. 
  98.    --  "context": a Pango.Context.Pango_Context 
  99.  
  100.    function Get_Type return Glib.GType; 
  101.    pragma Import (C, Get_Type, "pango_layout_get_type"); 
  102.  
  103.    function Get_Type_Layout_Iter return Glib.GType; 
  104.    pragma Import (C, Get_Type_Layout_Iter, "pango_layout_iter_get_type"); 
  105.  
  106.    function Get_Type_Layout_Line return Glib.GType; 
  107.    pragma Import (C, Get_Type_Layout_Line, "pango_layout_line_get_type"); 
  108.  
  109.    ------------- 
  110.    -- Methods -- 
  111.    ------------- 
  112.  
  113.    procedure Context_Changed (Layout : not null access Pango_Layout_Record); 
  114.    --  Forces recomputation of any state in the Pango.Layout.Pango_Layout that 
  115.    --  might depend on the layout's context. This function should be called if 
  116.    --  you make changes to the context subsequent to creating the layout. 
  117.  
  118.    function Copy 
  119.       (Layout : not null access Pango_Layout_Record) return Pango_Layout; 
  120.    --  Does a deep copy-by-value of the Src layout. The attribute list, tab 
  121.    --  array, and text from the original layout are all copied by value. 
  122.  
  123.    function Copy (Self : Pango_Layout_Iter) return Pango_Layout_Iter; 
  124.    --  Copies a Pango.Layout.Pango_Layout_Iter. 
  125.    --  Since: gtk+ 1.20 
  126.  
  127.    function Get_Alignment 
  128.       (Layout : not null access Pango_Layout_Record) 
  129.        return Pango.Enums.Alignment; 
  130.    --  Gets the alignment for the layout: how partial lines are positioned 
  131.    --  within the horizontal space available. 
  132.  
  133.    procedure Set_Alignment 
  134.       (Layout    : not null access Pango_Layout_Record; 
  135.        Alignment : Pango.Enums.Alignment); 
  136.    --  Sets the alignment for the layout: how partial lines are positioned 
  137.    --  within the horizontal space available. 
  138.    --  "alignment": the alignment 
  139.  
  140.    function Get_Attributes 
  141.       (Layout : not null access Pango_Layout_Record) 
  142.        return Pango.Attributes.Pango_Attr_List; 
  143.    --  Gets the attribute list for the layout, if any. 
  144.  
  145.    procedure Set_Attributes 
  146.       (Layout : not null access Pango_Layout_Record; 
  147.        Attrs  : Pango.Attributes.Pango_Attr_List); 
  148.    --  Sets the text attributes for a layout object. References Attrs, so the 
  149.    --  caller can unref its reference. 
  150.    --  "attrs": a Pango.Attributes.Pango_Attr_List, can be null 
  151.  
  152.    function Get_Auto_Dir 
  153.       (Layout : not null access Pango_Layout_Record) return Boolean; 
  154.    --  Gets whether to calculate the bidirectional base direction for the 
  155.    --  layout according to the contents of the layout. See 
  156.    --  Pango.Layout.Set_Auto_Dir. 
  157.    --  Since: gtk+ 1.4 
  158.  
  159.    procedure Set_Auto_Dir 
  160.       (Layout   : not null access Pango_Layout_Record; 
  161.        Auto_Dir : Boolean); 
  162.    --  Sets whether to calculate the bidirectional base direction for the 
  163.    --  layout according to the contents of the layout; when this flag is on 
  164.    --  (the default), then paragraphs in Layout that begin with strong 
  165.    --  right-to-left characters (Arabic and Hebrew principally), will have 
  166.    --  right-to-left layout, paragraphs with letters from other scripts will 
  167.    --  have left-to-right layout. Paragraphs with only neutral characters get 
  168.    --  their direction from the surrounding paragraphs. 
  169.    --  When False, the choice between left-to-right and right-to-left layout 
  170.    --  is done according to the base direction of the layout's 
  171.    --  Pango.Context.Pango_Context. (See Pango.Context.Set_Base_Dir). 
  172.    --  When the auto-computed direction of a paragraph differs from the base 
  173.    --  direction of the context, the interpretation of 
  174.    --  Pango.Enums.Pango_Align_Left and Pango.Enums.Pango_Align_Right are 
  175.    --  swapped. 
  176.    --  Since: gtk+ 1.4 
  177.    --  "auto_dir": if True, compute the bidirectional base direction from the 
  178.    --  layout's contents. 
  179.  
  180.    function Get_Baseline 
  181.       (Layout : not null access Pango_Layout_Record) return Gint; 
  182.    --  Gets the Y position of baseline of the first line in Layout. 
  183.    --  Since: gtk+ 1.22 
  184.  
  185.    function Get_Baseline (Self : Pango_Layout_Iter) return Gint; 
  186.    --  Gets the Y position of the current line's baseline, in layout 
  187.    --  coordinates (origin at top left of the entire layout). 
  188.  
  189.    function Get_Character_Count 
  190.       (Layout : not null access Pango_Layout_Record) return Gint; 
  191.    --  Returns the number of Unicode characters in the the text of Layout. 
  192.    --  Since: gtk+ 1.30 
  193.  
  194.    function Get_Context 
  195.       (Layout : not null access Pango_Layout_Record) 
  196.        return Pango.Context.Pango_Context; 
  197.    --  Retrieves the Pango.Context.Pango_Context used for this layout. 
  198.  
  199.    procedure Get_Cursor_Pos 
  200.       (Layout     : not null access Pango_Layout_Record; 
  201.        Index      : Gint; 
  202.        Strong_Pos : out Pango_Rectangle; 
  203.        Weak_Pos   : out Pango_Rectangle); 
  204.    --  Given an index within a layout, determines the positions that of the 
  205.    --  strong and weak cursors if the insertion point is at that index. The 
  206.    --  position of each cursor is stored as a zero-width rectangle. The strong 
  207.    --  cursor location is the location where characters of the directionality 
  208.    --  equal to the base direction of the layout are inserted. The weak cursor 
  209.    --  location is the location where characters of the directionality opposite 
  210.    --  to the base direction of the layout are inserted. 
  211.    --  "index_": the byte index of the cursor 
  212.    --  "strong_pos": location to store the strong cursor position (may be 
  213.    --  null) 
  214.    --  "weak_pos": location to store the weak cursor position (may be null) 
  215.  
  216.    function Get_Ellipsize 
  217.       (Layout : not null access Pango_Layout_Record) 
  218.        return Pango_Ellipsize_Mode; 
  219.    --  Gets the type of ellipsization being performed for Layout. See 
  220.    --  Pango.Layout.Set_Ellipsize 
  221.    --  Since: gtk+ 1.6 
  222.  
  223.    procedure Set_Ellipsize 
  224.       (Layout    : not null access Pango_Layout_Record; 
  225.        Ellipsize : Pango_Ellipsize_Mode); 
  226.    --  Sets the type of ellipsization being performed for Layout. Depending on 
  227.    --  the ellipsization mode Ellipsize text is removed from the start, middle, 
  228.    --  or end of text so they fit within the width and height of layout set 
  229.    --  with Pango.Layout.Set_Width and Pango.Layout.Set_Height. 
  230.    --  If the layout contains characters such as newlines that force it to be 
  231.    --  layed out in multiple paragraphs, then whether each paragraph is 
  232.    --  ellipsized separately or the entire layout is ellipsized as a whole 
  233.    --  depends on the set height of the layout. See Pango.Layout.Set_Height for 
  234.    --  details. 
  235.    --  Since: gtk+ 1.6 
  236.    --  "ellipsize": the new ellipsization mode for Layout 
  237.  
  238.    procedure Get_Extents 
  239.       (Layout       : not null access Pango_Layout_Record; 
  240.        Ink_Rect     : out Pango_Rectangle; 
  241.        Logical_Rect : out Pango_Rectangle); 
  242.    --  Computes the logical and ink extents of Layout. Logical extents are 
  243.    --  usually what you want for positioning things. Note that both extents may 
  244.    --  have non-zero x and y. You may want to use those to offset where you 
  245.    --  render the layout. Not doing that is a very typical bug that shows up as 
  246.    --  right-to-left layouts not being correctly positioned in a layout with a 
  247.    --  set width. 
  248.    --  The extents are given in layout coordinates and in Pango units; layout 
  249.    --  coordinates begin at the top left corner of the layout. 
  250.    --  "ink_rect": rectangle used to store the extents of the layout as drawn 
  251.    --  or null to indicate that the result is not needed. 
  252.    --  "logical_rect": rectangle used to store the logical extents of the 
  253.    --  layout or null to indicate that the result is not needed. 
  254.  
  255.    function Get_Font_Description 
  256.       (Layout : not null access Pango_Layout_Record) 
  257.        return Pango.Font.Pango_Font_Description; 
  258.    --  Gets the font description for the layout, if any. 
  259.    --  Since: gtk+ 1.8 
  260.  
  261.    procedure Set_Font_Description 
  262.       (Layout : not null access Pango_Layout_Record; 
  263.        Desc   : Pango.Font.Pango_Font_Description); 
  264.    --  Sets the default font description for the layout. If no font 
  265.    --  description is set on the layout, the font description from the layout's 
  266.    --  context is used. 
  267.    --  "desc": the new Pango.Font.Pango_Font_Description, or null to unset the 
  268.    --  current font description 
  269.  
  270.    function Get_Height 
  271.       (Layout : not null access Pango_Layout_Record) return Gint; 
  272.    --  Gets the height of layout used for ellipsization. See 
  273.    --  Pango.Layout.Set_Height for details. 
  274.    --  Since: gtk+ 1.20 
  275.  
  276.    procedure Set_Height 
  277.       (Layout : not null access Pango_Layout_Record; 
  278.        Height : Gint); 
  279.    --  Sets the height to which the Pango.Layout.Pango_Layout should be 
  280.    --  ellipsized at. There are two different behaviors, based on whether 
  281.    --  Height is positive or negative. 
  282.    --  If Height is positive, it will be the maximum height of the layout. 
  283.    --  Only lines would be shown that would fit, and if there is any text 
  284.    --  omitted, an ellipsis added. At least one line is included in each 
  285.    --  paragraph regardless of how small the height value is. A value of zero 
  286.    --  will render exactly one line for the entire layout. 
  287.    --  If Height is negative, it will be the (negative of) maximum number of 
  288.    --  lines per paragraph. That is, the total number of lines shown may well 
  289.    --  be more than this value if the layout contains multiple paragraphs of 
  290.    --  text. The default value of -1 means that first line of each paragraph is 
  291.    --  ellipsized. This behvaior may be changed in the future to act per layout 
  292.    --  instead of per paragraph. File a bug against pango at <ulink 
  293.    --  url="http://bugzilla.gnome.org/">http://bugzilla.gnome.org/</ulink> if 
  294.    --  your code relies on this behavior. 
  295.    --  Height setting only has effect if a positive width is set on Layout and 
  296.    --  ellipsization mode of Layout is not Pango.Layout.Ellipsize_None. The 
  297.    --  behavior is undefined if a height other than -1 is set and ellipsization 
  298.    --  mode is set to Pango.Layout.Ellipsize_None, and may change in the 
  299.    --  future. 
  300.    --  Since: gtk+ 1.20 
  301.    --  "height": the desired height of the layout in Pango units if positive, 
  302.    --  or desired number of lines if negative. 
  303.  
  304.    function Get_Indent 
  305.       (Layout : not null access Pango_Layout_Record) return Gint; 
  306.    --  Gets the paragraph indent width in Pango units. A negative value 
  307.    --  indicates a hanging indentation. 
  308.  
  309.    procedure Set_Indent 
  310.       (Layout : not null access Pango_Layout_Record; 
  311.        Indent : Gint); 
  312.    --  Sets the width in Pango units to indent each paragraph. A negative 
  313.    --  value of Indent will produce a hanging indentation. That is, the first 
  314.    --  line will have the full width, and subsequent lines will be indented by 
  315.    --  the absolute value of Indent. 
  316.    --  The indent setting is ignored if layout alignment is set to 
  317.    --  Pango.Enums.Pango_Align_Center. 
  318.    --  "indent": the amount by which to indent. 
  319.  
  320.    function Get_Iter 
  321.       (Layout : not null access Pango_Layout_Record'Class) 
  322.        return Pango_Layout_Iter; 
  323.    --  Returns an iterator to iterate over the visual extents of the layout. 
  324.  
  325.    function Get_Justify 
  326.       (Layout : not null access Pango_Layout_Record) return Boolean; 
  327.    --  Gets whether each complete line should be stretched to fill the entire 
  328.    --  width of the layout. 
  329.  
  330.    procedure Set_Justify 
  331.       (Layout  : not null access Pango_Layout_Record; 
  332.        Justify : Boolean); 
  333.    --  Sets whether each complete line should be stretched to fill the entire 
  334.    --  width of the layout. This stretching is typically done by adding 
  335.    --  whitespace, but for some scripts (such as Arabic), the justification may 
  336.    --  be done in more complex ways, like extending the characters. 
  337.    --  Note that this setting is not implemented and so is ignored in Pango 
  338.    --  older than 1.18. 
  339.    --  "justify": whether the lines in the layout should be justified. 
  340.  
  341.    function Get_Line 
  342.       (Layout : not null access Pango_Layout_Record; 
  343.        Line   : Gint) return Pango_Layout_Line; 
  344.    --  Retrieves a particular line from a Pango.Layout.Pango_Layout. 
  345.    --  Use the faster Pango.Layout.Get_Line_Readonly if you do not plan to 
  346.    --  modify the contents of the line (glyphs, glyph widths, etc.). 
  347.    --  "line": the index of a line, which must be between 0 and 
  348.    --  'pango_layout_get_line_count(layout) - 1', inclusive. 
  349.  
  350.    function Get_Line (Self : Pango_Layout_Iter) return Pango_Layout_Line; 
  351.    --  Gets the current line. 
  352.    --  Use the faster Pango.Layout.Get_Line_Readonly if you do not plan to 
  353.    --  modify the contents of the line (glyphs, glyph widths, etc.). 
  354.  
  355.    function Get_Line_Count 
  356.       (Layout : not null access Pango_Layout_Record) return Gint; 
  357.    --  Retrieves the count of lines for the Layout. 
  358.  
  359.    function Get_Line_Readonly 
  360.       (Layout : not null access Pango_Layout_Record; 
  361.        Line   : Gint) return Pango_Layout_Line; 
  362.    --  Retrieves a particular line from a Pango.Layout.Pango_Layout. 
  363.    --  This is a faster alternative to Pango.Layout.Get_Line, but the user is 
  364.    --  not expected to modify the contents of the line (glyphs, glyph widths, 
  365.    --  etc.). 
  366.    --  Since: gtk+ 1.16 
  367.    --  "line": the index of a line, which must be between 0 and 
  368.    --  'pango_layout_get_line_count(layout) - 1', inclusive. 
  369.  
  370.    function Get_Line_Readonly 
  371.       (Self : Pango_Layout_Iter) return Pango_Layout_Line; 
  372.    --  Gets the current line for read-only access. 
  373.    --  This is a faster alternative to Pango.Layout.Get_Line, but the user is 
  374.    --  not expected to modify the contents of the line (glyphs, glyph widths, 
  375.    --  etc.). 
  376.    --  Since: gtk+ 1.16 
  377.  
  378.    procedure Get_Pixel_Extents 
  379.       (Layout       : not null access Pango_Layout_Record; 
  380.        Ink_Rect     : out Pango_Rectangle; 
  381.        Logical_Rect : out Pango_Rectangle); 
  382.    --  Computes the logical and ink extents of Layout in device units. This 
  383.    --  function just calls Pango.Layout.Get_Extents followed by two 
  384.    --  pango_extents_to_pixels calls, rounding Ink_Rect and Logical_Rect such 
  385.    --  that the rounded rectangles fully contain the unrounded one (that is, 
  386.    --  passes them as first argument to pango_extents_to_pixels). 
  387.    --  "ink_rect": rectangle used to store the extents of the layout as drawn 
  388.    --  or null to indicate that the result is not needed. 
  389.    --  "logical_rect": rectangle used to store the logical extents of the 
  390.    --  layout or null to indicate that the result is not needed. 
  391.  
  392.    procedure Get_Pixel_Size 
  393.       (Layout : not null access Pango_Layout_Record; 
  394.        Width  : out Gint; 
  395.        Height : out Gint); 
  396.    --  Determines the logical width and height of a Pango.Layout.Pango_Layout 
  397.    --  in device units. (pango_layout_get_size returns the width and height 
  398.    --  scaled by PANGO_SCALE.) This is simply a convenience function around 
  399.    --  Pango.Layout.Get_Pixel_Extents. 
  400.    --  "width": location to store the logical width, or null 
  401.    --  "height": location to store the logical height, or null 
  402.  
  403.    function Get_Serial 
  404.       (Layout : not null access Pango_Layout_Record) return Guint; 
  405.    --  Returns the current serial number of Layout. The serial number is 
  406.    --  initialized to an small number larger than zero when a new layout is 
  407.    --  created and is increased whenever the layout is changed using any of the 
  408.    --  setter functions, or the Pango.Context.Pango_Context it uses has 
  409.    --  changed. The serial may wrap, but will never have the value 0. Since it 
  410.    --  can wrap, never compare it with "less than", always use "not equals". 
  411.    --  This can be used to automatically detect changes to a 
  412.    --  Pango.Layout.Pango_Layout, and is useful for example to decide whether a 
  413.    --  layout needs redrawing. To force the serial to be increased, use 
  414.    --  Pango.Layout.Context_Changed. 
  415.    --  Since: gtk+ 1.32.4 
  416.  
  417.    function Get_Single_Paragraph_Mode 
  418.       (Layout : not null access Pango_Layout_Record) return Boolean; 
  419.    --  Obtains the value set by Pango.Layout.Set_Single_Paragraph_Mode. 
  420.  
  421.    procedure Set_Single_Paragraph_Mode 
  422.       (Layout  : not null access Pango_Layout_Record; 
  423.        Setting : Boolean); 
  424.    --  If Setting is True, do not treat newlines and similar characters as 
  425.    --  paragraph separators; instead, keep all text in a single paragraph, and 
  426.    --  display a glyph for paragraph separator characters. Used when you want 
  427.    --  to allow editing of newlines on a single text line. 
  428.    --  "setting": new setting 
  429.  
  430.    procedure Get_Size 
  431.       (Layout : not null access Pango_Layout_Record; 
  432.        Width  : out Gint; 
  433.        Height : out Gint); 
  434.    --  Determines the logical width and height of a Pango.Layout.Pango_Layout 
  435.    --  in Pango units (device units scaled by PANGO_SCALE). This is simply a 
  436.    --  convenience function around Pango.Layout.Get_Extents. 
  437.    --  "width": location to store the logical width, or null 
  438.    --  "height": location to store the logical height, or null 
  439.  
  440.    function Get_Spacing 
  441.       (Layout : not null access Pango_Layout_Record) return Gint; 
  442.    --  Gets the amount of spacing between the lines of the layout. 
  443.  
  444.    procedure Set_Spacing 
  445.       (Layout  : not null access Pango_Layout_Record; 
  446.        Spacing : Gint); 
  447.    --  Sets the amount of spacing in Pango unit between the lines of the 
  448.    --  layout. 
  449.    --  "spacing": the amount of spacing 
  450.  
  451.    function Get_Tabs 
  452.       (Layout : not null access Pango_Layout_Record) 
  453.        return Pango.Tabs.Pango_Tab_Array; 
  454.    --  Gets the current Pango.Tabs.Pango_Tab_Array used by this layout. If no 
  455.    --  Pango.Tabs.Pango_Tab_Array has been set, then the default tabs are in 
  456.    --  use and null is returned. Default tabs are every 8 spaces. The return 
  457.    --  value should be freed with Pango.Tabs.Free. 
  458.  
  459.    procedure Set_Tabs 
  460.       (Layout : not null access Pango_Layout_Record; 
  461.        Tabs   : Pango.Tabs.Pango_Tab_Array); 
  462.    --  Sets the tabs to use for Layout, overriding the default tabs (by 
  463.    --  default, tabs are every 8 spaces). If Tabs is null, the default tabs are 
  464.    --  reinstated. Tabs is copied into the layout; you must free your copy of 
  465.    --  Tabs yourself. 
  466.    --  "tabs": a Pango.Tabs.Pango_Tab_Array, or null 
  467.  
  468.    function Get_Text 
  469.       (Layout : not null access Pango_Layout_Record) return UTF8_String; 
  470.    --  Gets the text in the layout. The returned text should not be freed or 
  471.    --  modified. 
  472.  
  473.    procedure Set_Text 
  474.       (Layout : not null access Pango_Layout_Record; 
  475.        Text   : UTF8_String); 
  476.    --  Sets the text of the layout. 
  477.    --  Note that if you have used Pango.Layout.Set_Markup or 
  478.    --  Pango.Layout.Set_Markup_With_Accel on Layout before, you may want to 
  479.    --  call Pango.Layout.Set_Attributes to clear the attributes set on the 
  480.    --  layout from the markup as this function does not clear attributes. 
  481.    --  "text": a valid UTF-8 string 
  482.  
  483.    function Get_Unknown_Glyphs_Count 
  484.       (Layout : not null access Pango_Layout_Record) return Gint; 
  485.    --  Counts the number unknown glyphs in Layout. That is, zero if glyphs for 
  486.    --  all characters in the layout text were found, or more than zero 
  487.    --  otherwise. 
  488.    --  This function can be used to determine if there are any fonts available 
  489.    --  to render all characters in a certain string, or when used in 
  490.    --  combination with Pango.Enums.Pango_Attr_Fallback, to check if a certain 
  491.    --  font supports all the characters in the string. 
  492.    --  Since: gtk+ 1.16 
  493.  
  494.    function Get_Width 
  495.       (Layout : not null access Pango_Layout_Record) return Gint; 
  496.    --  Gets the width to which the lines of the Pango.Layout.Pango_Layout 
  497.    --  should wrap. 
  498.  
  499.    procedure Set_Width 
  500.       (Layout : not null access Pango_Layout_Record; 
  501.        Width  : Gint); 
  502.    --  Sets the width to which the lines of the Pango.Layout.Pango_Layout 
  503.    --  should wrap or ellipsized. The default value is -1: no width set. 
  504.    --  "width": the desired width in Pango units, or -1 to indicate that no 
  505.    --  wrapping or ellipsization should be performed. 
  506.  
  507.    function Get_Wrap 
  508.       (Layout : not null access Pango_Layout_Record) 
  509.        return Pango.Enums.Wrap_Mode; 
  510.    --  Gets the wrap mode for the layout. 
  511.    --  Use Pango.Layout.Is_Wrapped to query whether any paragraphs were 
  512.    --  actually wrapped. 
  513.  
  514.    procedure Set_Wrap 
  515.       (Layout : not null access Pango_Layout_Record; 
  516.        Wrap   : Pango.Enums.Wrap_Mode); 
  517.    --  Sets the wrap mode; the wrap mode only has effect if a width is set on 
  518.    --  the layout with Pango.Layout.Set_Width. To turn off wrapping, set the 
  519.    --  width to -1. 
  520.    --  "wrap": the wrap mode 
  521.  
  522.    procedure Index_To_Line_X 
  523.       (Layout   : not null access Pango_Layout_Record; 
  524.        Index    : Gint; 
  525.        Trailing : Boolean; 
  526.        Line     : out Gint; 
  527.        X_Pos    : out Gint); 
  528.    --  Converts from byte Index_ within the Layout to line and X position. (X 
  529.    --  position is measured from the left edge of the line) 
  530.    --  "index_": the byte index of a grapheme within the layout. 
  531.    --  "trailing": an integer indicating the edge of the grapheme to retrieve 
  532.    --  the position of. If 0, the trailing edge of the grapheme, if > 0, the 
  533.    --  leading of the grapheme. 
  534.    --  "line": location to store resulting line index. (which will between 0 
  535.    --  and pango_layout_get_line_count(layout) - 1), or null 
  536.    --  "x_pos": location to store resulting position within line (PANGO_SCALE 
  537.    --  units per device unit), or null 
  538.  
  539.    procedure Index_To_Pos 
  540.       (Layout : not null access Pango_Layout_Record; 
  541.        Index  : Gint; 
  542.        Pos    : out Pango_Rectangle); 
  543.    --  Converts from an index within a Pango.Layout.Pango_Layout to the 
  544.    --  onscreen position corresponding to the grapheme at that index, which is 
  545.    --  represented as rectangle. Note that 'pos->x' is always the leading edge 
  546.    --  of the grapheme and 'pos->x + pos->width' the trailing edge of the 
  547.    --  grapheme. If the directionality of the grapheme is right-to-left, then 
  548.    --  'pos->width' will be negative. 
  549.    --  "index_": byte index within Layout 
  550.    --  "pos": rectangle in which to store the position of the grapheme 
  551.  
  552.    function Is_Ellipsized 
  553.       (Layout : not null access Pango_Layout_Record) return Boolean; 
  554.    --  Queries whether the layout had to ellipsize any paragraphs. 
  555.    --  This returns True if the ellipsization mode for Layout is not 
  556.    --  Pango.Layout.Ellipsize_None, a positive width is set on Layout, and 
  557.    --  there are paragraphs exceeding that width that have to be ellipsized. 
  558.    --  Since: gtk+ 1.16 
  559.  
  560.    function Is_Wrapped 
  561.       (Layout : not null access Pango_Layout_Record) return Boolean; 
  562.    --  Queries whether the layout had to wrap any paragraphs. 
  563.    --  This returns True if a positive width is set on Layout, ellipsization 
  564.    --  mode of Layout is set to Pango.Layout.Ellipsize_None, and there are 
  565.    --  paragraphs exceeding the layout width that have to be wrapped. 
  566.    --  Since: gtk+ 1.16 
  567.  
  568.    procedure Move_Cursor_Visually 
  569.       (Layout       : not null access Pango_Layout_Record; 
  570.        Strong       : Boolean; 
  571.        Old_Index    : Gint; 
  572.        Old_Trailing : Gint; 
  573.        Direction    : Gint; 
  574.        New_Index    : out Gint; 
  575.        New_Trailing : out Gint); 
  576.    --  Computes a new cursor position from an old position and a count of 
  577.    --  positions to move visually. If Direction is positive, then the new 
  578.    --  strong cursor position will be one position to the right of the old 
  579.    --  cursor position. If Direction is negative, then the new strong cursor 
  580.    --  position will be one position to the left of the old cursor position. 
  581.    --  In the presence of bidirectional text, the correspondence between 
  582.    --  logical and visual order will depend on the direction of the current 
  583.    --  run, and there may be jumps when the cursor is moved off of the end of a 
  584.    --  run. 
  585.    --  Motion here is in cursor positions, not in characters, so a single call 
  586.    --  to Pango.Layout.Move_Cursor_Visually may move the cursor over multiple 
  587.    --  characters when multiple characters combine to form a single grapheme. 
  588.    --  "strong": whether the moving cursor is the strong cursor or the weak 
  589.    --  cursor. The strong cursor is the cursor corresponding to text insertion 
  590.    --  in the base direction for the layout. 
  591.    --  "old_index": the byte index of the grapheme for the old index 
  592.    --  "old_trailing": if 0, the cursor was at the trailing edge of the 
  593.    --  grapheme indicated by Old_Index, if > 0, the cursor was at the leading 
  594.    --  edge. 
  595.    --  "direction": direction to move cursor. A negative value indicates 
  596.    --  motion to the left. 
  597.    --  "new_index": location to store the new cursor byte index. A value of -1 
  598.    --  indicates that the cursor has been moved off the beginning of the 
  599.    --  layout. A value of G_MAXINT indicates that the cursor has been moved off 
  600.    --  the end of the layout. 
  601.    --  "new_trailing": number of characters to move forward from the location 
  602.    --  returned for New_Index to get the position where the cursor should be 
  603.    --  displayed. This allows distinguishing the position at the beginning of 
  604.    --  one line from the position at the end of the preceding line. New_Index 
  605.    --  is always on the line where the cursor should be displayed. 
  606.  
  607.    procedure Set_Markup 
  608.       (Layout : not null access Pango_Layout_Record; 
  609.        Markup : UTF8_String); 
  610.    --  Same as Pango.Layout.Set_Markup_With_Accel, but the markup text isn't 
  611.    --  scanned for accelerators. 
  612.    --  "markup": marked-up text 
  613.  
  614.    procedure Set_Markup_With_Accel 
  615.       (Layout       : not null access Pango_Layout_Record; 
  616.        Markup       : UTF8_String; 
  617.        Length       : Gint; 
  618.        Accel_Marker : Gunichar; 
  619.        Accel_Char   : out Gunichar); 
  620.    --  Sets the layout text and attribute list from marked-up text (see <link 
  621.    --  linkend="PangoMarkupFormat">markup format</link>). Replaces the current 
  622.    --  text and attribute list. 
  623.    --  If Accel_Marker is nonzero, the given character will mark the character 
  624.    --  following it as an accelerator. For example, Accel_Marker might be an 
  625.    --  ampersand or underscore. All characters marked as an accelerator will 
  626.    --  receive a Pango.Enums.Pango_Underline_Low attribute, and the first 
  627.    --  character so marked will be returned in Accel_Char. Two Accel_Marker 
  628.    --  characters following each other produce a single literal Accel_Marker 
  629.    --  character. 
  630.    --  "markup": marked-up text (see <link linkend="PangoMarkupFormat">markup 
  631.    --  format</link>) 
  632.    --  "length": length of marked-up text in bytes, or -1 if Markup is 
  633.    --  null-terminated 
  634.    --  "accel_marker": marker for accelerators in the text 
  635.    --  "accel_char": return location for first located accelerator, or null 
  636.  
  637.    procedure Xy_To_Index 
  638.       (Layout   : not null access Pango_Layout_Record; 
  639.        X        : Gint; 
  640.        Y        : Gint; 
  641.        Index    : out Gint; 
  642.        Trailing : out Gint; 
  643.        Exact    : out Boolean); 
  644.    --  Converts from X and Y position within a layout to the byte index to the 
  645.    --  character at that logical position. If the Y position is not inside the 
  646.    --  layout, the closest position is chosen (the position will be clamped 
  647.    --  inside the layout). If the X position is not within the layout, then the 
  648.    --  start or the end of the line is chosen as described for 
  649.    --  pango_layout_x_to_index. If either the X or Y positions were not inside 
  650.    --  the layout, then the function returns False; on an exact hit, it returns 
  651.    --  True. 
  652.    --  "x": the X offset (in Pango units) from the left edge of the layout. 
  653.    --  "y": the Y offset (in Pango units) from the top edge of the layout 
  654.    --  "index_": location to store calculated byte index 
  655.    --  "trailing": location to store a integer indicating where in the 
  656.    --  grapheme the user clicked. It will either be zero, or the number of 
  657.    --  characters in the grapheme. 0 represents the trailing edge of the 
  658.    --  grapheme. 
  659.  
  660.    function At_Last_Line (Self : Pango_Layout_Iter) return Boolean; 
  661.    --  Determines whether Iter is on the last line of the layout. 
  662.  
  663.    procedure Free (Self : Pango_Layout_Iter); 
  664.    --  Frees an iterator that's no longer in use. 
  665.  
  666.    procedure Get_Char_Extents 
  667.       (Self         : Pango_Layout_Iter; 
  668.        Logical_Rect : out Pango_Rectangle); 
  669.    --  Gets the extents of the current character, in layout coordinates 
  670.    --  (origin is the top left of the entire layout). Only logical extents can 
  671.    --  sensibly be obtained for characters; ink extents make sense only down to 
  672.    --  the level of clusters. 
  673.    --  "logical_rect": rectangle to fill with logical extents 
  674.  
  675.    procedure Get_Cluster_Extents 
  676.       (Self         : Pango_Layout_Iter; 
  677.        Ink_Rect     : out Pango_Rectangle; 
  678.        Logical_Rect : out Pango_Rectangle); 
  679.    --  Gets the extents of the current cluster, in layout coordinates (origin 
  680.    --  is the top left of the entire layout). 
  681.    --  "ink_rect": rectangle to fill with ink extents, or null 
  682.    --  "logical_rect": rectangle to fill with logical extents, or null 
  683.  
  684.    function Get_Index (Self : Pango_Layout_Iter) return Gint; 
  685.    --  Gets the current byte index. Note that iterating forward by char moves 
  686.    --  in visual order, not logical order, so indexes may not be sequential. 
  687.    --  Also, the index may be equal to the length of the text in the layout, if 
  688.    --  on the null run (see pango_layout_iter_get_run). 
  689.  
  690.    function Get_Layout (Self : Pango_Layout_Iter) return Pango_Layout; 
  691.    --  Gets the layout associated with a Pango.Layout.Pango_Layout_Iter. 
  692.    --  Since: gtk+ 1.20 
  693.  
  694.    procedure Get_Layout_Extents 
  695.       (Self         : Pango_Layout_Iter; 
  696.        Ink_Rect     : out Pango_Rectangle; 
  697.        Logical_Rect : out Pango_Rectangle); 
  698.    --  Obtains the extents of the Pango.Layout.Pango_Layout being iterated 
  699.    --  over. Ink_Rect or Logical_Rect can be null if you aren't interested in 
  700.    --  them. 
  701.    --  "ink_rect": rectangle to fill with ink extents, or null 
  702.    --  "logical_rect": rectangle to fill with logical extents, or null 
  703.  
  704.    procedure Get_Line_Extents 
  705.       (Self         : Pango_Layout_Iter; 
  706.        Ink_Rect     : out Pango_Rectangle; 
  707.        Logical_Rect : out Pango_Rectangle); 
  708.    --  Obtains the extents of the current line. Ink_Rect or Logical_Rect can 
  709.    --  be null if you aren't interested in them. Extents are in layout 
  710.    --  coordinates (origin is the top-left corner of the entire 
  711.    --  Pango.Layout.Pango_Layout). Thus the extents returned by this function 
  712.    --  will be the same width/height but not at the same x/y as the extents 
  713.    --  returned from pango_layout_line_get_extents. 
  714.    --  "ink_rect": rectangle to fill with ink extents, or null 
  715.    --  "logical_rect": rectangle to fill with logical extents, or null 
  716.  
  717.    procedure Get_Line_Yrange 
  718.       (Self : Pango_Layout_Iter; 
  719.        Y0   : out Gint; 
  720.        Y1   : out Gint); 
  721.    --  Divides the vertical space in the Pango.Layout.Pango_Layout being 
  722.    --  iterated over between the lines in the layout, and returns the space 
  723.    --  belonging to the current line. A line's range includes the line's 
  724.    --  logical extents, plus half of the spacing above and below the line, if 
  725.    --  Pango.Layout.Set_Spacing has been called to set layout spacing. The Y 
  726.    --  positions are in layout coordinates (origin at top left of the entire 
  727.    --  layout). 
  728.    --  "y0_": start of line, or null 
  729.    --  "y1_": end of line, or null 
  730.  
  731.    procedure Get_Run_Extents 
  732.       (Self         : Pango_Layout_Iter; 
  733.        Ink_Rect     : out Pango_Rectangle; 
  734.        Logical_Rect : out Pango_Rectangle); 
  735.    --  Gets the extents of the current run in layout coordinates (origin is 
  736.    --  the top left of the entire layout). 
  737.    --  "ink_rect": rectangle to fill with ink extents, or null 
  738.    --  "logical_rect": rectangle to fill with logical extents, or null 
  739.  
  740.    function Next_Char (Self : Pango_Layout_Iter) return Boolean; 
  741.    --  Moves Iter forward to the next character in visual order. If Iter was 
  742.    --  already at the end of the layout, returns False. 
  743.  
  744.    function Next_Cluster (Self : Pango_Layout_Iter) return Boolean; 
  745.    --  Moves Iter forward to the next cluster in visual order. If Iter was 
  746.    --  already at the end of the layout, returns False. 
  747.  
  748.    function Next_Line (Self : Pango_Layout_Iter) return Boolean; 
  749.    --  Moves Iter forward to the start of the next line. If Iter is already on 
  750.    --  the last line, returns False. 
  751.  
  752.    function Next_Run (Self : Pango_Layout_Iter) return Boolean; 
  753.    --  Moves Iter forward to the next run in visual order. If Iter was already 
  754.    --  at the end of the layout, returns False. 
  755.  
  756.    ---------------------- 
  757.    -- GtkAda additions -- 
  758.    ---------------------- 
  759.  
  760.    function Get_Text (Layout : access Pango_Layout_Record) 
  761.    return Gtkada.Types.Chars_Ptr; 
  762.    --  Same a Get_Text, but return directly the C string, which is more 
  763.    --  efficient. The returned value should not be freed or modified. 
  764.  
  765. private 
  766. type Pango_Layout_Line is record 
  767.    Layout : System.Address; 
  768.    Start_Index : Gint; 
  769.    Length : Gint; 
  770.    Runs : System.Address; 
  771.    Is_Paragraph_Start : Guint; 
  772.    Resolved_Dir : Guint; 
  773. end record; 
  774. pragma Convention (C, Pango_Layout_Line); 
  775.  
  776.  
  777.    Null_Pango_Layout_Iter : constant Pango_Layout_Iter := (Glib.C_Boxed with null record); 
  778.  
  779. end Pango.Layout;