_
BufferThis is the public representation of a text buffer to be used in cunjunction with Gtk.Text_View.
Widget Hierarchy |
---|
GObject (see section Package Glib.Object)
Gtk_Object (see section Package Gtk.Object)
\___ Gtk_Text_Buffer (see section Package Gtk.Text
|
Signals |
---|
Subprograms |
---|
procedure Gtk_New (Buffer : out Gtk_Text_Buffer; Table : Gtk.Text_Tag_Table.Gtk_Text_Tag_Table := null); | ||
Create a new text buffer. | ||
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. | ||
function Get_Char_Count (Buffer : access Gtk_Text_Buffer_Record) return Gint; | ||
Return the number of characters in the buffer. | ||
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. | ||
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. | ||
procedure Insert_At_Cursor (Buffer : access Gtk_Text_Buffer_Record; Text : UTF8_String); | ||
Call Buffer_Insert, using the current cursor position | ||
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 | ||
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
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. | ||
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. | ||
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. | ||
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.
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. | ||
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). | ||
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 | ||
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). | ||
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 | ||
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. | ||
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. | ||
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 | ||
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. 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. | ||
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 | ||
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 | ||
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. | ||
procedure Delete_Mark_By_Name (Buffer : access Gtk_Text_Buffer_Record; Name : String); | ||
Delete the mark named Name | ||
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). | ||
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.
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 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. | ||
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. | ||
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. | ||
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 | ||
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 | ||
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 | ||
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. | ||
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 | ||
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. | ||
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 | ||
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 | ||
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. | ||
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 | ||
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 | ||
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 | ||
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, | ||
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 | ||
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, | ||
procedure Begin_User_Action (Buffer : access Gtk_Text_Buffer_Record); | ||
Called to indicate that the buffer operations between here and a
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. | ||
function Get_Buffer (Iter : Gtk.Text_Iter.Gtk_Text_Iter) return Gtk_Text_Buffer; | ||
Return the buffer associated to the given Gtk_Text_Iterator.
|