This is gtkada_rm.info, produced by makeinfo version 4.5 from gtkada_rm.texi. INFO-DIR-SECTION User Interface Toolkit START-INFO-DIR-ENTRY * GtkAda_Rm: (gtkada_rm). Ada95 graphical tookit based on GTK+ (Reference Manual) END-INFO-DIR-ENTRY  File: gtkada_rm.info, Node: Package_Gtk.Stock, Next: Package_Gtk.Table, Prev: Package_Gtk.Status_Bar, Up: Top Package Gtk.Stock ***************** These functions provide an applications programmer with default images and buttons for toolbars, menu pixmaps, etc. See the function Gtk.Widget.Render_Icon for a convenience function that converts a stock icon to an actual pixmap/pixbuf. * Menu: * Gtk.Stock Types:: * Gtk.Stock Subprograms::  File: gtkada_rm.info, Node: Gtk.Stock Types, Next: Gtk.Stock Subprograms, Up: Package_Gtk.Stock Types ===== type Gtk_Stock_Item is record Stock_Id : Gtkada.Types.Chars_Ptr; Label : Gtkada.Types.Chars_Ptr; Modifier : Gdk.Types.Gdk_Modifier_Type; Keyval : Gdk.Types.Gdk_Key_Type; Translation_Domain : Gtkada.Types.Chars_Ptr; end record; type Gtk_Stock_Item_Access is access all Gtk_Stock_Item; type Gtk_Stock_Item_Array is array (Natural range <>) of Gtk_Stock_Item;  File: gtkada_rm.info, Node: Gtk.Stock Subprograms, Prev: Gtk.Stock Types, Up: Package_Gtk.Stock Subprograms =========== procedure Gtk_New (Item : out Gtk_Stock_Item; Stock_Id : String; Label : UTF8_String; Modifier : Gdk.Types.Gdk_Modifier_Type; Keyval : Gdk.Types.Gdk_Key_Type; Translation_Domain : String); Create a new stock item. procedure Add (Item : Gtk_Stock_Item); Register Item. If an item already exists with the same stock ID as one of the items, the old item gets replaced. The stock item is copied, so GtkAda does not hold any pointer into item and item can be freed. Use Add_Static if item is persistent and GtkAda need not copy the array. procedure Add (Items : Gtk_Stock_Item_Array); Register each of the stock items in Items. procedure Add_Static (Item : Gtk_Stock_Item); Same as Add, but do not copy Item, so Item must persist until application exit. procedure Add_Static (Items : Gtk_Stock_Item_Array); Same as Add, but do not copy Items, so Items must persist until application exit. procedure Lookup (Stock_Id : String; Item : out Gtk_Stock_Item; Success : out Boolean); Fill Item with the registered values for Stock_Id. Success if set to True of Stock_Id was known. procedure Free (Item : in out Gtk_Stock_Item); Free memory allocated in Item.  File: gtkada_rm.info, Node: Package_Gtk.Table, Next: Package_Gtk.Text, Prev: Package_Gtk.Stock, Up: Top Package Gtk.Table ***************** A Gtk_Table is a container that can contain any number of children. Each of them is attached to a specific row and a specific column in widget. Every row in the table must have the same height, and every column must have the same width if the table was said as Homogeneous. But you can also decide to have an heterogeneous table, where the width and height are set by the children contained in the table. Check out the Gtk_Sheet widget for a different kind of table that can also contain text and images in a more efficient way. * Menu: * Gtk.Table Widget Hierarchy:: * Gtk.Table Subprograms::  File: gtkada_rm.info, Node: Gtk.Table Widget Hierarchy, Next: Gtk.Table Subprograms, Up: Package_Gtk.Table Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Widget (*note Package_Gtk.Widget::) \___ Gtk_Container (*note Package_Gtk.Container::) \___ Gtk_Table (*note Package_Gtk.Table::)  File: gtkada_rm.info, Node: Gtk.Table Subprograms, Prev: Gtk.Table Widget Hierarchy, Up: Package_Gtk.Table Subprograms =========== procedure Gtk_New (Widget : out Gtk_Table; Rows : Guint; Columns : Guint; Homogeneous : Boolean); Create a new table. The width allocated to the table is divided into Columns columns, which all have the same width if Homogeneous is True. If Homogeneous is False, the width will be calculated with the children contained in the table. Same behavior for the rows. function Get_Type return Gtk.Gtk_Type; Return the internal value associated with a Gtk_Table. procedure Resize (Table : access Gtk_Table_Record; Rows : Guint; Columns : Guint); Modify the number of rows and columns in the table. procedure Attach (Table : access Gtk_Table_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Left_Attach : Guint; Right_Attach : Guint; Top_Attach : Guint; Bottom_Attach : Guint; Xoptions : Gtk_Attach_Options := Expand or Fill; Yoptions : Gtk_Attach_Options := Expand or Fill; Xpadding : Guint := 0; Ypadding : Guint := 0); Insert a new widget in the table. All the attachments are relative to the separations between columns and rows (for instance, to insert a widget spanning the first two columns in the table, you should put Left_Attach=0 and Right_Attach=2). Same behavior for the rows. Xoptions and Yoptions indicate the behavior of the child when the table is resized (whether the child can shrink or expand). See the description in Gtk.Box for more information on the possible values. Xpadding and Ypadding are the amount of space left around the child. procedure Attach_Defaults (Table : access Gtk_Table_Record; Widget : access Gtk.Widget.Gtk_Widget_Record'Class; Left_Attach : Guint; Right_Attach : Guint; Top_Attach : Guint; Bottom_Attach : Guint); Insert a new widget in the table, with default values. No padding is put around the child, and the options are set to Expand and Fill. This call is similar to Attach with default values and is only provided for compatibility. procedure Set_Row_Spacing (Table : access Gtk_Table_Record; Row : Guint; Spacing : Guint); Set the spacing insert between Row and the next one. Spacing is in pixels. procedure Set_Col_Spacing (Table : access Gtk_Table_Record; Column : Guint; Spacing : Guint); Set the spacing in pixels between Column and the next one. procedure Set_Row_Spacings (Table : access Gtk_Table_Record; Spacing : Guint); Set the spacing for all the rows. procedure Set_Col_Spacings (Table : access Gtk_Table_Record; Spacing : Guint); Set the spacing for all the columns. procedure Set_Homogeneous (Table : access Gtk_Table_Record; Homogeneous : Boolean); Indicate the homogeneous status of the table. If Homogeneous is True, the rows and columns of the table will all be allocated the same width or height. function Get_Row_Spacing (Table : access Gtk_Table_Record; Row : Guint) return Guint; Return the spacing in pixels between Row and the next one. function Get_Col_Spacing (Table : access Gtk_Table_Record; Column : Guint) return Guint; Return the spacing in pixels between Column and the next one. function Get_Default_Row_Spacing (Table : access Gtk_Table_Record) return Guint; Return the default spacing for the rows. function Get_Default_Col_Spacing (Table : access Gtk_Table_Record) return Guint; Return the default spacing for the columns. function Get_Homogeneous (Table : access Gtk_Table_Record) return Boolean; Return the homogeneous status of the table. See Set_Homogeneous for more details.  File: gtkada_rm.info, Node: Package_Gtk.Text, Next: Package_Gtk.Text_Attributes, Prev: Package_Gtk.Table, Up: Top 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. * Menu: * Gtk.Text Widget Hierarchy:: * Gtk.Text Subprograms::  File: gtkada_rm.info, Node: Gtk.Text Widget Hierarchy, Next: Gtk.Text Subprograms, Up: Package_Gtk.Text Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Widget (*note Package_Gtk.Widget::) \___ Gtk_Old_Editable (*note Package_Gtk.Old_Editable::) \___ Gtk_Text (*note Package_Gtk.Text::)  File: gtkada_rm.info, Node: Gtk.Text Subprograms, Prev: Gtk.Text Widget Hierarchy, Up: 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.  File: gtkada_rm.info, Node: Package_Gtk.Text_Attributes, Next: Package_Gtk.Text_Buffer, Prev: Package_Gtk.Text, Up: Top Package Gtk.Text`_'Attributes ***************************** This package defines the Gtk_Text_Attributes type. * Menu: * Gtk.Text_Attributes Types:: * Gtk.Text_Attributes Subprograms::  File: gtkada_rm.info, Node: Gtk.Text_Attributes Types, Next: Gtk.Text_Attributes Subprograms, Up: Package_Gtk.Text_Attributes Types ===== type Gtk_Text_Attributes is new Glib.C_Proxy;  File: gtkada_rm.info, Node: Gtk.Text_Attributes Subprograms, Prev: Gtk.Text_Attributes Types, Up: Package_Gtk.Text_Attributes Subprograms =========== procedure Gtk_New (Text_Attr : out Gtk_Text_Attributes); Create a new Gtk_Text_Attributes structure. procedure Ref (Values : Gtk_Text_Attributes); Increase the reference counter of the given Gtk_Text_Attributes by one (this counter is initially set to 1 when this structure is created). procedure Unref (Values : Gtk_Text_Attributes); Decrease the reference counter by one. When it reaches zero, the Gtk_Text_Attributes is automatically deallocated. function Copy (Src : Gtk_Text_Attributes) return Gtk_Text_Attributes; Create a copy of the given Gtk_Text_Attributes structure. procedure Copy_Values (Src : Gtk_Text_Attributes; Dest : Gtk_Text_Attributes); Copy the values from Src into Dest so that Dest has the same values as Src. Free existing values in Dest. Dest's reference counter is preserved. function Get_Font (Text_Attr : Gtk_Text_Attributes) return Pango.Font.Pango_Font_Description; Return the Pango_Font_Description associated to the given Gtk_Text_Attributes. procedure Set_Font (Text_Attr : Gtk_Text_Attributes; Font : Pango.Font.Pango_Font_Description); Set the Pango_Font_Description associated to the given Gtk_Text_Attributes.  File: gtkada_rm.info, Node: Package_Gtk.Text_Buffer, Next: Package_Gtk.Text_Iter, Prev: Package_Gtk.Text_Attributes, Up: Top Package Gtk.Text`_'Buffer ************************* This is the public representation of a text buffer to be used in cunjunction with Gtk.Text_View. * Menu: * Gtk.Text_Buffer Widget Hierarchy:: * Gtk.Text_Buffer Signals:: * Gtk.Text_Buffer Subprograms::  File: gtkada_rm.info, Node: Gtk.Text_Buffer Widget Hierarchy, Next: Gtk.Text_Buffer Signals, Up: Package_Gtk.Text_Buffer Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Text_Buffer (*note Package_Gtk.Text_Buffer::)  File: gtkada_rm.info, Node: Gtk.Text_Buffer Signals, Next: Gtk.Text_Buffer Subprograms, Prev: Gtk.Text_Buffer Widget Hierarchy, Up: Package_Gtk.Text_Buffer Signals ======= * "apply_tag" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Tag : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; Start_Char : Gtk.Text_Iter.Gtk_Text_Iter; End_Char : Gtk.Text_Iter.Gtk_Text_Iter); * "begin_user_action" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class); * "changed" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class); * "delete_range" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); * "end_user_action" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class); * "insert_child_anchor" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Pos : Gtk.Text_Iter.Gtk_Text_Iter; Anchor : access Gtk.Text_Child.Gtk_Text_Child_Anchor_Record'Class); * "insert_pixbuf" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Pos : Gtk.Text_Iter.Gtk_Text_Iter; Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf); * "insert_text" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Pos : Gtk.Text_Iter.Gtk_Text_Iter; Text : UTF8_String; Length : Gint); * "mark_deleted" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); * "mark_set" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Location : Gtk.Text_Iter.Gtk_Text_Iter; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); * "modified_changed" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class); * "remove_tag" procedure Handler (Widget : access Gtk_Text_Buffer_Record'Class; Tag : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; Start_Char : Gtk.Text_Iter.Gtk_Text_Iter; End_Char : Gtk.Text_Iter.Gtk_Text_Iter);  File: gtkada_rm.info, Node: Gtk.Text_Buffer Subprograms, Prev: Gtk.Text_Buffer Signals, Up: Package_Gtk.Text_Buffer Subprograms =========== procedure Gtk_New (Buffer : out Gtk_Text_Buffer; Table : Gtk.Text_Tag_Table.Gtk_Text_Tag_Table := null); Create a new text buffer. Create a new table if Table is null. The buffer is created with a reference count of 1, and therefore should be manually unreferenced (Glib.Object.Unref). It is recommended to do that as soon as the buffer has been used to create a Gtk.Text_View.Gtk_Text_View widget. function Get_Type return Glib.GType; Return the internal value associated with a Gtk_Text_Buffer. function Get_Line_Count (Buffer : access Gtk_Text_Buffer_Record) return Gint; Return the number of lines in the buffer. This value is cached, so the function is very fast. function Get_Char_Count (Buffer : access Gtk_Text_Buffer_Record) return Gint; Return the number of characters in the buffer. Note that characters and bytes are not the same, you can't e.g. expect the contents of the buffer in string form to be this many bytes long. The character count is cached, so this function is very fast. function Get_Tag_Table (Buffer : access Gtk_Text_Buffer_Record) return Gtk.Text_Tag_Table.Gtk_Text_Tag_Table; Get the Gtk_Text_Tag_Table associated with this buffer. procedure Set_Text (Buffer : access Gtk_Text_Buffer_Record; Text : UTF8_String); Delete current contents of Buffer, and insert Text instead. If Text doesn't end with a newline, a newline is added; Gtk_Text_Buffer contents must always end with a newline. If Text ends with a newline, the new buffer contents will be exactly Text. Text: UTF-8 format text to insert. procedure Insert (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Text : UTF8_String); Insert Text at position Iter. Emit the "insert_text" signal; insertion actually occurs in the default handler for the signal. Iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text. Text: UTF-8 format text to insert. procedure Insert_At_Cursor (Buffer : access Gtk_Text_Buffer_Record; Text : UTF8_String); Call Buffer_Insert, using the current cursor position as the insertion point. Text: UTF-8 format text to insert. procedure Insert_At_Cursor (Buffer : access Gtk_Text_Buffer_Record; Text : Gtkada.Types.Chars_Ptr; Len : Gint := -1); Call Buffer_Insert, using the current cursor position as the insertion point. Text: UTF-8 format C string to insert. procedure Insert_Interactive (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Text : UTF8_String; Default_Editable : Boolean; Result : out Boolean); Like Insert, but the insertion will not occur if Iter is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive). Default_Editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk.Text_View.Get_Editable is appropriate here. Text: UTF-8 format text to insert. Result: whether text was actually inserted. function Insert_Interactive_At_Cursor (Buffer : access Gtk_Text_Buffer_Record; Text : UTF8_String; Default_Editable : Boolean) return Boolean; Call Insert_Interactive at the cursor position. Text: UTF-8 format text to insert. Return value: whether text was actually inserted. procedure Insert_Range (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Copy text, tags, and pixbufs between Start and End. The order of Start and End doesn't matter. Also insert the copy at Iter. Used instead of simply getting/inserting text because it preserves images and tags. If Start and End are in a different buffer from Buffer, the two buffers must share the same tag table. Implemented via emissions of the insert_text and apply_tag signals, so expect those. procedure Insert_Range_Interactive (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter; Default_Editable : Boolean; Result : out Boolean); Like Insert_Range, does nothing if the insertion point isn't editable. The Default_Editable parameter indicates whether the text is editable at Iter if no tags enclosing Iter affect editability. Typically the result of Gtk.Text_View.Get_Editable is appropriate here. Result: whether an insertion was possible at Iter procedure Delete (Buffer : access Gtk_Text_Buffer_Record; Start : in out Gtk.Text_Iter.Gtk_Text_Iter; The_End : in out Gtk.Text_Iter.Gtk_Text_Iter); Delete text between Start and End. The order of Start and End is not actually relevant; Delete will reorder them. This function actually emits the "delete_range" signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the Start and End will be re-initialized to point to the location where text was deleted. Note that the final newline in the buffer may not be deleted; a Gtk_Text_Buffer always contains at least one newline. You can safely include the final newline in the range [Start,End) but it won't be affected by the deletion. procedure Delete_Interactive (Buffer : access Gtk_Text_Buffer_Record; Start_Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; End_Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Default_Editable : Boolean; Result : out Boolean); Delete all editable text in the given range. Call Delete for each editable sub-range of [Start,End). Start and End are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted. Result: whether some text was actually deleted function Get_Text (Buffer : access Gtk_Text_Buffer_Record; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter; Include_Hidden_Chars : Boolean := False) return UTF8_String; Return the text in the range [Start,End). Exclude undisplayed text (text marked with tags that set the invisibility attribute) if Include_Hidden_Chars is False. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with Get_Slice. Return value: an allocated UTF-8 string function Get_Text (Buffer : access Gtk_Text_Buffer_Record; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter; Include_Hidden_Chars : Boolean := False) return Gtkada.Types.Chars_Ptr; Same as Get_Text above, but return a pointer to a C string, for efficiency. The caller is responsible for freeing (using Gtkada.Types.g_free) the returned pointer. function Get_Slice (Buffer : access Gtk_Text_Buffer_Record; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter; Include_Hidden_Chars : Boolean := False) return UTF8_String; Return the text in the range [Start,End). Exclude undisplayed text (text marked with tags that set the invisibility attribute) if Include_Hidden_Chars is False. The returned string includes a 16#FFFC# character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with Get_Text. Note that 16#FFFC# can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer. Return value: an allocated UTF-8 string function Get_Slice (Buffer : access Gtk_Text_Buffer_Record; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter; Include_Hidden_Chars : Boolean := False) return Gtkada.Types.Chars_Ptr; Same as Get_Slice above, but return a pointer to a C string, for efficiency. The caller is responsible for freeing (using Gtkada.Types.g_free) the returned pointer. procedure Insert_Pixbuf (Buffer : access Gtk_Text_Buffer_Record; Iter : Gtk.Text_Iter.Gtk_Text_Iter; Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf); Insert an image into the text buffer at Iter. The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 16#FFFC#. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see Get_Slice and Get_Text. procedure Insert_Child_Anchor (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Anchor : access Gtk.Text_Child.Gtk_Text_Child_Anchor_Record'Class); Insert a child widget anchor into the text buffer at Iter. The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 16#FFFC#. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see Get_Slice and Get_Text. Consider Create_Child_Anchor as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion. procedure Create_Child_Anchor (Buffer : access Gtk_Text_Buffer_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Gtk.Text_Child.Gtk_Text_Child_Anchor); Convenience function which simply creates a child anchor with Gtk.Text_Child.Gtk_New and inserts it into the buffer with Insert_Child_Anchor. Result: the created child anchor. function Create_Mark (Buffer : access Gtk_Text_Buffer_Record; Mark_Name : String := ""; Where : Gtk.Text_Iter.Gtk_Text_Iter; Left_Gravity : Boolean := True) return Gtk.Text_Mark.Gtk_Text_Mark; Create a mark at position Where. If Mark_Name is null, the mark is anonymous; otherwise, the mark can be retrieved by name using Get_Mark. If a mark has left gravity, and text is inserted at the mark's current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (Left_Gravity = False), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). The caller of this function does not own a reference to the returned Gtk_Text_Mark, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does. Emit the "mark_set" signal as notification of the mark's initial placement. Return value: the new Gtk_Text_Mark object. procedure Move_Mark (Buffer : access Gtk_Text_Buffer_Record; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class; Where : Gtk.Text_Iter.Gtk_Text_Iter); Move Mark to the new location Where. Emit the "mark_set" signal as notification of the move. procedure Delete_Mark (Buffer : access Gtk_Text_Buffer_Record; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); Delete Mark, so that it's no longer located anywhere in the buffer. Remove the reference the buffer holds to the mark, so if you haven't called Ref on the mark, it will be freed. Even if the mark isn't freed, most operations on Mark become invalid. There is no way to undelete a mark. Gtk.Text_Mark.Get_Deleted will return True after this function has been called on a mark; Gtk.Text_Mark.Get_Deleted indicates that a mark no longer belongs to a buffer. The "mark_deleted" signal will be emitted as notification after the mark is deleted. function Get_Mark (Buffer : access Gtk_Text_Buffer_Record; Name : String) return Gtk.Text_Mark.Gtk_Text_Mark; Return the mark named Name in Buffer or null if no such mark exists in the buffer. procedure Move_Mark_By_Name (Buffer : access Gtk_Text_Buffer_Record; Name : String; Where : Gtk.Text_Iter.Gtk_Text_Iter); Move the mark named Name (which must exist) to location Where. See Move_Mark for details. procedure Delete_Mark_By_Name (Buffer : access Gtk_Text_Buffer_Record; Name : String); Delete the mark named Name The mark must exist. See Delete_Mark for details. function Get_Insert (Buffer : access Gtk_Text_Buffer_Record) return Gtk.Text_Mark.Gtk_Text_Mark; Return the mark that represents the cursor (insertion point). Equivalent to calling Get_Mark to get the mark name "insert", but slightly more efficient, and involves less typing. function Get_Selection_Bound (Buffer : access Gtk_Text_Buffer_Record) return Gtk.Text_Mark.Gtk_Text_Mark; Return the mark that represents the selection bound. Equivalent to calling Get_Mark to get the mark name "selection_bound", but very slightly more efficient, and involves less typing. The currently-selected text in Buffer is the region between the "selection_bound" and "insert" marks. If "selection_bound" and "insert" are in the same place, then there is no current selection. Get_Selection_Bounds is another convenient function for handling the selection, if you just want to know whether there's a selection and what its bounds are. procedure Place_Cursor (Buffer : access Gtk_Text_Buffer_Record; Where : Gtk.Text_Iter.Gtk_Text_Iter); Move the "insert" and "selection_bound" marks simultaneously. If you move them to the same place in two steps with Move_Mark, you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recomputed. This function moves them as a unit, which can be optimized. If you want to get the position of the cursor, the simplest way is Get_Iter_At_Mark (Buffer, Iter, Get_Insert (Buffer)); procedure Apply_Tag (Buffer : access Gtk_Text_Buffer_Record; Tag : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Emit the "apply_tag" signal on Buffer. The default handler for the signal applies Tag to the given range. Start and End do not have to be in order. procedure Remove_Tag (Buffer : access Gtk_Text_Buffer_Record; Tag : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Emit the "remove_tag" signal. The default handler for the signal removes all occurrences of Tag from the given range. Start and End don't have to be in order. procedure Remove_All_Tags (Buffer : access Gtk_Text_Buffer_Record; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Remove all tags in the range between Start and End. Note that this procedure should be used carefully, as it might be removing tags that were added from another section of the code. procedure Apply_Tag_By_Name (Buffer : access Gtk_Text_Buffer_Record; Name : String; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Call Gtk.Text_Tag_Table.Lookup on the buffer's tag table to get a Gtk_Text_Tag, then call Apply_Tag. procedure Remove_Tag_By_Name (Buffer : access Gtk_Text_Buffer_Record; Name : String; Start : Gtk.Text_Iter.Gtk_Text_Iter; The_End : Gtk.Text_Iter.Gtk_Text_Iter); Call Gtk.Text_Tag_Table.Lookup on the buffer's tag table to get a Gtk_Text_Tag, then call Remove_Tag. procedure Get_Iter_At_Line_Offset (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Line_Number : Gint; Char_Offset : Gint := 0); Obtain an iterator pointing to Char_Offset within the given line. The Char_Offset must exist, offsets off the end of the line are not allowed. Note characters, not bytes; UTF-8 may encode one character as multiple bytes. procedure Get_Iter_At_Line_Index (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Line_Number : Gint; Byte_Index : Gint := 0); Obtain an iterator pointing to Byte_Index within the given line. Byte_Index must be the start of a UTF-8 character, and must not be beyond the end of the line. Note bytes, not characters; UTF-8 may encode one character as multiple bytes. procedure Get_Iter_At_Offset (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Char_Offset : Gint); Initialize Iter to a position Char_Offset chars from the start of the entire buffer. Char_Offset: char offset from start of buffer, counting from 0. procedure Get_Iter_At_Line (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Line_Number : Gint); Initialize Iter to the start of the given line. Line_Number: line number counting from 0. procedure Get_Start_Iter (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter); Initialize Iter with the first position in the text buffer. This is the same as using Get_Iter_At_Offset with Offset set to 0. procedure Get_End_Iter (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter); Initialize Iter with the "end iterator", one past the last valid character in the text buffer. If dereferenced with Gtk.Text_Iter.Get_Char, the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (call Get_Iter_At_Offset to get character position 0) to the end iterator. procedure Get_Bounds (Buffer : access Gtk_Text_Buffer_Record; Start : out Gtk.Text_Iter.Gtk_Text_Iter; The_End : out Gtk.Text_Iter.Gtk_Text_Iter); Retrieve the first and last iterators in the buffer. The entire buffer lies within the range [Start,End). procedure Get_Iter_At_Mark (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); Initialize Iter with the current position of Mark. procedure Get_Iter_At_Child_Anchor (Buffer : access Gtk_Text_Buffer_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Anchor : access Gtk.Text_Child.Gtk_Text_Child_Anchor_Record'Class); ??? function Get_Modified (Buffer : access Gtk_Text_Buffer_Record) return Boolean; Whether the buffer has been modified since the last call to Set_Modified set the modification flag to False. Used for example to enable a "save" function in a text editor. procedure Set_Modified (Buffer : access Gtk_Text_Buffer_Record; Setting : Boolean := True); Used to keep track of whether the buffer has been modified since the last time it was saved. Whenever the buffer is saved to disk, call Set_Modified (Buffer, False). When the buffer is modified, it will automatically toggled on the modified bit again. When the modified bit flips, the buffer emits a "modified_changed" signal. procedure Cut_Clipboard (Buffer : access Gtk_Text_Buffer_Record; Clipboard : Gtk.Clipboard.Gtk_Clipboard; Default_Editable : Boolean := True); Copy the currently-selected text to the clipboard, then delete said text if it's editable. Default_Editable: default editability of the buffer. procedure Copy_Clipboard (Buffer : access Gtk_Text_Buffer_Record; Clipboard : Gtk.Clipboard.Gtk_Clipboard); Copy the currently-selected text to the clipboard. procedure Paste_Clipboard (Buffer : access Gtk_Text_Buffer_Record; Clipboard : Gtk.Clipboard.Gtk_Clipboard; Override_Location : Gtk.Text_Iter.Gtk_Text_Iter_Access := null; Default_Editable : Boolean := True); Paste the clipboard contents at the insertion point, or at Override_Location if this parameter is not null. (Note: pasting is asynchronous, that is, we'll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.) function Selection_Exists (Buffer : access Gtk_Text_Buffer_Record) return Boolean; Return True if some text in the buffer is currently selected. procedure Get_Selection_Bounds (Buffer : access Gtk_Text_Buffer_Record; Start : out Gtk.Text_Iter.Gtk_Text_Iter; The_End : out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Boolean); Place the bounds of the selection in Start and End. If the selection has length 0, then Start and End are filled in with the same value. Start and End will be in ascending order. Result: whether the selection has nonzero length. function Delete_Selection (Buffer : access Gtk_Text_Buffer_Record; Interactive : Boolean; Default_Editable : Boolean) return Boolean; Delete the range between the "insert" and "selection_bound" marks, that is, the currently-selected text. If Interactive is True, the editability of the selection will be considered (users can't delete uneditable text). Return value: whether there was a non-empty selection to delete. procedure Begin_User_Action (Buffer : access Gtk_Text_Buffer_Record); Called to indicate that the buffer operations between here and a call to End_User_Action are part of a single user-visible operation. The operations between Begin_User_Action and End_User_Action can then be grouped when creating an undo stack. Gtk_Text_Buffer maintains a count of calls to Begin_User_Action that have not been closed with a call to End_User_Action, and emits the "begin_user_action" and "end_user_action" signals only for the outermost pair of calls. This allows you to build user actions from other user actions. The "interactive" buffer mutation functions, such as Insert_Interactive, automatically call begin/end user action around the buffer operations they perform, so there's no need to add extra calls if your user action consists solely of a single call to one of those functions. procedure End_User_Action (Buffer : access Gtk_Text_Buffer_Record); Should be paired with a call to Begin_User_Action. See that function for a full explanation. function Get_Buffer (Iter : Gtk.Text_Iter.Gtk_Text_Iter) return Gtk_Text_Buffer; Return the buffer associated to the given Gtk_Text_Iterator.  File: gtkada_rm.info, Node: Package_Gtk.Text_Iter, Next: Package_Gtk.Text_Mark, Prev: Package_Gtk.Text_Buffer, Up: Top Package Gtk.Text`_'Iter *********************** A Gtk_Text_Iter represents a location in the text. It becomes invalid if the characters/pixmaps/widgets (indexable objects) in the text buffer are changed. * Menu: * Gtk.Text_Iter Types:: * Gtk.Text_Iter Subprograms::  File: gtkada_rm.info, Node: Gtk.Text_Iter Types, Next: Gtk.Text_Iter Subprograms, Up: Package_Gtk.Text_Iter Types ===== type Gtk_Text_Iter is limited private; type Gtk_Text_Iter_Access is access all Gtk_Text_Iter;