1------------------------------------------------------------------------------ 2-- -- 3-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 4-- Copyright (C) 2000-2015, AdaCore -- 5-- -- 6-- This library is free software; you can redistribute it and/or modify it -- 7-- under terms of the GNU General Public License as published by the Free -- 8-- Software Foundation; either version 3, or (at your option) any later -- 9-- version. This library is distributed in the hope that it will be useful, -- 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- 11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- 12-- -- 13-- As a special exception under Section 7 of GPL version 3, you are granted -- 14-- additional permissions described in the GCC Runtime Library Exception, -- 15-- version 3.1, as published by the Free Software Foundation. -- 16-- -- 17-- You should have received a copy of the GNU General Public License and -- 18-- a copy of the GCC Runtime Library Exception along with this program; -- 19-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 20-- <http://www.gnu.org/licenses/>. -- 21-- -- 22------------------------------------------------------------------------------ 23 24-- <description> 25-- You may wish to begin by reading the [text widget conceptual 26-- overview][TextWidget] which gives an overview of all the objects and data 27-- types related to the text widget and how they work together. 28-- 29-- </description> 30pragma Ada_2005; 31 32pragma Warnings (Off, "*is already use-visible*"); 33with Gdk.Pixbuf; use Gdk.Pixbuf; 34with Gdk.Types; use Gdk.Types; 35with Glib; use Glib; 36with Glib.Object; use Glib.Object; 37with Glib.Properties; use Glib.Properties; 38with Gtk.Clipboard; use Gtk.Clipboard; 39with Gtk.Target_List; use Gtk.Target_List; 40with Gtk.Text_Child_Anchor; use Gtk.Text_Child_Anchor; 41with Gtk.Text_Iter; use Gtk.Text_Iter; 42with Gtk.Text_Mark; use Gtk.Text_Mark; 43with Gtk.Text_Tag; use Gtk.Text_Tag; 44with Gtk.Text_Tag_Table; use Gtk.Text_Tag_Table; 45with Gtkada.Types; use Gtkada.Types; 46 47package Gtk.Text_Buffer is 48 49 type Gtk_Text_Buffer_Record is new GObject_Record with null record; 50 type Gtk_Text_Buffer is access all Gtk_Text_Buffer_Record'Class; 51 52 ------------------ 53 -- Constructors -- 54 ------------------ 55 56 procedure Gtk_New 57 (Buffer : out Gtk_Text_Buffer; 58 Table : Gtk.Text_Tag_Table.Gtk_Text_Tag_Table := null); 59 procedure Initialize 60 (Buffer : not null access Gtk_Text_Buffer_Record'Class; 61 Table : Gtk.Text_Tag_Table.Gtk_Text_Tag_Table := null); 62 -- Creates a new text buffer. 63 -- "table": a tag table, or null to create a new one 64 65 function Gtk_Text_Buffer_New 66 (Table : Gtk.Text_Tag_Table.Gtk_Text_Tag_Table := null) 67 return Gtk_Text_Buffer; 68 -- Creates a new text buffer. 69 -- "table": a tag table, or null to create a new one 70 71 function Get_Type return Glib.GType; 72 pragma Import (C, Get_Type, "gtk_text_buffer_get_type"); 73 74 ------------- 75 -- Methods -- 76 ------------- 77 78 procedure Add_Mark 79 (Buffer : not null access Gtk_Text_Buffer_Record; 80 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class; 81 Where : Gtk.Text_Iter.Gtk_Text_Iter); 82 -- Adds the mark at position Where. The mark must not be added to another 83 -- buffer, and if its name is not null then there must not be another mark 84 -- in the buffer with the same name. 85 -- Emits the Gtk.Text_Buffer.Gtk_Text_Buffer::mark-set signal as 86 -- notification of the mark's initial placement. 87 -- Since: gtk+ 2.12 88 -- "mark": the mark to add 89 -- "where": location to place mark 90 91 procedure Add_Selection_Clipboard 92 (Buffer : not null access Gtk_Text_Buffer_Record; 93 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class); 94 -- Adds Clipboard to the list of clipboards in which the selection 95 -- contents of Buffer are available. In most cases, Clipboard will be the 96 -- Gtk.Clipboard.Gtk_Clipboard of type GDK_SELECTION_PRIMARY for a view of 97 -- Buffer. 98 -- "clipboard": a Gtk.Clipboard.Gtk_Clipboard 99 100 procedure Apply_Tag 101 (Buffer : not null access Gtk_Text_Buffer_Record; 102 Tag : not null access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; 103 Start : Gtk.Text_Iter.Gtk_Text_Iter; 104 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 105 -- Emits the "apply-tag" signal on Buffer. The default handler for the 106 -- signal applies Tag to the given range. Start and End do not have to be 107 -- in order. 108 -- "tag": a Gtk.Text_Tag.Gtk_Text_Tag 109 -- "start": one bound of range to be tagged 110 -- "end": other bound of range to be tagged 111 112 procedure Apply_Tag_By_Name 113 (Buffer : not null access Gtk_Text_Buffer_Record; 114 Name : UTF8_String; 115 Start : Gtk.Text_Iter.Gtk_Text_Iter; 116 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 117 -- Calls Gtk.Text_Tag_Table.Lookup on the buffer's tag table to get a 118 -- Gtk.Text_Tag.Gtk_Text_Tag, then calls Gtk.Text_Buffer.Apply_Tag. 119 -- "name": name of a named Gtk.Text_Tag.Gtk_Text_Tag 120 -- "start": one bound of range to be tagged 121 -- "end": other bound of range to be tagged 122 123 function Backspace 124 (Buffer : not null access Gtk_Text_Buffer_Record; 125 Iter : Gtk.Text_Iter.Gtk_Text_Iter; 126 Interactive : Boolean; 127 Default_Editable : Boolean) return Boolean; 128 -- Performs the appropriate action as if the user hit the delete key with 129 -- the cursor at the position specified by Iter. In the normal case a 130 -- single character will be deleted, but when combining accents are 131 -- involved, more than one character can be deleted, and when precomposed 132 -- character and accent combinations are involved, less than one character 133 -- will be deleted. 134 -- Because the buffer is modified, all outstanding iterators become 135 -- invalid after calling this function; however, the Iter will be 136 -- re-initialized to point to the location where text was deleted. 137 -- Since: gtk+ 2.6 138 -- "iter": a position in Buffer 139 -- "interactive": whether the deletion is caused by user interaction 140 -- "default_editable": whether the buffer is editable by default 141 142 procedure Begin_User_Action 143 (Buffer : not null access Gtk_Text_Buffer_Record); 144 -- Called to indicate that the buffer operations between here and a call 145 -- to Gtk.Text_Buffer.End_User_Action are part of a single user-visible 146 -- operation. The operations between Gtk.Text_Buffer.Begin_User_Action and 147 -- Gtk.Text_Buffer.End_User_Action can then be grouped when creating an 148 -- undo stack. Gtk.Text_Buffer.Gtk_Text_Buffer maintains a count of calls 149 -- to Gtk.Text_Buffer.Begin_User_Action that have not been closed with a 150 -- call to Gtk.Text_Buffer.End_User_Action, and emits the 151 -- "begin-user-action" and "end-user-action" signals only for the outermost 152 -- pair of calls. This allows you to build user actions from other user 153 -- actions. 154 -- The "interactive" buffer mutation functions, such as 155 -- Gtk.Text_Buffer.Insert_Interactive, automatically call begin/end user 156 -- action around the buffer operations they perform, so there's no need to 157 -- add extra calls if you user action consists solely of a single call to 158 -- one of those functions. 159 160 procedure Copy_Clipboard 161 (Buffer : not null access Gtk_Text_Buffer_Record; 162 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class); 163 -- Copies the currently-selected text to a clipboard. 164 -- "clipboard": the Gtk.Clipboard.Gtk_Clipboard object to copy to 165 166 function Create_Child_Anchor 167 (Buffer : not null access Gtk_Text_Buffer_Record; 168 Iter : Gtk.Text_Iter.Gtk_Text_Iter) 169 return Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor; 170 -- This is a convenience function which simply creates a child anchor with 171 -- Gtk.Text_Child_Anchor.Gtk_New and inserts it into the buffer with 172 -- Gtk.Text_Buffer.Insert_Child_Anchor. The new anchor is owned by the 173 -- buffer; no reference count is returned to the caller of 174 -- Gtk.Text_Buffer.Create_Child_Anchor. 175 -- "iter": location in the buffer 176 177 function Create_Mark 178 (Buffer : not null access Gtk_Text_Buffer_Record; 179 Mark_Name : UTF8_String := ""; 180 Where : Gtk.Text_Iter.Gtk_Text_Iter; 181 Left_Gravity : Boolean := True) return Gtk.Text_Mark.Gtk_Text_Mark; 182 -- Creates a mark at position Where. If Mark_Name is null, the mark is 183 -- anonymous; otherwise, the mark can be retrieved by name using 184 -- Gtk.Text_Buffer.Get_Mark. If a mark has left gravity, and text is 185 -- inserted at the mark's current location, the mark will be moved to the 186 -- left of the newly-inserted text. If the mark has right gravity 187 -- (Left_Gravity = False), the mark will end up on the right of 188 -- newly-inserted text. The standard left-to-right cursor is a mark with 189 -- right gravity (when you type, the cursor stays on the right side of the 190 -- text you're typing). 191 -- The caller of this function does not own a reference to the returned 192 -- Gtk.Text_Mark.Gtk_Text_Mark, so you can ignore the return value if you 193 -- like. Marks are owned by the buffer and go away when the buffer does. 194 -- Emits the Gtk.Text_Buffer.Gtk_Text_Buffer::mark-set signal as 195 -- notification of the mark's initial placement. 196 -- "mark_name": name for mark, or null 197 -- "where": location to place mark 198 -- "left_gravity": whether the mark has left gravity 199 200 procedure Cut_Clipboard 201 (Buffer : not null access Gtk_Text_Buffer_Record; 202 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class; 203 Default_Editable : Boolean); 204 -- Copies the currently-selected text to a clipboard, then deletes said 205 -- text if it's editable. 206 -- "clipboard": the Gtk.Clipboard.Gtk_Clipboard object to cut to 207 -- "default_editable": default editability of the buffer 208 209 procedure Delete 210 (Buffer : not null access Gtk_Text_Buffer_Record; 211 Start : in out Gtk.Text_Iter.Gtk_Text_Iter; 212 The_End : in out Gtk.Text_Iter.Gtk_Text_Iter); 213 -- Deletes text between Start and End. The order of Start and End is not 214 -- actually relevant; Gtk.Text_Buffer.Delete will reorder them. This 215 -- function actually emits the "delete-range" signal, and the default 216 -- handler of that signal deletes the text. Because the buffer is modified, 217 -- all outstanding iterators become invalid after calling this function; 218 -- however, the Start and End will be re-initialized to point to the 219 -- location where text was deleted. 220 -- "start": a position in Buffer 221 -- "end": another position in Buffer 222 223 procedure Delete_Interactive 224 (Buffer : not null access Gtk_Text_Buffer_Record; 225 Start_Iter : Gtk.Text_Iter.Gtk_Text_Iter; 226 End_Iter : Gtk.Text_Iter.Gtk_Text_Iter; 227 Default_Editable : Boolean; 228 Result : out Boolean); 229 -- Deletes all editable text in the given range. Calls 230 -- Gtk.Text_Buffer.Delete for each editable sub-range of [Start,End). Start 231 -- and End are revalidated to point to the location of the last deleted 232 -- range, or left untouched if no text was deleted. 233 -- "start_iter": start of range to delete 234 -- "end_iter": end of range 235 -- "default_editable": whether the buffer is editable by default 236 237 procedure Delete_Mark 238 (Buffer : not null access Gtk_Text_Buffer_Record; 239 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 240 -- Deletes Mark, so that it's no longer located anywhere in the buffer. 241 -- Removes the reference the buffer holds to the mark, so if you haven't 242 -- called g_object_ref on the mark, it will be freed. Even if the mark 243 -- isn't freed, most operations on Mark become invalid, until it gets added 244 -- to a buffer again with Gtk.Text_Buffer.Add_Mark. Use 245 -- Gtk.Text_Mark.Get_Deleted to find out if a mark has been removed from 246 -- its buffer. The Gtk.Text_Buffer.Gtk_Text_Buffer::mark-deleted signal 247 -- will be emitted as notification after the mark is deleted. 248 -- "mark": a Gtk.Text_Mark.Gtk_Text_Mark in Buffer 249 250 procedure Delete_Mark_By_Name 251 (Buffer : not null access Gtk_Text_Buffer_Record; 252 Name : UTF8_String); 253 -- Deletes the mark named Name; the mark must exist. See 254 -- Gtk.Text_Buffer.Delete_Mark for details. 255 -- "name": name of a mark in Buffer 256 257 function Delete_Selection 258 (Buffer : not null access Gtk_Text_Buffer_Record; 259 Interactive : Boolean; 260 Default_Editable : Boolean) return Boolean; 261 -- Deletes the range between the "insert" and "selection_bound" marks, 262 -- that is, the currently-selected text. If Interactive is True, the 263 -- editability of the selection will be considered (users can't delete 264 -- uneditable text). 265 -- "interactive": whether the deletion is caused by user interaction 266 -- "default_editable": whether the buffer is editable by default 267 268 function Deserialize_Get_Can_Create_Tags 269 (Buffer : not null access Gtk_Text_Buffer_Record; 270 Format : Gdk.Types.Gdk_Atom) return Boolean; 271 -- This functions returns the value set with 272 -- Gtk.Text_Buffer.Deserialize_Set_Can_Create_Tags 273 -- Since: gtk+ 2.10 274 -- "format": a Gdk.Types.Gdk_Atom representing a registered rich text 275 -- format 276 277 procedure Deserialize_Set_Can_Create_Tags 278 (Buffer : not null access Gtk_Text_Buffer_Record; 279 Format : Gdk.Types.Gdk_Atom; 280 Can_Create_Tags : Boolean); 281 -- Use this function to allow a rich text deserialization function to 282 -- create new tags in the receiving buffer. Note that using this function 283 -- is almost always a bad idea, because the rich text functions you 284 -- register should know how to map the rich text format they handler to 285 -- your text buffers set of tags. 286 -- The ability of creating new (arbitrary!) tags in the receiving buffer 287 -- is meant for special rich text formats like the internal one that is 288 -- registered using Gtk.Text_Buffer.Register_Deserialize_Tagset, because 289 -- that format is essentially a dump of the internal structure of the 290 -- source buffer, including its tag names. 291 -- You should allow creation of tags only if you know what you are doing, 292 -- e.g. if you defined a tagset name for your application suite's text 293 -- buffers and you know that it's fine to receive new tags from these 294 -- buffers, because you know that your application can handle the newly 295 -- created tags. 296 -- Since: gtk+ 2.10 297 -- "format": a Gdk.Types.Gdk_Atom representing a registered rich text 298 -- format 299 -- "can_create_tags": whether deserializing this format may create tags 300 301 procedure End_User_Action 302 (Buffer : not null access Gtk_Text_Buffer_Record); 303 -- Should be paired with a call to Gtk.Text_Buffer.Begin_User_Action. See 304 -- that function for a full explanation. 305 306 procedure Get_Bounds 307 (Buffer : not null access Gtk_Text_Buffer_Record; 308 Start : out Gtk.Text_Iter.Gtk_Text_Iter; 309 The_End : out Gtk.Text_Iter.Gtk_Text_Iter); 310 -- Retrieves the first and last iterators in the buffer, i.e. the entire 311 -- buffer lies within the range [Start,End). 312 -- "start": iterator to initialize with first position in the buffer 313 -- "end": iterator to initialize with the end iterator 314 315 function Get_Char_Count 316 (Buffer : not null access Gtk_Text_Buffer_Record) return Gint; 317 -- Gets the number of characters in the buffer; note that characters and 318 -- bytes are not the same, you can't e.g. expect the contents of the buffer 319 -- in string form to be this many bytes long. The character count is 320 -- cached, so this function is very fast. 321 322 function Get_Copy_Target_List 323 (Buffer : not null access Gtk_Text_Buffer_Record) 324 return Gtk.Target_List.Gtk_Target_List; 325 -- This function returns the list of targets this text buffer can provide 326 -- for copying and as DND source. The targets in the list are added with 327 -- Info values from the Gtk_Text_Buffer_Target_Info enum, using 328 -- gtk_target_list_add_rich_text_targets and 329 -- Gtk.Target_List.Add_Text_Targets. 330 -- Since: gtk+ 2.10 331 332 procedure Get_End_Iter 333 (Buffer : not null access Gtk_Text_Buffer_Record; 334 Iter : out Gtk.Text_Iter.Gtk_Text_Iter); 335 -- Initializes Iter with the "end iterator," one past the last valid 336 -- character in the text buffer. If dereferenced with 337 -- Gtk.Text_Iter.Get_Char, the end iterator has a character value of 0. The 338 -- entire buffer lies in the range from the first position in the buffer 339 -- (call Gtk.Text_Buffer.Get_Start_Iter to get character position 0) to the 340 -- end iterator. 341 -- "iter": iterator to initialize 342 343 function Get_Has_Selection 344 (Buffer : not null access Gtk_Text_Buffer_Record) return Boolean; 345 -- Indicates whether the buffer has some text currently selected. 346 -- Since: gtk+ 2.10 347 348 function Get_Insert 349 (Buffer : not null access Gtk_Text_Buffer_Record) 350 return Gtk.Text_Mark.Gtk_Text_Mark; 351 -- Returns the mark that represents the cursor (insertion point). 352 -- Equivalent to calling Gtk.Text_Buffer.Get_Mark to get the mark named 353 -- "insert", but very slightly more efficient, and involves less typing. 354 355 procedure Insert 356 (Buffer : not null access Gtk_Text_Buffer_Record; 357 Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; 358 Text : UTF8_String); 359 -- Inserts Len bytes of Text at position Iter. If Len is -1, Text must be 360 -- nul-terminated and will be inserted in its entirety. Emits the 361 -- "insert-text" signal; insertion actually occurs in the default handler 362 -- for the signal. Iter is invalidated when insertion occurs (because the 363 -- buffer contents change), but the default signal handler revalidates it 364 -- to point to the end of the inserted text. 365 -- "iter": a position in the buffer 366 -- "text": text in UTF-8 format 367 368 procedure Get_Iter_At_Child_Anchor 369 (Buffer : not null access Gtk_Text_Buffer_Record; 370 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 371 Anchor : not null access Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor_Record'Class); 372 -- Obtains the location of Anchor within Buffer. 373 -- "iter": an iterator to be initialized 374 -- "anchor": a child anchor that appears in Buffer 375 376 procedure Get_Iter_At_Line 377 (Buffer : not null access Gtk_Text_Buffer_Record; 378 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 379 Line_Number : Gint); 380 -- Initializes Iter to the start of the given line. If Line_Number is 381 -- greater than the number of lines in the Buffer, the end iterator is 382 -- returned. 383 -- "iter": iterator to initialize 384 -- "line_number": line number counting from 0 385 386 procedure Get_Iter_At_Line_Index 387 (Buffer : not null access Gtk_Text_Buffer_Record; 388 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 389 Line_Number : Gint; 390 Byte_Index : Gint); 391 -- Obtains an iterator pointing to Byte_Index within the given line. 392 -- Byte_Index must be the start of a UTF-8 character, and must not be 393 -- beyond the end of the line. Note bytes, not characters; UTF-8 may encode 394 -- one character as multiple bytes. 395 -- "iter": iterator to initialize 396 -- "line_number": line number counting from 0 397 -- "byte_index": byte index from start of line 398 399 procedure Get_Iter_At_Line_Offset 400 (Buffer : not null access Gtk_Text_Buffer_Record; 401 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 402 Line_Number : Gint; 403 Char_Offset : Gint); 404 -- Obtains an iterator pointing to Char_Offset within the given line. The 405 -- Char_Offset must exist, offsets off the end of the line are not allowed. 406 -- Note characters, not bytes; UTF-8 may encode one character as multiple 407 -- bytes. 408 -- "iter": iterator to initialize 409 -- "line_number": line number counting from 0 410 -- "char_offset": char offset from start of line 411 412 procedure Get_Iter_At_Mark 413 (Buffer : not null access Gtk_Text_Buffer_Record; 414 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 415 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 416 -- Initializes Iter with the current position of Mark. 417 -- "iter": iterator to initialize 418 -- "mark": a Gtk.Text_Mark.Gtk_Text_Mark in Buffer 419 420 procedure Get_Iter_At_Offset 421 (Buffer : not null access Gtk_Text_Buffer_Record; 422 Iter : out Gtk.Text_Iter.Gtk_Text_Iter; 423 Char_Offset : Gint); 424 -- Initializes Iter to a position Char_Offset chars from the start of the 425 -- entire buffer. If Char_Offset is -1 or greater than the number of 426 -- characters in the buffer, Iter is initialized to the end iterator, the 427 -- iterator one past the last valid character in the buffer. 428 -- "iter": iterator to initialize 429 -- "char_offset": char offset from start of buffer, counting from 0, or -1 430 431 function Get_Line_Count 432 (Buffer : not null access Gtk_Text_Buffer_Record) return Gint; 433 -- Obtains the number of lines in the buffer. This value is cached, so the 434 -- function is very fast. 435 436 function Get_Mark 437 (Buffer : not null access Gtk_Text_Buffer_Record; 438 Name : UTF8_String) return Gtk.Text_Mark.Gtk_Text_Mark; 439 -- Returns the mark named Name in buffer Buffer, or null if no such mark 440 -- exists in the buffer. 441 -- "name": a mark name 442 443 function Get_Modified 444 (Buffer : not null access Gtk_Text_Buffer_Record) return Boolean; 445 -- Indicates whether the buffer has been modified since the last call to 446 -- Gtk.Text_Buffer.Set_Modified set the modification flag to False. Used 447 -- for example to enable a "save" function in a text editor. 448 449 procedure Set_Modified 450 (Buffer : not null access Gtk_Text_Buffer_Record; 451 Setting : Boolean); 452 -- Used to keep track of whether the buffer has been modified since the 453 -- last time it was saved. Whenever the buffer is saved to disk, call 454 -- gtk_text_buffer_set_modified (Buffer, FALSE). When the buffer is 455 -- modified, it will automatically toggled on the modified bit again. When 456 -- the modified bit flips, the buffer emits the 457 -- Gtk.Text_Buffer.Gtk_Text_Buffer::modified-changed signal. 458 -- "setting": modification flag setting 459 460 function Get_Paste_Target_List 461 (Buffer : not null access Gtk_Text_Buffer_Record) 462 return Gtk.Target_List.Gtk_Target_List; 463 -- This function returns the list of targets this text buffer supports for 464 -- pasting and as DND destination. The targets in the list are added with 465 -- Info values from the Gtk_Text_Buffer_Target_Info enum, using 466 -- gtk_target_list_add_rich_text_targets and 467 -- Gtk.Target_List.Add_Text_Targets. 468 -- Since: gtk+ 2.10 469 470 function Get_Selection_Bound 471 (Buffer : not null access Gtk_Text_Buffer_Record) 472 return Gtk.Text_Mark.Gtk_Text_Mark; 473 -- Returns the mark that represents the selection bound. Equivalent to 474 -- calling Gtk.Text_Buffer.Get_Mark to get the mark named 475 -- "selection_bound", but very slightly more efficient, and involves less 476 -- typing. 477 -- The currently-selected text in Buffer is the region between the 478 -- "selection_bound" and "insert" marks. If "selection_bound" and "insert" 479 -- are in the same place, then there is no current selection. 480 -- Gtk.Text_Buffer.Get_Selection_Bounds is another convenient function for 481 -- handling the selection, if you just want to know whether there's a 482 -- selection and what its bounds are. 483 484 procedure Get_Selection_Bounds 485 (Buffer : not null access Gtk_Text_Buffer_Record; 486 Start : out Gtk.Text_Iter.Gtk_Text_Iter; 487 The_End : out Gtk.Text_Iter.Gtk_Text_Iter; 488 Result : out Boolean); 489 -- Returns True if some text is selected; places the bounds of the 490 -- selection in Start and End (if the selection has length 0, then Start 491 -- and End are filled in with the same value). Start and End will be in 492 -- ascending order. If Start and End are NULL, then they are not filled in, 493 -- but the return value still indicates whether text is selected. 494 -- "start": iterator to initialize with selection start 495 -- "end": iterator to initialize with selection end 496 497 function Get_Slice 498 (Buffer : not null access Gtk_Text_Buffer_Record; 499 Start : Gtk.Text_Iter.Gtk_Text_Iter; 500 The_End : Gtk.Text_Iter.Gtk_Text_Iter; 501 Include_Hidden_Chars : Boolean := False) return UTF8_String; 502 -- Returns the text in the range [Start,End). Excludes undisplayed text 503 -- (text marked with tags that set the invisibility attribute) if 504 -- Include_Hidden_Chars is False. The returned string includes a 0xFFFC 505 -- character whenever the buffer contains embedded images, so byte and 506 -- character indexes into the returned string do correspond to byte and 507 -- character indexes into the buffer. Contrast with 508 -- Gtk.Text_Buffer.Get_Text. Note that 0xFFFC can occur in normal text as 509 -- well, so it is not a reliable indicator that a pixbuf or widget is in 510 -- the buffer. 511 -- "start": start of a range 512 -- "end": end of a range 513 -- "include_hidden_chars": whether to include invisible text 514 515 procedure Get_Start_Iter 516 (Buffer : not null access Gtk_Text_Buffer_Record; 517 Iter : out Gtk.Text_Iter.Gtk_Text_Iter); 518 -- Initialized Iter with the first position in the text buffer. This is 519 -- the same as using Gtk.Text_Buffer.Get_Iter_At_Offset to get the iter at 520 -- character offset 0. 521 -- "iter": iterator to initialize 522 523 function Get_Tag_Table 524 (Buffer : not null access Gtk_Text_Buffer_Record) 525 return Gtk.Text_Tag_Table.Gtk_Text_Tag_Table; 526 -- Get the Gtk.Text_Tag_Table.Gtk_Text_Tag_Table associated with this 527 -- buffer. 528 529 function Get_Text 530 (Buffer : not null access Gtk_Text_Buffer_Record; 531 Start : Gtk.Text_Iter.Gtk_Text_Iter; 532 The_End : Gtk.Text_Iter.Gtk_Text_Iter; 533 Include_Hidden_Chars : Boolean := False) return UTF8_String; 534 -- Returns the text in the range [Start,End). Excludes undisplayed text 535 -- (text marked with tags that set the invisibility attribute) if 536 -- Include_Hidden_Chars is False. Does not include characters representing 537 -- embedded images, so byte and character indexes into the returned string 538 -- do not correspond to byte and character indexes into the buffer. 539 -- Contrast with Gtk.Text_Buffer.Get_Slice. 540 -- "start": start of a range 541 -- "end": end of a range 542 -- "include_hidden_chars": whether to include invisible text 543 544 procedure Set_Text 545 (Buffer : not null access Gtk_Text_Buffer_Record; 546 Text : UTF8_String); 547 -- Deletes current contents of Buffer, and inserts Text instead. If Len is 548 -- -1, Text must be nul-terminated. Text must be valid UTF-8. 549 -- "text": UTF-8 text to insert 550 551 procedure Insert_At_Cursor 552 (Buffer : not null access Gtk_Text_Buffer_Record; 553 Text : UTF8_String); 554 -- Simply calls Gtk.Text_Buffer.Insert, using the current cursor position 555 -- as the insertion point. 556 -- "text": text in UTF-8 format 557 558 procedure Insert_Child_Anchor 559 (Buffer : not null access Gtk_Text_Buffer_Record; 560 Iter : Gtk.Text_Iter.Gtk_Text_Iter; 561 Anchor : not null access Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor_Record'Class); 562 -- Inserts a child widget anchor into the text buffer at Iter. The anchor 563 -- will be counted as one character in character counts, and when obtaining 564 -- the buffer contents as a string, will be represented by the Unicode 565 -- "object replacement character" 0xFFFC. Note that the "slice" variants 566 -- for obtaining portions of the buffer as a string include this character 567 -- for child anchors, but the "text" variants do not. E.g. see 568 -- Gtk.Text_Buffer.Get_Slice and Gtk.Text_Buffer.Get_Text. Consider 569 -- Gtk.Text_Buffer.Create_Child_Anchor as a more convenient alternative to 570 -- this function. The buffer will add a reference to the anchor, so you can 571 -- unref it after insertion. 572 -- "iter": location to insert the anchor 573 -- "anchor": a Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor 574 575 function Insert_Interactive 576 (Buffer : not null access Gtk_Text_Buffer_Record; 577 Iter : access Gtk.Text_Iter.Gtk_Text_Iter; 578 Text : UTF8_String; 579 Default_Editable : Boolean) return Boolean; 580 -- Like Gtk.Text_Buffer.Insert, but the insertion will not occur if Iter 581 -- is at a non-editable location in the buffer. Usually you want to prevent 582 -- insertions at ineditable locations if the insertion results from a user 583 -- action (is interactive). 584 -- Default_Editable indicates the editability of text that doesn't have a 585 -- tag affecting editability applied to it. Typically the result of 586 -- Gtk.Text_View.Get_Editable is appropriate here. 587 -- "iter": a position in Buffer 588 -- "text": some UTF-8 text 589 -- "default_editable": default editability of buffer 590 591 function Insert_Interactive_At_Cursor 592 (Buffer : not null access Gtk_Text_Buffer_Record; 593 Text : UTF8_String; 594 Default_Editable : Boolean) return Boolean; 595 -- Calls Gtk.Text_Buffer.Insert_Interactive at the cursor position. 596 -- Default_Editable indicates the editability of text that doesn't have a 597 -- tag affecting editability applied to it. Typically the result of 598 -- Gtk.Text_View.Get_Editable is appropriate here. 599 -- "text": text in UTF-8 format 600 -- "default_editable": default editability of buffer 601 602 procedure Insert_Pixbuf 603 (Buffer : not null access Gtk_Text_Buffer_Record; 604 Iter : Gtk.Text_Iter.Gtk_Text_Iter; 605 Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 606 -- Inserts an image into the text buffer at Iter. The image will be 607 -- counted as one character in character counts, and when obtaining the 608 -- buffer contents as a string, will be represented by the Unicode "object 609 -- replacement character" 0xFFFC. Note that the "slice" variants for 610 -- obtaining portions of the buffer as a string include this character for 611 -- pixbufs, but the "text" variants do not. e.g. see 612 -- Gtk.Text_Buffer.Get_Slice and Gtk.Text_Buffer.Get_Text. 613 -- "iter": location to insert the pixbuf 614 -- "pixbuf": a Gdk.Pixbuf.Gdk_Pixbuf 615 616 procedure Insert_Range 617 (Buffer : not null access Gtk_Text_Buffer_Record; 618 Iter : Gtk.Text_Iter.Gtk_Text_Iter; 619 Start : Gtk.Text_Iter.Gtk_Text_Iter; 620 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 621 -- Copies text, tags, and pixbufs between Start and End (the order of 622 -- Start and End doesn't matter) and inserts the copy at Iter. Used instead 623 -- of simply getting/inserting text because it preserves images and tags. 624 -- If Start and End are in a different buffer from Buffer, the two buffers 625 -- must share the same tag table. 626 -- Implemented via emissions of the insert_text and apply_tag signals, so 627 -- expect those. 628 -- "iter": a position in Buffer 629 -- "start": a position in a Gtk.Text_Buffer.Gtk_Text_Buffer 630 -- "end": another position in the same buffer as Start 631 632 function Insert_Range_Interactive 633 (Buffer : not null access Gtk_Text_Buffer_Record; 634 Iter : Gtk.Text_Iter.Gtk_Text_Iter; 635 Start : Gtk.Text_Iter.Gtk_Text_Iter; 636 The_End : Gtk.Text_Iter.Gtk_Text_Iter; 637 Default_Editable : Boolean) return Boolean; 638 -- Same as Gtk.Text_Buffer.Insert_Range, but does nothing if the insertion 639 -- point isn't editable. The Default_Editable parameter indicates whether 640 -- the text is editable at Iter if no tags enclosing Iter affect 641 -- editability. Typically the result of Gtk.Text_View.Get_Editable is 642 -- appropriate here. 643 -- "iter": a position in Buffer 644 -- "start": a position in a Gtk.Text_Buffer.Gtk_Text_Buffer 645 -- "end": another position in the same buffer as Start 646 -- "default_editable": default editability of the buffer 647 648 procedure Move_Mark 649 (Buffer : not null access Gtk_Text_Buffer_Record; 650 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class; 651 Where : Gtk.Text_Iter.Gtk_Text_Iter); 652 -- Moves Mark to the new location Where. Emits the 653 -- Gtk.Text_Buffer.Gtk_Text_Buffer::mark-set signal as notification of the 654 -- move. 655 -- "mark": a Gtk.Text_Mark.Gtk_Text_Mark 656 -- "where": new location for Mark in Buffer 657 658 procedure Move_Mark_By_Name 659 (Buffer : not null access Gtk_Text_Buffer_Record; 660 Name : UTF8_String; 661 Where : Gtk.Text_Iter.Gtk_Text_Iter); 662 -- Moves the mark named Name (which must exist) to location Where. See 663 -- Gtk.Text_Buffer.Move_Mark for details. 664 -- "name": name of a mark 665 -- "where": new location for mark 666 667 procedure Paste_Clipboard 668 (Buffer : not null access Gtk_Text_Buffer_Record; 669 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class; 670 Default_Editable : Boolean := True); 671 -- Pastes the contents of a clipboard. If Override_Location is null, the 672 -- pasted text will be inserted at the cursor position, or the buffer 673 -- selection will be replaced if the selection is non-empty. 674 -- Note: pasting is asynchronous, that is, we'll ask for the paste data 675 -- and return, and at some point later after the main loop runs, the paste 676 -- data will be inserted. 677 -- "clipboard": the Gtk.Clipboard.Gtk_Clipboard to paste from 678 -- "default_editable": whether the buffer is editable by default 679 680 procedure Place_Cursor 681 (Buffer : not null access Gtk_Text_Buffer_Record; 682 Where : Gtk.Text_Iter.Gtk_Text_Iter); 683 -- This function moves the "insert" and "selection_bound" marks 684 -- simultaneously. If you move them to the same place in two steps with 685 -- Gtk.Text_Buffer.Move_Mark, you will temporarily select a region in 686 -- between their old and new locations, which can be pretty inefficient 687 -- since the temporarily-selected region will force stuff to be 688 -- recalculated. This function moves them as a unit, which can be 689 -- optimized. 690 -- "where": where to put the cursor 691 692 function Register_Deserialize_Tagset 693 (Buffer : not null access Gtk_Text_Buffer_Record; 694 Tagset_Name : UTF8_String := "") return Gdk.Types.Gdk_Atom; 695 -- This function registers GTK+'s internal rich text serialization format 696 -- with the passed Buffer. See Gtk.Text_Buffer.Register_Serialize_Tagset 697 -- for details. 698 -- Since: gtk+ 2.10 699 -- "tagset_name": an optional tagset name, on null 700 701 function Register_Serialize_Tagset 702 (Buffer : not null access Gtk_Text_Buffer_Record; 703 Tagset_Name : UTF8_String := "") return Gdk.Types.Gdk_Atom; 704 -- This function registers GTK+'s internal rich text serialization format 705 -- with the passed Buffer. The internal format does not comply to any 706 -- standard rich text format and only works between 707 -- Gtk.Text_Buffer.Gtk_Text_Buffer instances. It is capable of serializing 708 -- all of a text buffer's tags and embedded pixbufs. 709 -- This function is just a wrapper around 710 -- gtk_text_buffer_register_serialize_format. The mime type used for 711 -- registering is "application/x-gtk-text-buffer-rich-text", or 712 -- "application/x-gtk-text-buffer-rich-text;format=Tagset_Name" if a 713 -- Tagset_Name was passed. 714 -- The Tagset_Name can be used to restrict the transfer of rich text to 715 -- buffers with compatible sets of tags, in order to avoid unknown tags 716 -- from being pasted. It is probably the common case to pass an identifier 717 -- != null here, since the null tagset requires the receiving buffer to 718 -- deal with with pasting of arbitrary tags. 719 -- Since: gtk+ 2.10 720 -- "tagset_name": an optional tagset name, on null 721 722 procedure Remove_All_Tags 723 (Buffer : not null access Gtk_Text_Buffer_Record; 724 Start : Gtk.Text_Iter.Gtk_Text_Iter; 725 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 726 -- Removes all tags in the range between Start and End. Be careful with 727 -- this function; it could remove tags added in code unrelated to the code 728 -- you're currently writing. That is, using this function is probably a bad 729 -- idea if you have two or more unrelated code sections that add tags. 730 -- "start": one bound of range to be untagged 731 -- "end": other bound of range to be untagged 732 733 procedure Remove_Selection_Clipboard 734 (Buffer : not null access Gtk_Text_Buffer_Record; 735 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class); 736 -- Removes a Gtk.Clipboard.Gtk_Clipboard added with 737 -- Gtk.Text_Buffer.Add_Selection_Clipboard. 738 -- "clipboard": a Gtk.Clipboard.Gtk_Clipboard added to Buffer by 739 -- Gtk.Text_Buffer.Add_Selection_Clipboard 740 741 procedure Remove_Tag 742 (Buffer : not null access Gtk_Text_Buffer_Record; 743 Tag : not null access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; 744 Start : Gtk.Text_Iter.Gtk_Text_Iter; 745 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 746 -- Emits the "remove-tag" signal. The default handler for the signal 747 -- removes all occurrences of Tag from the given range. Start and End don't 748 -- have to be in order. 749 -- "tag": a Gtk.Text_Tag.Gtk_Text_Tag 750 -- "start": one bound of range to be untagged 751 -- "end": other bound of range to be untagged 752 753 procedure Remove_Tag_By_Name 754 (Buffer : not null access Gtk_Text_Buffer_Record; 755 Name : UTF8_String; 756 Start : Gtk.Text_Iter.Gtk_Text_Iter; 757 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 758 -- Calls Gtk.Text_Tag_Table.Lookup on the buffer's tag table to get a 759 -- Gtk.Text_Tag.Gtk_Text_Tag, then calls Gtk.Text_Buffer.Remove_Tag. 760 -- "name": name of a Gtk.Text_Tag.Gtk_Text_Tag 761 -- "start": one bound of range to be untagged 762 -- "end": other bound of range to be untagged 763 764 procedure Select_Range 765 (Buffer : not null access Gtk_Text_Buffer_Record; 766 Ins : Gtk.Text_Iter.Gtk_Text_Iter; 767 Bound : Gtk.Text_Iter.Gtk_Text_Iter); 768 -- This function moves the "insert" and "selection_bound" marks 769 -- simultaneously. If you move them in two steps with 770 -- Gtk.Text_Buffer.Move_Mark, you will temporarily select a region in 771 -- between their old and new locations, which can be pretty inefficient 772 -- since the temporarily-selected region will force stuff to be 773 -- recalculated. This function moves them as a unit, which can be 774 -- optimized. 775 -- Since: gtk+ 2.4 776 -- "ins": where to put the "insert" mark 777 -- "bound": where to put the "selection_bound" mark 778 779 procedure Unregister_Deserialize_Format 780 (Buffer : not null access Gtk_Text_Buffer_Record; 781 Format : Gdk.Types.Gdk_Atom); 782 -- This function unregisters a rich text format that was previously 783 -- registered using gtk_text_buffer_register_deserialize_format or 784 -- Gtk.Text_Buffer.Register_Deserialize_Tagset. 785 -- Since: gtk+ 2.10 786 -- "format": a Gdk.Types.Gdk_Atom representing a registered rich text 787 -- format. 788 789 procedure Unregister_Serialize_Format 790 (Buffer : not null access Gtk_Text_Buffer_Record; 791 Format : Gdk.Types.Gdk_Atom); 792 -- This function unregisters a rich text format that was previously 793 -- registered using gtk_text_buffer_register_serialize_format or 794 -- Gtk.Text_Buffer.Register_Serialize_Tagset 795 -- Since: gtk+ 2.10 796 -- "format": a Gdk.Types.Gdk_Atom representing a registered rich text 797 -- format. 798 799 ---------------------- 800 -- GtkAda additions -- 801 ---------------------- 802 803 procedure Insert 804 (Buffer : access Gtk_Text_Buffer_Record; 805 Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; 806 Text : Gtkada.Types.Chars_Ptr); 807 -- More efficient version of Insert, which doesn't require a string copy. 808 809 procedure Insert_At_Cursor 810 (Buffer : access Gtk_Text_Buffer_Record; 811 Text : Gtkada.Types.Chars_Ptr; 812 Len : Gint := -1); 813 -- Call Buffer_Insert, using the current cursor position 814 -- as the insertion point. 815 -- Text: UTF-8 format C string to insert. 816 817 function Get_Text 818 (Buffer : access Gtk_Text_Buffer_Record; 819 Start : Gtk.Text_Iter.Gtk_Text_Iter; 820 The_End : Gtk.Text_Iter.Gtk_Text_Iter; 821 Include_Hidden_Chars : Boolean := False) return Gtkada.Types.Chars_Ptr; 822 -- Same as Get_Text above, but return a pointer to a C string, for 823 -- efficiency. 824 -- The caller is responsible for freeing (using Gtkada.Types.g_free) the 825 -- returned pointer. 826 827 function Selection_Exists 828 (Buffer : access Gtk_Text_Buffer_Record) return Boolean; 829 -- Return True if some text in the buffer is currently selected. 830 831 procedure Insert_With_Tags 832 (Buffer : access Gtk_Text_Buffer_Record; 833 Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; 834 Text : UTF8_String; 835 Tag : Gtk_Text_Tag); 836 procedure Insert_With_Tags 837 (Buffer : access Gtk_Text_Buffer_Record; 838 Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; 839 Text : Gtkada.Types.Chars_Ptr; 840 Tag : Gtk.Text_Tag.Gtk_Text_Tag); 841 -- Same as Insert, but specifies the tag to apply to the range. 842 843 function Get_Buffer 844 (Iter : Gtk_Text_Iter) return Gtk.Text_Buffer.Gtk_Text_Buffer; 845 -- Returns the Gtk.Text_Buffer.Gtk_Text_Buffer this iterator is associated 846 -- with. 847 848 function Get_Buffer 849 (Mark : Gtk_Text_Mark) 850 return Gtk.Text_Buffer.Gtk_Text_Buffer; 851 -- Gets the buffer this mark is located inside, or null if the mark is 852 -- deleted. 853 854 function Create_Tag 855 (Buffer : access Gtk_Text_Buffer_Record; 856 Tag_Name : String := "") 857 return Gtk.Text_Tag.Gtk_Text_Tag; 858 -- Creates a tag and adds it to the tag table for Buffer. Equivalent to 859 -- calling gtk.text_tag.gtk_new and then adding the tag to the buffer's tag 860 -- table. The returned tag is owned by the buffer's tag table, so the ref 861 -- count will be equal to one. 862 -- 863 -- If Tag_Name is NULL, the tag is anonymous, otherwise a tag called 864 -- Tag_Name must not already exist in the tag table for this buffer. 865 866 ---------------- 867 -- Properties -- 868 ---------------- 869 -- The following properties are defined for this widget. See 870 -- Glib.Properties for more information on properties) 871 872 Copy_Target_List_Property : constant Glib.Properties.Property_Object; 873 -- Type: Gtk.Target_List.Gtk_Target_List 874 -- The list of targets this buffer supports for clipboard copying and as 875 -- DND source. 876 877 Cursor_Position_Property : constant Glib.Properties.Property_Int; 878 -- The position of the insert mark (as offset from the beginning of the 879 -- buffer). It is useful for getting notified when the cursor moves. 880 881 Has_Selection_Property : constant Glib.Properties.Property_Boolean; 882 -- Whether the buffer has some text currently selected. 883 884 Paste_Target_List_Property : constant Glib.Properties.Property_Object; 885 -- Type: Gtk.Target_List.Gtk_Target_List 886 -- The list of targets this buffer supports for clipboard pasting and as 887 -- DND destination. 888 889 Tag_Table_Property : constant Glib.Properties.Property_Object; 890 -- Type: Gtk.Text_Tag_Table.Gtk_Text_Tag_Table 891 892 Text_Property : constant Glib.Properties.Property_String; 893 -- The text content of the buffer. Without child widgets and images, see 894 -- Gtk.Text_Buffer.Get_Text for more information. 895 896 ------------- 897 -- Signals -- 898 ------------- 899 900 type Cb_Gtk_Text_Buffer_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void is not null access procedure 901 (Self : access Gtk_Text_Buffer_Record'Class; 902 Tag : not null access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; 903 Start : Gtk.Text_Iter.Gtk_Text_Iter; 904 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 905 906 type Cb_GObject_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void is not null access procedure 907 (Self : access Glib.Object.GObject_Record'Class; 908 Tag : not null access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class; 909 Start : Gtk.Text_Iter.Gtk_Text_Iter; 910 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 911 912 Signal_Apply_Tag : constant Glib.Signal_Name := "apply-tag"; 913 procedure On_Apply_Tag 914 (Self : not null access Gtk_Text_Buffer_Record; 915 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void; 916 After : Boolean := False); 917 procedure On_Apply_Tag 918 (Self : not null access Gtk_Text_Buffer_Record; 919 Call : Cb_GObject_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void; 920 Slot : not null access Glib.Object.GObject_Record'Class; 921 After : Boolean := False); 922 -- The ::apply-tag signal is emitted to apply a tag to a range of text in 923 -- a Gtk.Text_Buffer.Gtk_Text_Buffer. Applying actually occurs in the 924 -- default handler. 925 -- 926 -- Note that if your handler runs before the default handler it must not 927 -- invalidate the Start and End iters (or has to revalidate them). 928 -- 929 -- See also: Gtk.Text_Buffer.Apply_Tag, gtk_text_buffer_insert_with_tags, 930 -- Gtk.Text_Buffer.Insert_Range. 931 -- 932 -- Callback parameters: 933 -- -- "tag": the applied tag 934 -- -- "start": the start of the range the tag is applied to 935 -- -- "end": the end of the range the tag is applied to 936 937 type Cb_Gtk_Text_Buffer_Void is not null access procedure 938 (Self : access Gtk_Text_Buffer_Record'Class); 939 940 type Cb_GObject_Void is not null access procedure 941 (Self : access Glib.Object.GObject_Record'Class); 942 943 Signal_Begin_User_Action : constant Glib.Signal_Name := "begin-user-action"; 944 procedure On_Begin_User_Action 945 (Self : not null access Gtk_Text_Buffer_Record; 946 Call : Cb_Gtk_Text_Buffer_Void; 947 After : Boolean := False); 948 procedure On_Begin_User_Action 949 (Self : not null access Gtk_Text_Buffer_Record; 950 Call : Cb_GObject_Void; 951 Slot : not null access Glib.Object.GObject_Record'Class; 952 After : Boolean := False); 953 -- The ::begin-user-action signal is emitted at the beginning of a single 954 -- user-visible operation on a Gtk.Text_Buffer.Gtk_Text_Buffer. 955 -- 956 -- See also: Gtk.Text_Buffer.Begin_User_Action, 957 -- Gtk.Text_Buffer.Insert_Interactive, 958 -- Gtk.Text_Buffer.Insert_Range_Interactive, 959 -- Gtk.Text_Buffer.Delete_Interactive, Gtk.Text_Buffer.Backspace, 960 -- Gtk.Text_Buffer.Delete_Selection. 961 962 Signal_Changed : constant Glib.Signal_Name := "changed"; 963 procedure On_Changed 964 (Self : not null access Gtk_Text_Buffer_Record; 965 Call : Cb_Gtk_Text_Buffer_Void; 966 After : Boolean := False); 967 procedure On_Changed 968 (Self : not null access Gtk_Text_Buffer_Record; 969 Call : Cb_GObject_Void; 970 Slot : not null access Glib.Object.GObject_Record'Class; 971 After : Boolean := False); 972 -- The ::changed signal is emitted when the content of a 973 -- Gtk.Text_Buffer.Gtk_Text_Buffer has changed. 974 975 type Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Iter_Void is not null access procedure 976 (Self : access Gtk_Text_Buffer_Record'Class; 977 Start : Gtk.Text_Iter.Gtk_Text_Iter; 978 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 979 980 type Cb_GObject_Gtk_Text_Iter_Gtk_Text_Iter_Void is not null access procedure 981 (Self : access Glib.Object.GObject_Record'Class; 982 Start : Gtk.Text_Iter.Gtk_Text_Iter; 983 The_End : Gtk.Text_Iter.Gtk_Text_Iter); 984 985 Signal_Delete_Range : constant Glib.Signal_Name := "delete-range"; 986 procedure On_Delete_Range 987 (Self : not null access Gtk_Text_Buffer_Record; 988 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Iter_Void; 989 After : Boolean := False); 990 procedure On_Delete_Range 991 (Self : not null access Gtk_Text_Buffer_Record; 992 Call : Cb_GObject_Gtk_Text_Iter_Gtk_Text_Iter_Void; 993 Slot : not null access Glib.Object.GObject_Record'Class; 994 After : Boolean := False); 995 -- The ::delete-range signal is emitted to delete a range from a 996 -- Gtk.Text_Buffer.Gtk_Text_Buffer. 997 -- 998 -- Note that if your handler runs before the default handler it must not 999 -- invalidate the Start and End iters (or has to revalidate them). The 1000 -- default signal handler revalidates the Start and End iters to both point 1001 -- to the location where text was deleted. Handlers which run after the 1002 -- default handler (see g_signal_connect_after) do not have access to the 1003 -- deleted text. 1004 -- 1005 -- See also: Gtk.Text_Buffer.Delete. 1006 -- 1007 -- Callback parameters: 1008 -- -- "start": the start of the range to be deleted 1009 -- -- "end": the end of the range to be deleted 1010 1011 Signal_End_User_Action : constant Glib.Signal_Name := "end-user-action"; 1012 procedure On_End_User_Action 1013 (Self : not null access Gtk_Text_Buffer_Record; 1014 Call : Cb_Gtk_Text_Buffer_Void; 1015 After : Boolean := False); 1016 procedure On_End_User_Action 1017 (Self : not null access Gtk_Text_Buffer_Record; 1018 Call : Cb_GObject_Void; 1019 Slot : not null access Glib.Object.GObject_Record'Class; 1020 After : Boolean := False); 1021 -- The ::end-user-action signal is emitted at the end of a single 1022 -- user-visible operation on the Gtk.Text_Buffer.Gtk_Text_Buffer. 1023 -- 1024 -- See also: Gtk.Text_Buffer.End_User_Action, 1025 -- Gtk.Text_Buffer.Insert_Interactive, 1026 -- Gtk.Text_Buffer.Insert_Range_Interactive, 1027 -- Gtk.Text_Buffer.Delete_Interactive, Gtk.Text_Buffer.Backspace, 1028 -- Gtk.Text_Buffer.Delete_Selection, Gtk.Text_Buffer.Backspace. 1029 1030 type Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Child_Anchor_Void is not null access procedure 1031 (Self : access Gtk_Text_Buffer_Record'Class; 1032 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1033 Anchor : not null access Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor_Record'Class); 1034 1035 type Cb_GObject_Gtk_Text_Iter_Gtk_Text_Child_Anchor_Void is not null access procedure 1036 (Self : access Glib.Object.GObject_Record'Class; 1037 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1038 Anchor : not null access Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor_Record'Class); 1039 1040 Signal_Insert_Child_Anchor : constant Glib.Signal_Name := "insert-child-anchor"; 1041 procedure On_Insert_Child_Anchor 1042 (Self : not null access Gtk_Text_Buffer_Record; 1043 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Child_Anchor_Void; 1044 After : Boolean := False); 1045 procedure On_Insert_Child_Anchor 1046 (Self : not null access Gtk_Text_Buffer_Record; 1047 Call : Cb_GObject_Gtk_Text_Iter_Gtk_Text_Child_Anchor_Void; 1048 Slot : not null access Glib.Object.GObject_Record'Class; 1049 After : Boolean := False); 1050 -- The ::insert-child-anchor signal is emitted to insert a 1051 -- Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor in a 1052 -- Gtk.Text_Buffer.Gtk_Text_Buffer. Insertion actually occurs in the 1053 -- default handler. 1054 -- 1055 -- Note that if your handler runs before the default handler it must not 1056 -- invalidate the Location iter (or has to revalidate it). The default 1057 -- signal handler revalidates it to be placed after the inserted Anchor. 1058 -- 1059 -- See also: Gtk.Text_Buffer.Insert_Child_Anchor. 1060 -- 1061 -- Callback parameters: 1062 -- -- "location": position to insert Anchor in Textbuffer 1063 -- -- "anchor": the Gtk.Text_Child_Anchor.Gtk_Text_Child_Anchor to be 1064 -- -- inserted 1065 1066 type Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gdk_Pixbuf_Void is not null access procedure 1067 (Self : access Gtk_Text_Buffer_Record'Class; 1068 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1069 Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 1070 1071 type Cb_GObject_Gtk_Text_Iter_Gdk_Pixbuf_Void is not null access procedure 1072 (Self : access Glib.Object.GObject_Record'Class; 1073 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1074 Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 1075 1076 Signal_Insert_Pixbuf : constant Glib.Signal_Name := "insert-pixbuf"; 1077 procedure On_Insert_Pixbuf 1078 (Self : not null access Gtk_Text_Buffer_Record; 1079 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gdk_Pixbuf_Void; 1080 After : Boolean := False); 1081 procedure On_Insert_Pixbuf 1082 (Self : not null access Gtk_Text_Buffer_Record; 1083 Call : Cb_GObject_Gtk_Text_Iter_Gdk_Pixbuf_Void; 1084 Slot : not null access Glib.Object.GObject_Record'Class; 1085 After : Boolean := False); 1086 -- The ::insert-pixbuf signal is emitted to insert a Gdk.Pixbuf.Gdk_Pixbuf 1087 -- in a Gtk.Text_Buffer.Gtk_Text_Buffer. Insertion actually occurs in the 1088 -- default handler. 1089 -- 1090 -- Note that if your handler runs before the default handler it must not 1091 -- invalidate the Location iter (or has to revalidate it). The default 1092 -- signal handler revalidates it to be placed after the inserted Pixbuf. 1093 -- 1094 -- See also: Gtk.Text_Buffer.Insert_Pixbuf. 1095 -- 1096 -- Callback parameters: 1097 -- -- "location": position to insert Pixbuf in Textbuffer 1098 -- -- "pixbuf": the Gdk.Pixbuf.Gdk_Pixbuf to be inserted 1099 1100 type Cb_Gtk_Text_Buffer_Gtk_Text_Iter_UTF8_String_Gint_Void is not null access procedure 1101 (Self : access Gtk_Text_Buffer_Record'Class; 1102 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1103 Text : UTF8_String; 1104 Len : Gint); 1105 1106 type Cb_GObject_Gtk_Text_Iter_UTF8_String_Gint_Void is not null access procedure 1107 (Self : access Glib.Object.GObject_Record'Class; 1108 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1109 Text : UTF8_String; 1110 Len : Gint); 1111 1112 Signal_Insert_Text : constant Glib.Signal_Name := "insert-text"; 1113 procedure On_Insert_Text 1114 (Self : not null access Gtk_Text_Buffer_Record; 1115 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Iter_UTF8_String_Gint_Void; 1116 After : Boolean := False); 1117 procedure On_Insert_Text 1118 (Self : not null access Gtk_Text_Buffer_Record; 1119 Call : Cb_GObject_Gtk_Text_Iter_UTF8_String_Gint_Void; 1120 Slot : not null access Glib.Object.GObject_Record'Class; 1121 After : Boolean := False); 1122 -- The ::insert-text signal is emitted to insert text in a 1123 -- Gtk.Text_Buffer.Gtk_Text_Buffer. Insertion actually occurs in the 1124 -- default handler. 1125 -- 1126 -- Note that if your handler runs before the default handler it must not 1127 -- invalidate the Location iter (or has to revalidate it). The default 1128 -- signal handler revalidates it to point to the end of the inserted text. 1129 -- 1130 -- See also: Gtk.Text_Buffer.Insert, Gtk.Text_Buffer.Insert_Range. 1131 -- 1132 -- Callback parameters: 1133 -- -- "location": position to insert Text in Textbuffer 1134 -- -- "text": the UTF-8 text to be inserted 1135 -- -- "len": length of the inserted text in bytes 1136 1137 type Cb_Gtk_Text_Buffer_Gtk_Text_Mark_Void is not null access procedure 1138 (Self : access Gtk_Text_Buffer_Record'Class; 1139 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 1140 1141 type Cb_GObject_Gtk_Text_Mark_Void is not null access procedure 1142 (Self : access Glib.Object.GObject_Record'Class; 1143 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 1144 1145 Signal_Mark_Deleted : constant Glib.Signal_Name := "mark-deleted"; 1146 procedure On_Mark_Deleted 1147 (Self : not null access Gtk_Text_Buffer_Record; 1148 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Mark_Void; 1149 After : Boolean := False); 1150 procedure On_Mark_Deleted 1151 (Self : not null access Gtk_Text_Buffer_Record; 1152 Call : Cb_GObject_Gtk_Text_Mark_Void; 1153 Slot : not null access Glib.Object.GObject_Record'Class; 1154 After : Boolean := False); 1155 -- The ::mark-deleted signal is emitted as notification after a 1156 -- Gtk.Text_Mark.Gtk_Text_Mark is deleted. 1157 -- 1158 -- See also: Gtk.Text_Buffer.Delete_Mark. 1159 1160 type Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Mark_Void is not null access procedure 1161 (Self : access Gtk_Text_Buffer_Record'Class; 1162 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1163 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 1164 1165 type Cb_GObject_Gtk_Text_Iter_Gtk_Text_Mark_Void is not null access procedure 1166 (Self : access Glib.Object.GObject_Record'Class; 1167 Location : Gtk.Text_Iter.Gtk_Text_Iter; 1168 Mark : not null access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); 1169 1170 Signal_Mark_Set : constant Glib.Signal_Name := "mark-set"; 1171 procedure On_Mark_Set 1172 (Self : not null access Gtk_Text_Buffer_Record; 1173 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Iter_Gtk_Text_Mark_Void; 1174 After : Boolean := False); 1175 procedure On_Mark_Set 1176 (Self : not null access Gtk_Text_Buffer_Record; 1177 Call : Cb_GObject_Gtk_Text_Iter_Gtk_Text_Mark_Void; 1178 Slot : not null access Glib.Object.GObject_Record'Class; 1179 After : Boolean := False); 1180 -- The ::mark-set signal is emitted as notification after a 1181 -- Gtk.Text_Mark.Gtk_Text_Mark is set. 1182 -- 1183 -- See also: Gtk.Text_Buffer.Create_Mark, Gtk.Text_Buffer.Move_Mark. 1184 -- 1185 -- Callback parameters: 1186 -- -- "location": The location of Mark in Textbuffer 1187 -- -- "mark": The mark that is set 1188 1189 Signal_Modified_Changed : constant Glib.Signal_Name := "modified-changed"; 1190 procedure On_Modified_Changed 1191 (Self : not null access Gtk_Text_Buffer_Record; 1192 Call : Cb_Gtk_Text_Buffer_Void; 1193 After : Boolean := False); 1194 procedure On_Modified_Changed 1195 (Self : not null access Gtk_Text_Buffer_Record; 1196 Call : Cb_GObject_Void; 1197 Slot : not null access Glib.Object.GObject_Record'Class; 1198 After : Boolean := False); 1199 -- The ::modified-changed signal is emitted when the modified bit of a 1200 -- Gtk.Text_Buffer.Gtk_Text_Buffer flips. 1201 -- 1202 -- See also: Gtk.Text_Buffer.Set_Modified. 1203 1204 type Cb_Gtk_Text_Buffer_Gtk_Clipboard_Void is not null access procedure 1205 (Self : access Gtk_Text_Buffer_Record'Class; 1206 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class); 1207 1208 type Cb_GObject_Gtk_Clipboard_Void is not null access procedure 1209 (Self : access Glib.Object.GObject_Record'Class; 1210 Clipboard : not null access Gtk.Clipboard.Gtk_Clipboard_Record'Class); 1211 1212 Signal_Paste_Done : constant Glib.Signal_Name := "paste-done"; 1213 procedure On_Paste_Done 1214 (Self : not null access Gtk_Text_Buffer_Record; 1215 Call : Cb_Gtk_Text_Buffer_Gtk_Clipboard_Void; 1216 After : Boolean := False); 1217 procedure On_Paste_Done 1218 (Self : not null access Gtk_Text_Buffer_Record; 1219 Call : Cb_GObject_Gtk_Clipboard_Void; 1220 Slot : not null access Glib.Object.GObject_Record'Class; 1221 After : Boolean := False); 1222 -- The paste-done signal is emitted after paste operation has been 1223 -- completed. This is useful to properly scroll the view to the end of the 1224 -- pasted text. See Gtk.Text_Buffer.Paste_Clipboard for more details. 1225 1226 Signal_Remove_Tag : constant Glib.Signal_Name := "remove-tag"; 1227 procedure On_Remove_Tag 1228 (Self : not null access Gtk_Text_Buffer_Record; 1229 Call : Cb_Gtk_Text_Buffer_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void; 1230 After : Boolean := False); 1231 procedure On_Remove_Tag 1232 (Self : not null access Gtk_Text_Buffer_Record; 1233 Call : Cb_GObject_Gtk_Text_Tag_Gtk_Text_Iter_Gtk_Text_Iter_Void; 1234 Slot : not null access Glib.Object.GObject_Record'Class; 1235 After : Boolean := False); 1236 -- The ::remove-tag signal is emitted to remove all occurrences of Tag 1237 -- from a range of text in a Gtk.Text_Buffer.Gtk_Text_Buffer. Removal 1238 -- actually occurs in the default handler. 1239 -- 1240 -- Note that if your handler runs before the default handler it must not 1241 -- invalidate the Start and End iters (or has to revalidate them). 1242 -- 1243 -- See also: Gtk.Text_Buffer.Remove_Tag. 1244 -- 1245 -- Callback parameters: 1246 -- -- "tag": the tag to be removed 1247 -- -- "start": the start of the range the tag is removed from 1248 -- -- "end": the end of the range the tag is removed from 1249 1250private 1251 Text_Property : constant Glib.Properties.Property_String := 1252 Glib.Properties.Build ("text"); 1253 Tag_Table_Property : constant Glib.Properties.Property_Object := 1254 Glib.Properties.Build ("tag-table"); 1255 Paste_Target_List_Property : constant Glib.Properties.Property_Object := 1256 Glib.Properties.Build ("paste-target-list"); 1257 Has_Selection_Property : constant Glib.Properties.Property_Boolean := 1258 Glib.Properties.Build ("has-selection"); 1259 Cursor_Position_Property : constant Glib.Properties.Property_Int := 1260 Glib.Properties.Build ("cursor-position"); 1261 Copy_Target_List_Property : constant Glib.Properties.Property_Object := 1262 Glib.Properties.Build ("copy-target-list"); 1263end Gtk.Text_Buffer; 1264