GtkAda Reference Manual - Package Gtk.Text

[Contents] [Back] [Prev] [Up] [Next] [Forward]

# Package Gtk.Text

This widget displays any given text that can be manipulated by both the user and the programmer. The text can optionally be interactively modified by the user. Different colors and fonts can be used for any given part of the text. The background can have any color, or even be a pixmap.

- Gtk.Text Widget Hierarchy
- Gtk.Text Subprograms

## Widget Hierarchy

    GObject                       (see section Package Glib.Object)
    Gtk_Object                    (see section Package Gtk.Object)
       \___ Gtk_Widget            (see section Package Gtk.Widget)
          \___ Gtk_Old_Editable   (see section Package Gtk.Old_Editable)
             \___ Gtk_Text        (see section Package Gtk.Text)

## Subprograms

    procedure Gtk_New
      (Text               : out    Gtk_Text;
       Hadj               : in     Adjustment.Gtk_Adjustment
                           := Adjustment.Null_Adjustment;
       Vadj               : in     Adjustment.Gtk_Adjustment
                           := Adjustment.Null_Adjustment);
| Create a new text widget with the given adjustments. If either or both scrollbars is not provided, the text widget will create its own. You need to insert the Gtk_Text in a Gtk_Scrolled_Window to make the scrollbars visible. Not also that this widget does not currently support horizontal scrollbars.
    function Get_Type              return Gtk.Gtk_Type;
| Return the internal value associated with a Gtk_Text.
    function Get_Text_Area
      (Text               : access Gtk_Text_Record)
       return Gdk.Window.Gdk_Window;
| Return the specific window into which the text is displayed. Note that a Gtk_Text is in fact a complex widget, which includes borders on the sides. Thus, whenever you want to convert the mouse coordinates to a position in the text, you should use the Gdk.Window.Get_Pointer function, passing it this text area as the origin window, rather than directly Get_Window (Text). Note that null will be returned while Text hasn't been realized.
    function Backward_Delete
      (Text               : access Gtk_Text_Record;
       Nchars             : in     Guint)
       return Boolean;
| Backward delete Nchars characters from the current cursor position. There must be at least Nchars characters to delete before the pointer, or the operation will not be performed. Return True if the operation was successful, False otherwise.
    function Forward_Delete
      (Text               : access Gtk_Text_Record;
       Nchars             : in     Guint)
       return Boolean;
| Forward delete Nchars characters from the current point position. There must be at least Nchars characters to delete after the pointer, or the operation will not be performed. Return True if the operation was successful, False otherwise.
    procedure Freeze
      (Text               : access Gtk_Text_Record);
| Freeze the Gtk_Text widget. In other words, stop any redrawing of the widget until the Thaw operation is called. This operation is useful when a large number of changes need to be made within the widget. Freezing it during the updates will avoid some flicker seen by the user. Note also that an internal counter is incremented. The updates will be performed only when the same numbers of calls to Thaw has been performed. Note that you can not call Set_Position while the widget is frozen. This will create a Storage_Error otherwise.
    procedure Thaw
      (Text               : access Gtk_Text_Record);
| Cancel the previous call to Freeze. Allow the widget to be redrawn again, when Thaw has been called as many times as Freeze.
    function Get_Hadj
      (Text               : access Gtk_Text_Record)
       return Gtk.Adjustment.Gtk_Adjustment;
| Return the horizontal scrollbar associated with Text.
    function Get_Vadj
      (Text               : access Gtk_Text_Record)
       return Gtk.Adjustment.Gtk_Adjustment;
| Return the vertical scrollbar associated to the given text widget.
    function Get_Length
      (Text               : access Gtk_Text_Record)
       return Guint;
| Return the total length of the text contained within the text widget.
    function Get_Point
      (Text               : access Gtk_Text_Record)
       return Guint;
| Get the current position of the insertion point (cursor). Return the number of characters from the upper left corner of the widget.
    procedure Set_Point
      (Text               : access Gtk_Text_Record;
       Index              : in     Guint);
| Set the insertion point position. This does not modify the position of the visible cursor (see Gtk.Editable.Set_Position instead).
    procedure Insert
      (Text               : access Gtk_Text_Record;
       Font               : in     Gdk.Font.Gdk_Font
                           := Gdk.Font.Null_Font;
       Fore               : in     Gdk.Color.Gdk_Color
                           := Gdk.Color.Null_Color;
       Back               : in     Gdk.Color.Gdk_Color
                           := Gdk.Color.Null_Color;
       Chars              : in     UTF8_String := "";
       Length             : in     Gint := -1);
| Insert the given string (Chars) inside the text of the text widget. Use the specified Font, foreground (Fore) and background (Back) colors. Only the first "Length" characters are inserted, unless Length is set to -1, in which case the complete string is inserted. Note that the colors must be allocated first, and the font loaded. If the default parameters are passed for font and colors, the text widget will use the ones defined in the style for Text (see Gtk.Style for more information about styles).
    procedure Set_Adjustments
      (Text               : access Gtk_Text_Record;
       Hadj               :        Gtk.Adjustment.Gtk_Adjustment;
       Vadj               :        Gtk.Adjustment.Gtk_Adjustment);
| Set the horizontal and vertical adjustments associated with Text.
    procedure Set_Editable
      (Text               : access Gtk_Text_Record;
       Editable           : in     Boolean := True);
| Toggle the editable state of the given text widget. This determines whether the user can edit the text or not. Note that the programmer can still perform any update.
    procedure Set_Line_Wrap
      (Text               : access Gtk_Text_Record;
       Line_Wrap          : in     Boolean := True);
| Set the Line_Wrap state of the given text widget. If set to True, the line is broken when it reaches the extent of the widget viewing area and the rest is displayed on the next line. If set to false, the line continues regardless of the size of current viewing area.
    procedure Set_Word_Wrap
      (Text               : access Gtk_Text_Record;
       Word_Wrap          : in     Boolean := True);
| Set the Word_Wrap state of the given text widget. If set to True, words are wrapped down to the next line if they can't be completed on the current line.

[Contents] [Back] [Prev] [Up] [Next] [Forward]