1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2001-2007 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. --  <description> 
  30. --  This widget displays a view of a Gtk_Text_Buffer. Multiple views can be 
  31. --  set on a given buffer. 
  32. --  </description> 
  33. --  <c_version>2.8.17</c_version> 
  34. --  <screenshot>gtk-text_view.png</screenshot> 
  35. --  <see>Gtk.Text_Buffer</see> 
  36. --  <see>Gtk.Text_Tag</see> 
  37. --  <see>Gtk.Text_Attributes</see> 
  38. --  <testgtk>create_text_view.adb</testgtk> 
  39. --  <group>Multiline Text Editor</group> 
  40.  
  41. with Glib.Properties; 
  42. with Gdk.Rectangle; 
  43. with Gdk.Window; 
  44. with Gtk.Container; 
  45. with Gtk.Enums; 
  46. with Gtk.Text_Attributes; 
  47. with Gtk.Text_Buffer; 
  48. with Gtk.Text_Child; 
  49. with Gtk.Text_Iter; 
  50. with Gtk.Text_Mark; 
  51. with Gtk.Widget; 
  52. with Pango.Tabs; 
  53.  
  54. package Gtk.Text_View is 
  55.  
  56.    type Gtk_Text_View_Record is 
  57.      new Gtk.Container.Gtk_Container_Record with private; 
  58.    type Gtk_Text_View is access all Gtk_Text_View_Record'Class; 
  59.  
  60.    procedure Gtk_New 
  61.      (Widget : out Gtk_Text_View; 
  62.       Buffer : Gtk.Text_Buffer.Gtk_Text_Buffer := null); 
  63.    procedure Initialize 
  64.      (Widget : access Gtk_Text_View_Record'Class; 
  65.       Buffer : Gtk.Text_Buffer.Gtk_Text_Buffer); 
  66.    --  Creates or initializes a new Gtk_Text_View. 
  67.    --  If Buffer is null, an empty default buffer will be created for you. Get 
  68.    --  the buffer with Get_Buffer. 
  69.    --  Otherwise, create a new text view widget displaying Buffer. 
  70.    --  One buffer can be shared among many widgets. 
  71.    --  The text view adds its own reference count to the buffer; it does not 
  72.    --  take over an existing reference. 
  73.  
  74.    function Get_Type return Glib.GType; 
  75.    --  Return the internal value associated with this widget. 
  76.  
  77.    procedure Set_Buffer 
  78.      (Text_View : access Gtk_Text_View_Record; 
  79.       Buffer    : access Gtk.Text_Buffer.Gtk_Text_Buffer_Record'Class); 
  80.    --  Set Buffer as the buffer being displayed by Text_View. 
  81.    --  The previous buffer displayed by the text view is unreferenced, and a 
  82.    --  reference is added to Buffer. If you owned a reference to Buffer before 
  83.    --  passing it to this function, you must remove that reference yourself; 
  84.    --  Gtk_Text_View will not "adopt" it. 
  85.  
  86.    function Get_Buffer 
  87.      (Text_View : access Gtk_Text_View_Record) 
  88.       return Gtk.Text_Buffer.Gtk_Text_Buffer; 
  89.    --  Return the Gtk_Text_Buffer being displayed by this text view. 
  90.    --  The reference count on the buffer is not incremented; the caller of this 
  91.    --  function won't own a new reference. 
  92.  
  93.    function Scroll_To_Iter 
  94.      (Text_View     : access Gtk_Text_View_Record; 
  95.       Iter          : Gtk.Text_Iter.Gtk_Text_Iter; 
  96.       Within_Margin : Gdouble; 
  97.       Use_Align     : Boolean; 
  98.       Xalign        : Gdouble; 
  99.       Yalign        : Gdouble) return Boolean; 
  100.    --  Scroll Text_View so that Iter is on the screen in the position 
  101.    --  indicated by Xalign and Yalign. An alignment of 0.0 indicates left or 
  102.    --  top, 1.0 indicates right or bottom, 0.5 means center. If Use_Align is 
  103.    --  False, the text scrolls the minimal distance to get the mark onscreen, 
  104.    --  possibly not scrolling at all. The effective screen for purposes of this 
  105.    --  function is reduced by a margin of size Within_Margin. 
  106.    --  Note: This function uses the currently-computed height of the lines in 
  107.    --  the text buffer. Note that line heights are computed in an idle handler; 
  108.    --  so this function may not have the desired effect if it's called before 
  109.    --  the height computations. To avoid oddness, consider using 
  110.    --  Scroll_To_Mark which saves a point to be scrolled to after line 
  111.    --  validation. 
  112.  
  113.    procedure Scroll_To_Mark 
  114.      (Text_View     : access Gtk_Text_View_Record; 
  115.       Mark          : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class; 
  116.       Within_Margin : Gdouble := 0.0; 
  117.       Use_Align     : Boolean := False; 
  118.       Xalign        : Gdouble := 0.0; 
  119.       Yalign        : Gdouble := 0.0); 
  120.    --  Scroll Text_View so that Mark is on the screen in the position indicated 
  121.    --  by Xalign and Yalign. An alignment of 0.0 indicates left or top, 1.0 
  122.    --  indicates right or bottom, 0.5 means center. If Use_Align is False, the 
  123.    --  text scrolls the minimal distance to get the mark onscreen, possibly not 
  124.    --  scrolling at all. The effective screen for purposes of this function is 
  125.    --  reduced by a margin of size Within_Margin. 
  126.  
  127.    procedure Scroll_Mark_Onscreen 
  128.      (Text_View : access Gtk_Text_View_Record; 
  129.       Mark      : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 
  130.    --  Same as the above with the default values 
  131.  
  132.    function Move_Mark_Onscreen 
  133.      (Text_View : access Gtk_Text_View_Record; 
  134.       Mark      : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class) 
  135.       return Boolean; 
  136.    --  Move a mark within the buffer so that it's located within the 
  137.    --  currently-visible text area. 
  138.    --  Return value: True if the mark moved (wasn't already onscreen). 
  139.  
  140.    function Place_Cursor_Onscreen 
  141.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  142.    --  Move the cursor to the currently visible region of the buffer, if it 
  143.    --  isn't there already. 
  144.    --  Return value: True if the cursor had to be moved. 
  145.  
  146.    procedure Get_Visible_Rect 
  147.      (Text_View    : access Gtk_Text_View_Record; 
  148.       Visible_Rect : out Gdk.Rectangle.Gdk_Rectangle); 
  149.    --  Fill Visible_Rect with the currently-visible region of the buffer, in 
  150.    --  buffer coordinates. Convert to window coordinates with 
  151.    --  Buffer_To_Window_Coords. 
  152.  
  153.    procedure Get_Iter_Location 
  154.      (Text_View : access Gtk_Text_View_Record; 
  155.       Iter      : Gtk.Text_Iter.Gtk_Text_Iter; 
  156.       Location  : out Gdk.Rectangle.Gdk_Rectangle); 
  157.    --  Get a rectangle which roughly contains the character at iter. 
  158.    --  The rectangle position is in buffer coordinates; use 
  159.    --  Buffer_To_Window_Coords to convert these coordinates to coordinates for 
  160.    --  one of the windows in the text view. 
  161.  
  162.    procedure Get_Iter_At_Location 
  163.      (Text_View : access Gtk_Text_View_Record; 
  164.       Iter      : out Gtk.Text_Iter.Gtk_Text_Iter; 
  165.       X         : Gint; 
  166.       Y         : Gint); 
  167.    --  Retrieve the iterator at buffer coordinates X and Y. Buffer coordinates 
  168.    --  are coordinates for the entire buffer, not just the currently-displayed 
  169.    --  portion. If you have coordinates from an event, you have to convert 
  170.    --  those to buffer coordinates with Window_To_Buffer_Coords. 
  171.  
  172.    procedure Get_Iter_At_Position 
  173.      (Text_View : access Gtk_Text_View_Record; 
  174.       Iter      : out Gtk.Text_Iter.Gtk_Text_Iter; 
  175.       Trailing  : out Gint; 
  176.       X         : Gint; 
  177.       Y         : Gint); 
  178.    --  Retrieves the iterator pointing to the character at buffer coordinates X 
  179.    --  and Y. Buffer coordinates are coordinates for the entire buffer, not 
  180.    --  just the currently-displayed portion. If you have coordinates from an 
  181.    --  event, you have to convert those to buffer coordinates with 
  182.    --  Window_To_Buffer_Coords. 
  183.    --  Note that this is different from Get_Iter_At_Location(), 
  184.    --  which returns cursor locations, i.e. positions between characters) 
  185.    --  Trailing is set to indicate where in the grapheme the user clicked. It 
  186.    --  will be either 0, or the number of characters in the grapheme. 0 
  187.    --  represents the trailing edge of the grapheme. 
  188.  
  189.    procedure Get_Line_Yrange 
  190.      (Text_View : access Gtk_Text_View_Record; 
  191.       Iter      : Gtk.Text_Iter.Gtk_Text_Iter; 
  192.       Y         : out Gint; 
  193.       Height    : out Gint); 
  194.    --  Get the Y coordinate of the top of the line containing Iter, 
  195.    --  and the Height of the line. The coordinate is a buffer coordinate; 
  196.    --  convert to window coordinates with Buffer_To_Window_Coords. 
  197.  
  198.    procedure Get_Line_At_Y 
  199.      (Text_View   : access Gtk_Text_View_Record; 
  200.       Target_Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 
  201.       Y           : Gint; 
  202.       Line_Top    : out Gint); 
  203.    --  Get the Gtk_Text_Iter at the start of the line containing the 
  204.    --  coordinate Y. Y is in buffer coordinates, convert from window 
  205.    --  coordinates with Window_To_Buffer_Coords. 
  206.    --  Line_Top will be filled with the coordinate of the top edge of the line. 
  207.  
  208.    procedure Buffer_To_Window_Coords 
  209.      (Text_View : access Gtk_Text_View_Record; 
  210.       Win       : Gtk.Enums.Gtk_Text_Window_Type; 
  211.       Buffer_X  : Gint; 
  212.       Buffer_Y  : Gint; 
  213.       Window_X  : out Gint; 
  214.       Window_Y  : out Gint); 
  215.    --  Convert coordinate (Buffer_X, Buffer_Y) to coordinates for the window 
  216.    --  Win, and store the result in (Window_X, Window_Y). 
  217.  
  218.    procedure Window_To_Buffer_Coords 
  219.      (Text_View : access Gtk_Text_View_Record; 
  220.       Win       : Gtk.Enums.Gtk_Text_Window_Type; 
  221.       Window_X  : Gint; 
  222.       Window_Y  : Gint; 
  223.       Buffer_X  : out Gint; 
  224.       Buffer_Y  : out Gint); 
  225.    --  Convert coordinates on the window identified by Win to buffer 
  226.    --  coordinates, storing the result in (Buffer_X, Buffer_Y). 
  227.  
  228.    function Get_Window 
  229.      (Text_View : access Gtk_Text_View_Record; 
  230.       Win       : Gtk.Enums.Gtk_Text_Window_Type) return Gdk.Window.Gdk_Window; 
  231.    --  Retrieve the Gdk_Window corresponding to an area of the text view; 
  232.    --  possible windows include the overall widget window, child windows on the 
  233.    --  left, right, top, bottom, and the window that displays the text buffer. 
  234.    --  Windows are null and nonexistent if their width or height is 0, and are 
  235.    --  nonexistent before the widget has been realized. 
  236.  
  237.    function Get_Window_Type 
  238.      (Text_View : access Gtk_Text_View_Record; 
  239.       Window    : Gdk.Window.Gdk_Window) return Gtk.Enums.Gtk_Text_Window_Type; 
  240.    --  Usually used to find out which window an event corresponds to. 
  241.    --  If you connect to an event signal on Text_View, this function should be 
  242.    --  called on Get_Window (Event) to see which window it was. 
  243.  
  244.    procedure Set_Border_Window_Size 
  245.      (Text_View : access Gtk_Text_View_Record; 
  246.       The_Type  : Gtk.Enums.Gtk_Text_Window_Type; 
  247.       Size      : Gint); 
  248.    function Get_Border_Window_Size 
  249.      (Text_View : access Gtk_Text_View_Record; 
  250.       The_Type  : Gtk.Enums.Gtk_Text_Window_Type) return Gint; 
  251.    --  Set the width of Text_Window_Left or Text_Window_Right, 
  252.    --  or the height of Text_Window_Top or Text_Window_Bottom. 
  253.    --  Automatically destroy the corresponding window if the size is set to 0, 
  254.    --  and create the window if the size is set to non-zero. 
  255.  
  256.    --  <doc_ignore> 
  257.    procedure Set_Disable_Scroll_On_Focus 
  258.      (Text_View : access Gtk_Text_View_Record; 
  259.       Set       : Boolean); 
  260.    function Get_Disable_Scroll_On_Focus 
  261.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  262.    --  Set whether the Text_View should scroll to the cursor when it gets the 
  263.    --  focus. (This is the default behaviour) 
  264.    --  This procedure has no effect for gtk+ 2.2.2 or later. 
  265.    --  </doc_ignore> 
  266.  
  267.    --------------- 
  268.    -- Iterators -- 
  269.    --------------- 
  270.    --  You can manipulate iterators either through the buffer directly (thus 
  271.    --  independently of any display properties), or through the property (if 
  272.    --  you need to reference to what the user is actually seeing on the screen) 
  273.  
  274.    procedure Forward_Display_Line 
  275.      (Text_View : access Gtk_Text_View_Record; 
  276.       Iter      : in out Gtk.Text_Iter.Gtk_Text_Iter; 
  277.       Result    : out    Boolean); 
  278.    procedure Forward_Display_Line_End 
  279.      (Text_View : access Gtk_Text_View_Record; 
  280.       Iter      : in out Gtk.Text_Iter.Gtk_Text_Iter; 
  281.       Result    : out    Boolean); 
  282.    --  Moves the given Iter forward by one display (wrapped) line.  A 
  283.    --  display line is different from a paragraph. Paragraphs are 
  284.    --  separated by newlines or other paragraph separator characters. 
  285.    --  Display lines are created by line-wrapping a paragraph.  If 
  286.    --  wrapping is turned off, display lines and paragraphs will be the 
  287.    --  same. Display lines are divided differently for each view, since 
  288.    --  they depend on the view's width; paragraphs are the same in all 
  289.    --  views, since they depend on the contents of the Gtk_Text_Buffer. 
  290.    --  Returns True if Iter was moved and is not on the end iterator. 
  291.  
  292.    procedure Backward_Display_Line 
  293.      (Text_View : access Gtk_Text_View_Record; 
  294.       Iter      : in out Gtk.Text_Iter.Gtk_Text_Iter; 
  295.       Result    : out    Boolean); 
  296.    procedure Backward_Display_Line_Start 
  297.      (Text_View : access Gtk_Text_View_Record; 
  298.       Iter      : in out Gtk.Text_Iter.Gtk_Text_Iter; 
  299.       Result    : out    Boolean); 
  300.    --  Moves the given Iter backward by one display (wrapped) line. A display 
  301.    --  line is different from a paragraph. Paragraphs are separated by newlines 
  302.    --  or other paragraph separator characters. Display lines are created by 
  303.    --  line-wrapping a paragraph. If wrapping is turned off, display lines and 
  304.    --  paragraphs will be the same. Display lines are divided differently for 
  305.    --  each view, since they depend on the view's width; paragraphs are the 
  306.    --  same in all views, since they depend on the contents of the 
  307.    --  Gtk_Text_Buffer. 
  308.    --  Returns True if Iter was moved and is not on the end iterator 
  309.  
  310.    function Starts_Display_Line 
  311.      (Text_View : access Gtk_Text_View_Record; 
  312.       Iter      : Gtk.Text_Iter.Gtk_Text_Iter) return Boolean; 
  313.    --  Determines whether Iter is at the start of a display line. See 
  314.    --  Forward_Display_Line for an explanation of display lines vs. paragraphs. 
  315.    --  Returns true if Iter begins a wrapped line. 
  316.  
  317.    procedure Move_Visually 
  318.      (Text_View : access Gtk_Text_View_Record; 
  319.       Iter      : in out Gtk.Text_Iter.Gtk_Text_Iter; 
  320.       Count     : Gint; 
  321.       Result    : out Boolean); 
  322.    --  Move the iterator a given number of characters visually, treating it as 
  323.    --  the strong cursor position. If Count is positive, then the new strong 
  324.    --  cursor position will be Count positions to the right of the old cursor 
  325.    --  position. If Count is negative then the new strong cursor position will 
  326.    --  be Count positions to the left of the old cursor position. 
  327.    -- 
  328.    --  In the presence of bidirection text, the correspondence between logical 
  329.    --  and visual order will depend on the direction of the current run, and 
  330.    --  there may be jumps when the cursor is moved off of the end of a run. 
  331.    -- 
  332.    --  Returns True if Iter moved and is not on the end iterator 
  333.  
  334.    ---------------------- 
  335.    -- Children widgets -- 
  336.    ---------------------- 
  337.    --  Any widget can be put in a text_view, for instance to provide an 
  338.    --  interactive area. 
  339.  
  340.    procedure Add_Child_In_Window 
  341.      (Text_View    : access Gtk_Text_View_Record; 
  342.       Child        : access Gtk.Widget.Gtk_Widget_Record'Class; 
  343.       Which_Window : Gtk.Enums.Gtk_Text_Window_Type; 
  344.       Xpos         : Gint; 
  345.       Ypos         : Gint); 
  346.    --  Adds a child at fixed coordinates in one of the text widget's windows. 
  347.    --  The window must have nonzero size (see Set_Border_Window_Size). Note 
  348.    --  that the child coordinates are given relative to the Gdk_Window in 
  349.    --  question, and that these coordinates have no sane relationship to 
  350.    --  scrolling. When placing a child in GTK_TEXT_WINDOW_WIDGET, scrolling is 
  351.    --  irrelevant, the child floats above all scrollable areas. But when 
  352.    --  placing a child in one of the scrollable windows (border windows or text 
  353.    --  window), you'll need to compute the child's correct position in buffer 
  354.    --  coordinates any time scrolling occurs or buffer changes occur, and then 
  355.    --  call Move_Child() to update the child's position. Unfortunately there's 
  356.    --  no good way to detect that scrolling has occurred, using the current 
  357.    --  API; a possible hack would be to update all child positions when the 
  358.    --  scroll adjustments change or the text buffer changes. 
  359.  
  360.    procedure Add_Child_At_Anchor 
  361.      (Text_View : access Gtk_Text_View_Record; 
  362.       Child     : access Gtk.Widget.Gtk_Widget_Record'Class; 
  363.       Anchor    : access Gtk.Text_Child.Gtk_Text_Child_Anchor_Record'Class); 
  364.    --  Adds a child widget in the text buffer, at the given Anchor. 
  365.  
  366.    procedure Move_Child 
  367.      (Text_View : access Gtk_Text_View_Record; 
  368.       Child     : access Gtk.Widget.Gtk_Widget_Record'Class; 
  369.       Xpos      : Gint; 
  370.       Ypos      : Gint); 
  371.    --  Updates the position of a child, as for Add_Child_In_Window. 
  372.    --  Child must already have been added to the text_view. 
  373.  
  374.    ---------------- 
  375.    -- Attributes -- 
  376.    ---------------- 
  377.  
  378.    function Get_Default_Attributes 
  379.      (Text_View : access Gtk_Text_View_Record) 
  380.       return Gtk.Text_Attributes.Gtk_Text_Attributes; 
  381.    --  Obtains a copy of the default text attributes. These are the attributes 
  382.    --  used for text unless a tag overrides them. You'd typically pass the 
  383.    --  default attributes in to Gtk.Text_Iter.Get_Attributes in order to get 
  384.    --  the attributes in effect at a given text position. 
  385.    --  The returned value is a copy and should be freed by the caller. 
  386.  
  387.    procedure Set_Cursor_Visible 
  388.      (Text_View : access Gtk_Text_View_Record; 
  389.       Setting   : Boolean := True); 
  390.    function Get_Cursor_Visible 
  391.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  392.    --  Toggle whether the insertion point is displayed. 
  393.    --  A buffer with no editable text probably shouldn't have a visible cursor, 
  394.    --  so you may want to turn the cursor off. 
  395.  
  396.    procedure Set_Wrap_Mode 
  397.      (Text_View : access Gtk_Text_View_Record; 
  398.       Wrap_Mode : Gtk.Enums.Gtk_Wrap_Mode); 
  399.    function Get_Wrap_Mode 
  400.      (Text_View : access Gtk_Text_View_Record) return Gtk.Enums.Gtk_Wrap_Mode; 
  401.    --  Set the line wrapping for the view. 
  402.  
  403.    procedure Set_Editable 
  404.      (Text_View : access Gtk_Text_View_Record; 
  405.       Setting   : Boolean := True); 
  406.    function Get_Editable 
  407.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  408.    --  Set the default editability of the Gtk_Text_View. 
  409.    --  You can override this default setting with tags in the buffer, using the 
  410.    --  "editable" attribute of tags. 
  411.  
  412.    procedure Set_Pixels_Above_Lines 
  413.      (Text_View          : access Gtk_Text_View_Record; 
  414.       Pixels_Above_Lines : Gint); 
  415.    function Get_Pixels_Above_Lines 
  416.      (Text_View : access Gtk_Text_View_Record) return Gint; 
  417.    --  Sets the default number of blank pixels above paragraphs in Text_View. 
  418.    --  Tags in the buffer for Text_View may override the defaults. 
  419.  
  420.    procedure Set_Pixels_Below_Lines 
  421.      (Text_View          : access Gtk_Text_View_Record; 
  422.       Pixels_Below_Lines : Gint); 
  423.    function Get_Pixels_Below_Lines 
  424.      (Text_View : access Gtk_Text_View_Record) return Gint; 
  425.    --  Sets the default number of pixels of blank space 
  426.    --  to put below paragraphs in Text_View. May be overridden 
  427.    --  by tags applied to Text_View's buffer. 
  428.  
  429.    procedure Set_Pixels_Inside_Wrap 
  430.      (Text_View          : access Gtk_Text_View_Record; 
  431.       Pixels_Inside_Wrap : Gint); 
  432.    function Get_Pixels_Inside_Wrap 
  433.      (Text_View : access Gtk_Text_View_Record) return Gint; 
  434.    --  Sets the default number of pixels of blank space to leave between 
  435.    --  display/wrapped lines within a paragraph. May be overridden by 
  436.    --  tags in Text_View's buffer. 
  437.  
  438.    procedure Set_Justification 
  439.      (Text_View     : access Gtk_Text_View_Record; 
  440.       Justification : Gtk.Enums.Gtk_Justification); 
  441.    function Get_Justification 
  442.      (Text_View : access Gtk_Text_View_Record) 
  443.       return Gtk.Enums.Gtk_Justification; 
  444.    --  Sets the default justification of text in Text_View. 
  445.    --  Tags in the view's buffer may override the default. 
  446.  
  447.    procedure Set_Left_Margin 
  448.      (Text_View   : access Gtk_Text_View_Record; 
  449.       Left_Margin : Gint); 
  450.    function Get_Left_Margin 
  451.      (Text_View : access Gtk_Text_View_Record) return Gint; 
  452.    --  Sets the default left margin for text in Text_View. 
  453.    --  Tags in the buffer may override the default. 
  454.  
  455.    procedure Set_Right_Margin 
  456.      (Text_View    : access Gtk_Text_View_Record; 
  457.       Right_Margin : Gint); 
  458.    function Get_Right_Margin 
  459.      (Text_View : access Gtk_Text_View_Record) return Gint; 
  460.    --  Sets the default right margin for text in the text view. 
  461.    --  Tags in the buffer may override the default. 
  462.  
  463.    procedure Set_Indent 
  464.      (Text_View : access Gtk_Text_View_Record; Indent : Gint); 
  465.    function Get_Indent (Text_View : access Gtk_Text_View_Record) return Gint; 
  466.    --  Sets the default indentation for paragraphs in Text_View. 
  467.    --  Tags in the buffer may override the default. 
  468.  
  469.    procedure Set_Tabs 
  470.      (Text_View : access Gtk_Text_View_Record; 
  471.       Tabs      : Pango.Tabs.Pango_Tab_Array); 
  472.    function Get_Tabs 
  473.      (Text_View : access Gtk_Text_View_Record) 
  474.       return Pango.Tabs.Pango_Tab_Array; 
  475.    --  Sets the default tab stops for paragraphs in Text_View. Tags in the 
  476.    --  buffer may override the default 
  477.    --  The returned array will be Null_Tab_Array if "standard" (8-space) tabs 
  478.    --  are used. Free the return value Pango.Tabs.Free 
  479.  
  480.    procedure Set_Overwrite 
  481.      (Text_View : access Gtk_Text_View_Record; Overwrite : Boolean); 
  482.    function Get_Overwrite 
  483.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  484.    --  Changes the Text_View overwrite mode. 
  485.  
  486.    procedure Set_Accepts_Tab 
  487.      (Text_View   : access Gtk_Text_View_Record;  Accepts_Tab : Boolean); 
  488.    function Get_Accepts_Tab 
  489.      (Text_View : access Gtk_Text_View_Record) return Boolean; 
  490.    --  Sets the behavior of the text widget when the Tab key is pressed. If 
  491.    --  Accepts_Tab is True a tab character is inserted, otherwise the keyboard 
  492.    --  focus is moved to the next widget in the focus chain. 
  493.  
  494.    ---------------- 
  495.    -- Properties -- 
  496.    ---------------- 
  497.  
  498.    --  <properties> 
  499.    --  The following properties are defined for this widget. See 
  500.    --  Glib.Properties for more information on properties. 
  501.    -- 
  502.    --  Name:  Accepts_Tab_Property 
  503.    --  Type:  Boolean 
  504.    --  Descr: Whether Tab will result in a tab character being entered 
  505.    -- 
  506.    --  Name:  Buffer_Property 
  507.    --  Type:  Object 
  508.    --  Descr: The buffer which is displayed 
  509.    -- 
  510.    --  Name:  Cursor_Visible_Property 
  511.    --  Type:  Boolean 
  512.    --  Descr: If the insertion cursor is shown 
  513.    -- 
  514.    --  Name:  Editable_Property 
  515.    --  Type:  Boolean 
  516.    --  Descr: Whether the text can be modified by the user 
  517.    -- 
  518.    --  Name:  Indent_Property 
  519.    --  Type:  Int 
  520.    --  Descr: Amount to indent the paragraph, in pixels 
  521.    -- 
  522.    --  Name:  Justification_Property 
  523.    --  Type:  Enum 
  524.    --  Descr: Left, right, or center justification 
  525.    -- 
  526.    --  Name:  Left_Margin_Property 
  527.    --  Type:  Int 
  528.    --  Descr: Width of the left margin in pixels 
  529.    -- 
  530.    --  Name:  Overwrite_Property 
  531.    --  Type:  Boolean 
  532.    --  Descr: Whether entered text overwrites existing contents 
  533.    -- 
  534.    --  Name:  Pixels_Above_Lines_Property 
  535.    --  Type:  Int 
  536.    --  Descr: Pixels of blank space above paragraphs 
  537.    -- 
  538.    --  Name:  Pixels_Below_Lines_Property 
  539.    --  Type:  Int 
  540.    --  Descr: Pixels of blank space below paragraphs 
  541.    -- 
  542.    --  Name:  Pixels_Inside_Wrap_Property 
  543.    --  Type:  Int 
  544.    --  Descr: Pixels of blank space between wrapped lines in a paragraph 
  545.    -- 
  546.    --  Name:  Right_Margin_Property 
  547.    --  Type:  Int 
  548.    --  Descr: Width of the right margin in pixels 
  549.    -- 
  550.    --  Name:  Tabs_Property 
  551.    --  Type:  Boxed 
  552.    --  Descr: Custom tabs for this text 
  553.    -- 
  554.    --  Name:  Wrap_Mode_Property 
  555.    --  Type:  Enum 
  556.    --  Descr: Whether to wrap lines never, at word boundaries, or at character 
  557.    --         boundaries 
  558.    -- 
  559.    --  </properties> 
  560.  
  561.    Accepts_Tab_Property        : constant Glib.Properties.Property_Boolean; 
  562.    Buffer_Property             : constant Glib.Properties.Property_Object; 
  563.    Cursor_Visible_Property     : constant Glib.Properties.Property_Boolean; 
  564.    Editable_Property           : constant Glib.Properties.Property_Boolean; 
  565.    Indent_Property             : constant Glib.Properties.Property_Int; 
  566.    Justification_Property      : constant Gtk.Enums.Property_Gtk_Justification; 
  567.    Left_Margin_Property        : constant Glib.Properties.Property_Int; 
  568.    Overwrite_Property          : constant Glib.Properties.Property_Boolean; 
  569.    Pixels_Above_Lines_Property : constant Glib.Properties.Property_Int; 
  570.    Pixels_Below_Lines_Property : constant Glib.Properties.Property_Int; 
  571.    Pixels_Inside_Wrap_Property : constant Glib.Properties.Property_Int; 
  572.    Right_Margin_Property       : constant Glib.Properties.Property_Int; 
  573.    --  Tabs_Property           : constant Glib.Properties.Property_Boxed; 
  574.    Wrap_Mode_Property          : constant Gtk.Enums.Property_Gtk_Wrap_Mode; 
  575.  
  576.    ---------------------- 
  577.    -- Style Properties -- 
  578.    ---------------------- 
  579.    --  The following properties can be changed through the gtk theme and 
  580.    --  configuration files, and retrieved through Gtk.Widget.Style_Get_Property 
  581.  
  582.    --  <style_properties> 
  583.    --  Name:  Error_Underline_Color_Property 
  584.    --  Type:  Boxed 
  585.    --  Descr: Color with which to draw error-indication underlines 
  586.    --  </style_properties> 
  587.  
  588.    --  Error_Underline_Color_Property : constant 
  589.    --    Glib.Properties.Property_Boxed; 
  590.  
  591.    ------------- 
  592.    -- Signals -- 
  593.    ------------- 
  594.  
  595.    --  <signals> 
  596.    --  The following new signals are defined for this widget: 
  597.    -- 
  598.    --  - "set_scroll_adjustments" 
  599.    --    procedure Handler 
  600.    --      (Widget      : access Gtk_Text_View_Record'Class; 
  601.    --       Hadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; 
  602.    --       Vadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  603.    -- 
  604.    --  - "populate_popup" 
  605.    --    procedure Handler 
  606.    --      (Widget : access Gtk_Text_View_Record'Class; 
  607.    --       Menu   : access Gtk.Menu.Gtk_Menu_Record'Class); 
  608.    -- 
  609.    --  - "move_cursor" 
  610.    --    procedure Handler 
  611.    --      (Widget           : access Gtk_Text_View_Record'Class; 
  612.    --       Step             : Gtk_Movement_Step; 
  613.    --       Count            : Gint; 
  614.    --       Extend_Selection : Boolean); 
  615.    -- 
  616.    --  - "set_anchor" 
  617.    --    procedure Handler (Widget : access Gtk_Text_View_Record'Class); 
  618.    -- 
  619.    --  - "insert_at_cursor" 
  620.    --    procedure Handler 
  621.    --      (Widget : access Gtk_Text_View_Record'Class; Str : UTF8_String); 
  622.    -- 
  623.    --  - "delete_from_cursor" 
  624.    --    procedure Handler 
  625.    --      (Widget   : access Gtk_Text_View_Record'Class; 
  626.    --       The_Type : Gtk_Delete_Type; 
  627.    --       Count    : Gint); 
  628.    -- 
  629.    --  - "cut_clipboard" 
  630.    --    procedure Handler (Widget : access Gtk_Text_View_Record'Class); 
  631.    -- 
  632.    --  - "copy_clipboard" 
  633.    --    procedure Handler (Widget : access Gtk_Text_View_Record'Class); 
  634.    -- 
  635.    --  - "paste_clipboard" 
  636.    --    procedure Handler (Widget : access Gtk_Text_View_Record'Class); 
  637.    -- 
  638.    --  - "toggle_overwrite" 
  639.    --    procedure Handler (Widget : access Gtk_Text_View_Record'Class); 
  640.    -- 
  641.    --  </signals> 
  642.  
  643.    Signal_Backspace              : constant Glib.Signal_Name := 
  644.                                      "backspace"; 
  645.    Signal_Copy_Clipboard         : constant Glib.Signal_Name := 
  646.                                      "copy_clipboard"; 
  647.    Signal_Cut_Clipboard          : constant Glib.Signal_Name := 
  648.                                      "cut_clipboard"; 
  649.    Signal_Delete_From_Cursor     : constant Glib.Signal_Name := 
  650.                                      "delete_from_cursor"; 
  651.    Signal_Insert_At_Cursor       : constant Glib.Signal_Name := 
  652.                                      "insert_at_cursor"; 
  653.    Signal_Move_Cursor            : constant Glib.Signal_Name := 
  654.                                      "move_cursor"; 
  655.    Signal_Move_Focus             : constant Glib.Signal_Name := 
  656.                                      "move_focus"; 
  657.    Signal_Move_Viewport          : constant Glib.Signal_Name := 
  658.                                      "move_viewport"; 
  659.    Signal_Page_Horizontally      : constant Glib.Signal_Name := 
  660.                                      "page_horizontally"; 
  661.    Signal_Paste_Clipboard        : constant Glib.Signal_Name := 
  662.                                      "paste_clipboard"; 
  663.    Signal_Populate_Popup         : constant Glib.Signal_Name := 
  664.                                      "populate_popup"; 
  665.    Signal_Select_All             : constant Glib.Signal_Name := 
  666.                                      "select_all"; 
  667.    Signal_Set_Anchor             : constant Glib.Signal_Name := 
  668.                                      "set_anchor"; 
  669.    Signal_Set_Scroll_Adjustments : constant Glib.Signal_Name := 
  670.                                      "set_scroll_adjustments"; 
  671.    Signal_Toggle_Overwrite       : constant Glib.Signal_Name := 
  672.                                      "toggle_overwrite"; 
  673.  
  674. private 
  675.    type Gtk_Text_View_Record is new Gtk.Container.Gtk_Container_Record with 
  676.      null record; 
  677.  
  678.    Accepts_Tab_Property : constant Glib.Properties.Property_Boolean := 
  679.      Glib.Properties.Build ("accepts-tab"); 
  680.    Buffer_Property : constant Glib.Properties.Property_Object := 
  681.      Glib.Properties.Build ("buffer"); 
  682.    Cursor_Visible_Property : constant Glib.Properties.Property_Boolean := 
  683.      Glib.Properties.Build ("cursor-visible"); 
  684.    Editable_Property : constant Glib.Properties.Property_Boolean := 
  685.      Glib.Properties.Build ("editable"); 
  686.    Indent_Property : constant Glib.Properties.Property_Int := 
  687.      Glib.Properties.Build ("indent"); 
  688.    Justification_Property : constant Gtk.Enums.Property_Gtk_Justification := 
  689.      Gtk.Enums.Build ("justification"); 
  690.    Left_Margin_Property : constant Glib.Properties.Property_Int := 
  691.      Glib.Properties.Build ("left-margin"); 
  692.    Overwrite_Property : constant Glib.Properties.Property_Boolean := 
  693.      Glib.Properties.Build ("overwrite"); 
  694.    Pixels_Above_Lines_Property : constant Glib.Properties.Property_Int := 
  695.      Glib.Properties.Build ("pixels-above-lines"); 
  696.    Pixels_Below_Lines_Property : constant Glib.Properties.Property_Int := 
  697.      Glib.Properties.Build ("pixels-below-lines"); 
  698.    Pixels_Inside_Wrap_Property : constant Glib.Properties.Property_Int := 
  699.      Glib.Properties.Build ("pixels-inside-wrap"); 
  700.    Right_Margin_Property : constant Glib.Properties.Property_Int := 
  701.      Glib.Properties.Build ("right-margin"); 
  702. --     Tabs_Property : constant Glib.Properties.Property_Boxed := 
  703. --       Glib.Properties.Build ("tabs"); 
  704.    Wrap_Mode_Property : constant Gtk.Enums.Property_Gtk_Wrap_Mode := 
  705.      Gtk.Enums.Build ("wrap-mode"); 
  706.  
  707. --     Error_Underline_Color_Property : constant Glib.Properties.Property_Boxed 
  708. --       := Glib.Properties.Build ("error-underline-color"); 
  709.  
  710.    pragma Import (C, Get_Type, "gtk_text_view_get_type"); 
  711. end Gtk.Text_View; 
  712.  
  713. --  No binding: gtk_text_view_new 
  714.  
  715. --  <example> 
  716. --  --  The following example creates an empty text view, and puts it in a 
  717. --  --  scrolling area so that if more text is added, scrollbars are created 
  718. --  --  automatically. 
  719. -- 
  720. --  declare 
  721. --     View     : Gtk_Text_View; 
  722. --     Buffer   : Gtk_Text_Buffer; 
  723. --     Scrolled : Gtk_Scrolled_Window; 
  724. --  begin 
  725. --     Gtk_New (Scrolled); 
  726. --     Set_Policy (Scrolled, Policy_Automatic, Policy_Automatic); 
  727. --     Gtk_New (Buffer); 
  728. --     Gtk_New (View, Buffer); 
  729. --     Add (Scrolled, View); 
  730. --  end; 
  731. --  </example>