/src/wrappers/gtk/library/gtk_text_buffer.e
Specman e | 1308 lines | 569 code | 189 blank | 550 comment | 6 complexity | a0b19406b7d755e12c87847e01c18eaa MD5 | raw file
1indexing 2 description: "Formatted text buffer; GtkTextBuffer stores attributed text for display in a GtkTextView " 3 copyright: "[ 4 Copyright (C) 2006 eiffel-libraries team, GTK+ team 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License 8 as published by the Free Software Foundation; either version 2.1 of 9 the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301 USA 20 ]" 21 date: "$Date:$" 22 revision: "$Revision:$" 23 24class GTK_TEXT_BUFFER 25 -- A text buffer. 26 27 -- Conceptual Overview: 28 29 -- GTK+ has an extremely powerful framework for multiline text 30 -- editing. The primary objects involved in the process are 31 -- GTK_TEXT_BUFFER, which represents the text being edited, and 32 -- GTK_TEXT_VIEW, a widget which can display a 33 -- GTK_TEXT_BUFFER. Each buffer can be displayed by any number of 34 -- views. 35 36 -- One of the important things to remember about text in GTK+ is 37 -- that it's in the UTF-8 encoding. This means that one character 38 -- can be encoded as multiple bytes. Character counts are usually 39 -- referred to as offsets, while byte counts are called indexes. If 40 -- you confuse these two, things will work fine with ASCII, but as 41 -- soon as your buffer contains multibyte characters, bad things 42 -- will happen. 43 44 -- Text in a buffer can be marked with tags. A tag is an attribute 45 -- that can be applied to some range of text. For example, a tag 46 -- might be called "bold" and make the text inside the tag 47 -- bold. However, the tag concept is more general than that; tags 48 -- don't have to affect appearance. They can instead affect the 49 -- behavior of mouse and key presses, "lock" a range of text so the 50 -- user can't edit it, or countless other things. A tag is 51 -- represented by a GtkTextTag object. One GtkTextTag can be 52 -- applied to any number of text ranges in any number of buffers. 53 54 -- Each tag is stored in a GTK_TEXT_TAG_TABLE. A tag table defines 55 -- a set of tags that can be used together. Each buffer has one tag 56 -- table associated with it; only tags from that tag table can be 57 -- used with the buffer. A single tag table can be shared between 58 -- multiple buffers, however. 59 60 -- Tags can have names, which is convenient sometimes (for example, 61 -- you can name your tag that makes things bold "bold"), but they 62 -- can also be anonymous (which is convenient if you're creating 63 -- tags on-the-fly). 64 65 -- TODO: the following paragraph uncover details that the Eiffel 66 -- wrapper library should actuall hide from the end-user of the 67 -- library. Make sure that GTK_TEXT_ITER behaviour mimicks it 68 -- efficiently. Paolo 2008-04-06 69 70 -- Most text manipulation is accomplished with iterators, 71 -- represented by a GTK_TEXT_ITER. An iterator represents a position 72 -- between two characters in the text buffer. GTK_TEXT_ITER is a 73 -- struct designed to be allocated on the stack; it's guaranteed to 74 -- be copiable by value and never contain any heap-allocated 75 -- data. Iterators are not valid indefinitely; whenever the buffer 76 -- is modified in a way that affects the number of characters in 77 -- the buffer, all outstanding iterators become invalid. (Note that 78 -- deleting 5 characters and then reinserting 5 still invalidates 79 -- iterators, though you end up with the same number of characters 80 -- you pass through a state with a different number). 81 82 -- Because of this, iterators can't be used to preserve positions 83 -- across buffer modifications. To preserve a position, the 84 -- GTK_TEXT_MARK object is ideal. You can think of a mark as an 85 -- invisible cursor or insertion point; it floats in the buffer, 86 -- saving a position. If the text surrounding the mark is deleted, 87 -- the mark remains in the position the text once occupied; if text 88 -- is inserted at the mark, the mark ends up either to the left or 89 -- to the right of the new text, depending on its gravity. The 90 -- standard text cursor in left-to-right languages is a mark with 91 -- right gravity, because it stays to the right of inserted text. 92 93 -- Like tags, marks can be either named or anonymous. There are two 94 -- marks built-in to GTK_TEXT_BUFFER; these are named "insert" and 95 -- "selection_bound" and refer to the insertion point and the 96 -- boundary of the selection which is not the insertion point, 97 -- respectively. If no text is selected, these two marks will be in 98 -- the same position. You can manipulate what is selected and where 99 -- the cursor appears by moving these marks around. 100 101 -- Text buffers always contain at least one line, but may be empty 102 -- (that is, buffers can contain zero characters). The last line in 103 -- the text buffer never ends in a line separator (such as 104 -- newline); the other lines in the buffer always end in a line 105 -- separator. Line separators count as characters when computing 106 -- character counts and character offsets. Note that some Unicode 107 -- line separators are represented with multiple bytes in UTF-8, 108 -- and the two-character sequence "\r\n" is also considered a line 109 -- separator. 110 111inherit G_OBJECT 112 113insert 114 GTK 115 GTK_TEXT_BUFFER_EXTERNALS 116 G_SIGNALS 117 118creation 119 make, from_external_pointer, with_tag_table 120 121feature {} -- Creation 122 123 make is 124 -- Creates a new text buffer. 125 require 126 gtk_initialized: gtk.is_initialized 127 do 128 from_external_pointer (gtk_text_buffer_new (default_pointer)) 129 -- TODO: Support GTK_TEXT_TAG_TABLEs. For now, creating a 130 -- new one every time. 131 end 132 133 with_tag_table (a_tag_table: GTK_TEXT_TAG_TABLE) is 134 require 135 gtk_initialized: gtk.is_initialized 136 non_void_table: a_tag_table/=Void 137 do 138 from_external_pointer (gtk_text_buffer_new(a_tag_table.handle)) 139 end 140 141feature -- Operations 142 143 set_text(a_text: STRING) is 144 -- Deletes current contents of buffer, and inserts `a_text' 145 -- instead. `a_text' must be valid UTF-8. 146 -- `a_text': UTF-8 text to insert 147 require 148 text_not_void: a_text /= Void 149 text_is_utf8: -- TODO: a_text should be valid UTF-8! 150 do 151 gtk_text_buffer_set_text(handle, a_text.to_external, a_text.count) 152 end 153 154feature -- Access 155 156 text (a_start, an_end: GTK_TEXT_ITER; include_hidden_chars: BOOLEAN): STRING is 157 -- the text in the range [`a_start',`an_end'). Excludes 158 -- undisplayed text (text marked with tags that set the 159 -- invisibility attribute) if `include_hidden_chars' is 160 -- False. Does not include characters representing embedded 161 -- images, so byte and character indexes into the returned 162 -- string do not correspond to byte and character indexes 163 -- into the buffer. Contrast with `slice' 164 -- `a_start' : start of a range 165 -- `an_end' : end of a range 166 -- include_hidden_chars : whether to include invisible text 167 --obsolete "Result's type will be changed to UTF8_STRING when this class will be available" 168 require 169 start_not_void: a_start /= Void 170 end_not_void: an_end /= Void 171 start_in_current_buffer: a_start.buffer = Current 172 end_in_current_buffer: an_end.buffer = Current 173 local 174 p: POINTER 175 do 176 p := gtk_text_buffer_get_text (handle, a_start.handle, an_end.handle, include_hidden_chars.to_integer) 177 check not p.is_null end 178 create Result.from_external (p) 179 ensure 180 not_void: Result /= Void 181 end 182 183 line_count: INTEGER is 184 -- the number of lines in the buffer. This value is cached, 185 -- so the function is very fast. 186 do 187 Result:=gtk_text_buffer_get_line_count (handle) 188 end 189 190 char_count: INTEGER is 191 -- the number of characters in the buffer; note that 192 -- characters and bytes are not the same, you can't 193 -- e.g. expect the contents of the buffer in string form to 194 -- be this many bytes long. The character count is cached, so 195 -- this function is very fast. 196 do 197 Result := gtk_text_buffer_get_char_count (handle) 198 end 199 200 tag_table: GTK_TEXT_TAG_TABLE is 201 -- the GtkTextTagTable associated with this buffer. 202 local factory: G_OBJECT_EXPANDED_FACTORY [GTK_TEXT_TAG_TABLE] 203 do 204 if hidden_tag_table = Void then 205 hidden_tag_table := factory.wrapper (gtk_text_buffer_get_tag_table (handle)) 206 end 207 Result := hidden_tag_table 208 end 209 210 insert_at (an_iter: GTK_TEXT_ITER; some_text: STRING) is 211 -- Inserts `a_length' bytes of text at `an_iter' position. Emits the 212 -- "insert_text" signal; insertion actually occurs in the default 213 -- handler for the signal. iter is invalidated when insertion occurs 214 -- (because the buffer contents change), but the default signal handler 215 -- revalidates it to point to the end of the inserted text. 216 217 -- Note: C API has also a lenght argument, put at -1 for 218 -- nul-terminated that will be inserted entirely. 219 require 220 valid_iter: an_iter /= Void 221 some_text: some_text /= Void 222 -- valid_length: a_length >= -1 223 do 224 gtk_text_buffer_insert (handle, an_iter.handle, some_text.to_external, -1) 225 end 226 227 insert_at_cursor (some_text: STRING; a_length: INTEGER) is 228 -- calls `insert_at', using the current cursor position as the 229 -- insertion point. 230 do 231 gtk_text_buffer_insert_at_cursor (handle, some_text.to_external, a_length) 232 end 233 234 is_successful: BOOLEAN 235 -- Have the last operation been successful? Typically updated 236 -- by insertion commands 237 238 insert_interactive (an_iter: GTK_TEXT_ITER; a_text: STRING; 239 a_length: INTEGER; default_editable: BOOLEAN) is 240 -- Like `insert_at', but the insertion will not occur if 241 -- `an_iter' is at a non-editable location in the 242 -- buffer. Usually you want to prevent insertions at 243 -- ineditable locations if the insertion results from a user 244 -- action (is interactive). 245 246 -- `default_editable' indicates the editability of text that 247 -- doesn't have a tag affecting editability applied to 248 -- it. Typically the result of GTK_TEXT_VIEW's `is_editable' 249 -- is appropriate here. 250 251 -- `an_iter': a position in buffer 252 -- `a_text': some UTF-8 text 253 -- `a_length': length of text in bytes, or -1 254 -- `default_editable': default editability of buffer 255 -- `is_successful' is set to True whether text was actually inserted 256 do 257 is_successful := (gtk_text_buffer_insert_interactive 258 (handle, an_iter.handle, 259 a_text.to_external, a_length, 260 default_editable.to_integer)).to_boolean 261 end 262 263 insert_interactive_at_cursor (a_text: STRING; a_length: INTEGER; default_editable: BOOLEAN) is 264 -- Calls `insert_interactive' at the cursor position. 265 266 -- `default_editable' indicates the editability of text that 267 -- doesn't have a tag affecting editability applied to 268 -- it. Typically the result of GTK_TEXT_VIEW's `is_editable' 269 -- is appropriate here. 270 271 -- `a_text': text in UTF-8 format 272 273 -- `a_length': length of text in bytes, or -1 274 275 -- `default_editable': default editability of buffer 276 277 -- `is_successful' is updated (i.e. True whether text was 278 -- actually inserted, false otherwise). 279 do 280 is_successful:=(gtk_text_buffer_insert_interactive_at_cursor 281 (handle, a_text.to_external, a_length, 282 default_editable.to_integer)).to_boolean 283 end 284 285 insert_range (an_iter, a_start, an_end: GTK_TEXT_ITER) is 286 -- Copies text, tags, and pixbufs between `a_start' and 287 -- `an_end' (the order of start and end doesn't matter) and 288 -- inserts the copy at `an_iter'. Used instead of simply 289 -- getting/inserting text because it preserves images and 290 -- tags. If start and end are in a different buffer from 291 -- buffer, the two buffers must share the same tag table. 292 293 -- Implemented via emissions of the `insert_text' and 294 -- `apply_tag' signals, so expect those. 295 296 -- `a_start' and `an_end' are positions in the same 297 -- GtkTextBuffer 298 299 -- `is_successful' *not* is updated. Use `insert_range_interactive' 300 -- if you need that. 301 require 302 iter_not_void: an_iter /= Void 303 start_not_void: a_start /= Void 304 end_not_void: an_end /= Void 305 start_and_end_in_the_same_buffer: a_start.buffer = an_end.buffer 306 do 307 gtk_text_buffer_insert_range (handle, an_iter.handle, 308 a_start.handle, an_end.handle) 309 end 310 311 insert_range_interactive (an_iter, a_start, an_end: GTK_TEXT_ITER; 312 default_editable: BOOLEAN) is 313 -- Same as `insert_range', but does nothing if the insertion 314 -- point isn't editable. The `default_editable' parameter 315 -- indicates whether the text is editable at iter if no tags 316 -- enclosing `an_iter' affect editability. Typically the result of 317 -- GTK_TEXT_VIEW's `is_editable' is appropriate here. 318 319 -- `is_successful' is updated (i.e. True whether text was 320 -- actually inserted, false otherwise). 321 require 322 iter_not_void: an_iter /= Void 323 start_not_void: a_start /= Void 324 end_not_void: an_end /= Void 325 start_and_end_in_the_same_buffer: a_start.buffer = an_end.buffer 326 do 327 is_successful := (gtk_text_buffer_insert_range_interactive 328 (handle, an_iter.handle, 329 a_start.handle, an_end.handle, 330 default_editable.to_integer)).to_boolean 331 end 332 333 insert_with_tags (an_iter: GTK_TEXT_ITER; some_text: STRING; 334 some_tags: COLLECTION[GTK_TEXT_TAG]) is 335 -- Inserts `some_text' into buffer at `an_iter', applying the 336 -- list of tags to the newly-inserted text. Equivalent to 337 -- calling `insert_at', then `apply_tag' on the inserted 338 -- text; this is just a convenience feature. 339 340 -- `an_iter': an iterator in buffer 341 -- `some_text': UTF-8 text 342 -- `some_tags' : collection of tags to apply to text 343 require 344 iter_not_void: an_iter /= Void 345 text_not_void: some_text /= Void 346 tags_not_void: some_tags /= Void 347 local 348 tags: ITERATOR[GTK_TEXT_TAG]; 349 a_start_offset: INTEGER 350 a_start_iter: GTK_TEXT_ITER 351 do 352 -- Note: this code is a more or less direct traduction from C 353 -- to Eiffel of the "internal" GTK implementation. 354 a_start_offset := an_iter.offset 355 356 insert_at (an_iter, some_text) 357 -- Now an_iter points to the end of the inserted text 358 a_start_iter := iter_at_offset (a_start_offset) 359 tags := some_tags.get_new_iterator 360 from tags.start until tags.is_off 361 loop 362 apply_tag (tags.item, a_start_iter, an_iter) 363 tags.next 364 end 365 end 366 367 insert_with_tags_by_name (an_iter: GTK_TEXT_ITER; some_text: STRING; 368 some_tag_names: COLLECTION[STRING]) is 369 -- Inserts `some_text' into buffer at `an_iter', applying the 370 -- list of tags to the newly-inserted text. Same as 371 -- `insert_with_tags', but allows you to pass in tag names 372 -- instead of tag objects. 373 374 -- `an_iter': an iterator in buffer 375 -- `some_text': UTF-8 text 376 -- `some_tags_name' : collection of names of tags to apply to text 377 require 378 iter_not_void: an_iter /= Void 379 text_not_void: some_text /= Void 380 tag_names_not_void: some_tag_names /= Void 381 local 382 tag_names: ITERATOR[STRING]; tag: GTK_TEXT_TAG 383 a_start_offset: INTEGER 384 a_start_iter: GTK_TEXT_ITER 385 do 386 -- Note: this code is a more or less direct traduction from C 387 -- to Eiffel of the "internal" GTK implementation. 388 a_start_offset := an_iter.offset 389 390 insert_at (an_iter, some_text) 391 -- Now an_iter points to the end of the inserted text 392 a_start_iter := iter_at_offset (a_start_offset) 393 tag_names := some_tag_names.get_new_iterator 394 from tag_names.start until tag_names.is_off 395 loop 396 tag := tag_table.lookup (tag_names.item) 397 check tag_not_void: tag /= Void end 398 apply_tag (tag, a_start_iter, an_iter) 399 tag_names.next 400 end 401 end 402 403 delete (a_start, an_end: GTK_TEXT_ITER) is 404 -- Deletes text between `a_start' and `an_end'. The order of 405 -- start and end is not actually relevant; `delete' will 406 -- reorder them. This function actually emits the 407 -- "delete_range" signal, and the default handler of that 408 -- signal deletes the text. Because the buffer is modified, 409 -- all outstanding iterators become invalid after calling 410 -- this function; however, the start and end will be 411 -- re-initialized to point to the location where text was 412 -- deleted. 413 require 414 start_not_void: a_start /= Void 415 end_not_void: an_end /= Void 416 start_in_current_buffer: a_start.buffer = Current 417 end_in_current_buffer: an_end.buffer = Current 418 do 419 gtk_text_buffer_delete(handle, a_start.handle, an_end.handle) 420 ensure 421 ordered_iterators: a_start <= an_end 422 ordering_could_have_changed_iterators: (((old a_start) >= (old an_end)) implies 423 (a_start.is_equal(old an_end) and 424 (an_end.is_equal(old a_start)))) 425 end 426 427 delete_interactive (a_start, an_end: GTK_TEXT_ITER; 428 default_editable: BOOLEAN) is 429 -- Deletes all editable text in the given range. Calls 430 -- `buffer_delete' for each editable sub-range of [`a_start', 431 -- `an_end'). `a_start' and `an_end' are revalidated to point to the 432 -- location of the last deleted range, or left untouched if 433 -- no text was deleted. 434 435 -- `a_start': start of range to delete 436 437 -- `an_end': end of range 438 439 -- `default_editable': whether the buffer is editable by default 440 441 -- `is_successful' is set to True whether some text was 442 -- actually deleted, False otherwise. 443 do 444 is_successful:=(gtk_text_buffer_delete_interactive 445 (handle, a_start.handle, an_end.handle, 446 default_editable.to_integer)).to_boolean 447 end 448 449 backspace (an_iter: GTK_TEXT_ITER; interactive, default_editable: BOOLEAN) is 450 -- Performs the appropriate action as if the user hit the 451 -- delete key with the cursor at the position specified by 452 -- iter. In the normal case a single character will be 453 -- deleted, but when combining accents are involved, more 454 -- than one character can be deleted, and when precomposed 455 -- character and accent combinations are involved, less than 456 -- one character will be deleted. 457 458 -- Because the buffer is modified, all outstanding iterators 459 -- become invalid after calling this function; however, the 460 -- iter will be re-initialized to point to the location where 461 -- text was deleted. 462 463 -- `an_iter': a position in buffer 464 465 -- `interactive': whether the deletion is caused by user 466 -- interaction 467 468 -- `default_editable': whether the buffer is editable by 469 -- default 470 471 -- `is_successful' is set to True if the buffer was modified, 472 -- False otherwise. 473 require 474 iter_not_void: an_iter /= Void 475 iter_in_current_buffer: an_iter.buffer = Current 476 do 477 is_successful:=(gtk_text_buffer_backspace 478 (handle, an_iter.handle, 479 interactive.to_integer, 480 default_editable.to_integer)).to_boolean 481 end 482 483 slice (a_start, an_end: GTK_TEXT_ITER; 484 include_hidden_chars: BOOLEAN): STRING is 485 -- the text in the range [`a_start,' `an_end'). Excludes 486 -- undisplayed text (text marked with tags that set the 487 -- invisibility attribute) if `include_hidden_chars' is 488 -- FALSE. The string includes a 0xFFFC character whenever the 489 -- buffer contains embedded images, so byte and character 490 -- indexes into Result do correspond to byte and character 491 -- indexes into the buffer. Contrast with `text'. Note that 492 -- 0xFFFC can occur in normal text as well, so it is not a 493 -- reliable indicator that a pixbuf or widget is in the 494 -- buffer. 495 496 -- `a_start' : start of a range 497 498 -- `an_end' : end of a range 499 500 -- include_hidden_chars : whether to include invisible text 501 obsolete "Result will be changed to UTF8_STRING when this class will be available" 502 require 503 start_not_void: a_start /= Void 504 end_not_void: an_end /= Void 505 start_in_current_buffer: a_start.buffer = Current 506 end_in_current_buffer: an_end.buffer = Current 507 do 508 create Result.from_external 509 (gtk_text_buffer_get_slice (handle, 510 a_start.handle, an_end.handle, 511 include_hidden_chars.to_integer)) 512 end 513 514 insert_pixbuf (an_iter: GTK_TEXT_ITER; an_image: GDK_PIXBUF) is 515 -- Inserts `an_image' into the text buffer at `an_iter'. The 516 -- image will be counted as one character in character 517 -- counts, and when obtaining the buffer contents as a 518 -- string, will be represented by the Unicode "object 519 -- replacement character" 0xFFFC. Note that the "slice" 520 -- variants for obtaining portions of the buffer as a string 521 -- include this character for pixbufs, but the "text" 522 -- variants do not. e.g. see `slice' and `text'. 523 524 -- `an_iter' : location to insert the pixbuf 525 require 526 iter_not_void: an_iter /= Void 527 image_not_void: an_image /= Void 528 iter_in_current_buffer: an_iter.buffer = Current 529 do 530 gtk_text_buffer_insert_pixbuf (handle, an_iter.handle, an_image.handle) 531 end 532 533 insert_child_anchor (an_iter: GTK_TEXT_ITER; an_anchor: GTK_TEXT_CHILD_ANCHOR) is 534 -- Inserts a child widget anchor (`an_anchor') into the text 535 -- buffer at `an_iter'. The anchor will be counted as one 536 -- character in character counts, and when obtaining the 537 -- buffer contents as a string, will be represented by the 538 -- Unicode "object replacement character" 0xFFFC. Note that 539 -- the `slice' feature- used to obtain portions of the buffer 540 -- as a string - include this character for child anchors, 541 -- but the `text' feature do not. Consider 542 -- `create_child_anchor' as a more convenient alternative to 543 -- this function. The buffer will add a reference to the 544 -- anchor, so you can `unref' it after insertion. 545 546 -- `an_iter' : location to insert the anchor 547 require 548 iter_not_void: an_iter /= Void 549 anchor_not_void: an_anchor /= Void 550 iter_in_current_buffer: an_iter.buffer = Current 551 do 552 gtk_text_buffer_insert_child_anchor(handle, an_iter.handle, an_anchor.handle) 553 end 554 555 child_anchor_at (an_iter: GTK_TEXT_ITER): GTK_TEXT_CHILD_ANCHOR is 556 -- A newly created child anchor, inserted into the buffer at `an_iter'. 557 require 558 iter_not_void: an_iter /= Void 559 iter_in_current_buffer: an_iter.buffer = Current 560 do 561 create Result.from_external_pointer (gtk_text_buffer_create_child_anchor (handle, an_iter.handle)) 562 -- Note: C documentation says "The new anchor is owned by the 563 -- buffer; no reference count is returned to the caller of 564 -- gtk_text_buffer_create_child_anchor()"; so we have to 565 Result.unref 566 -- because the from_external_pointer ref-ed it. 567 end 568 569 create_mark (a_mark_name: STRING; a_place: GTK_TEXT_ITER; left_gravity: BOOLEAN): GTK_TEXT_MARK is 570 -- Creates a mark at `a_place'. If mark_name is NULL, the 571 -- mark is anonymous; otherwise, the mark can be retrieved by 572 -- name using `mark'. If a mark has left gravity, and text is 573 -- inserted at the mark's current location, the mark will be 574 -- moved to the left of the newly-inserted text. If the mark 575 -- has right gravity (`left_gravity' = False), the mark will 576 -- end up on the right of newly-inserted text. The standard 577 -- left-to-right cursor is a mark with right gravity (when 578 -- you type, the cursor stays on the right side of the text 579 -- you're typing). 580 581 -- Emits the "mark_set" signal as notification of the mark's 582 -- initial placement. 583 require 584 name_not_void: a_mark_name /= Void 585 iter_not_void: a_place /= Void 586 iter_in_current_buffer: a_place.buffer = Current 587 do 588 create Result.from_external_pointer 589 (gtk_text_buffer_create_mark (handle, a_mark_name.to_external, 590 a_place.handle, left_gravity.to_integer)) 591 -- The caller of this function does not own a reference to 592 -- the returned GtkTextMark, so you can ignore the return 593 -- value if you like. Marks are owned by the buffer and go 594 -- away when the buffer does. 595 end 596 597 move_mark (a_mark: GTK_TEXT_MARK; a_new_location: GTK_TEXT_ITER) is 598 -- Moves `a_mark' to `a_new_location'. Emits the "mark_set" 599 -- signal as notification of the move. 600 require 601 mark_not_void: a_mark /= Void 602 iter_not_void: a_new_location /= Void 603 iter_in_current_buffer: a_new_location.buffer = Current 604 do 605 gtk_text_buffer_move_mark (handle, a_mark.handle, a_new_location.handle) 606 end 607 608 move_mark_by_name (a_name: STRING; a_new_location: GTK_TEXT_ITER) is 609 -- Moves the mark named `a_name' (which must exist) to 610 -- `a_new_location' where. See `move_mark' for details. 611 require 612 name_not_void: a_name /= Void 613 named_mark_exists: mark (a_name) /= Void 614 -- Note: the above precondition is not a monster of 615 -- efficiency... it could have been made faster 616 do 617 gtk_text_buffer_move_mark_by_name (handle, a_name.to_external, a_new_location.handle) 618 end 619 620 delete_mark (a_mark: GTK_TEXT_MARK) is 621 -- Deletes `a_mark,' so that it's no longer located anywhere 622 -- in the buffer. Removes the reference the buffer holds to 623 -- the mark, so if you haven't called g_object_ref() on the 624 -- mark, it will be freed. Even if the mark isn't freed, most 625 -- operations on mark become invalid. There is no way to 626 -- undelete a mark. 627 628 -- The "mark_deleted" signal will be emitted as notification 629 -- after the mark is deleted. 630 require mark_not_void: a_mark /= Void 631 do 632 gtk_text_buffer_delete_mark (handle, a_mark.handle) 633 ensure mark_deleted: a_mark.is_deleted 634 end 635 636 delete_mark_by_name (a_name: STRING) is 637 -- Deletes the mark named `a_name'; the mark must exist. See 638 -- `delete_mark' for details. 639 require 640 name_not_void: a_name /= Void 641 named_mark_exists: mark (a_name) /= Void 642 do 643 gtk_text_buffer_delete_mark_by_name (handle, a_name.to_external) 644 end 645 646 mark (a_name: STRING): GTK_TEXT_MARK is 647 -- the mark named `a_name' in Current buffer, or Void if no 648 -- such mark exists in the buffer. 649 require 650 name_not_void: a_name /= Void 651 do 652 create Result.from_external_pointer (gtk_text_buffer_get_mark (handle, a_name.to_external)) 653 -- Note: text mark are not cached because AFAIK once 654 -- invalidated they can't be re-used and must be freed. Paolo 655 -- 2007-01-05 656 end 657 658 insert_mark: GTK_TEXT_MARK is 659 -- the mark that represents the cursor (insertion 660 -- point). Equivalent to calling `mark(once "insert")' but very 661 -- slightly more efficient, and involves less typing. 662 local 663 mark_ptr: POINTER 664 mark_factory: G_OBJECT_EXPANDED_FACTORY [GTK_TEXT_MARK] 665 do 666 Result := mark_factory.wrapper (gtk_text_buffer_get_insert(handle)) 667 end 668 669 selection_bound: GTK_TEXT_MARK is 670 -- the mark that represents the selection bound. Equivalent 671 -- to calling `mark(once "selection_bound")', but very slightly 672 -- more efficient, and involves less typing. 673 674 -- The currently-selected text in buffer is the region 675 -- between the "selection_bound" and "insert" marks. If 676 -- "selection_bound" and "insert" are in the same place, then 677 -- there is no current selection. `selection_bounds' is 678 -- another convenient function for handling the selection, if 679 -- you just want to know whether there's a selection and what 680 -- its bounds are. 681 do 682 create Result.from_external_pointer(gtk_text_buffer_get_selection_bound(handle)) 683 -- Note: text mark are not cached because AFAIK once 684 -- invalidated they can't be re-used and must be freed. Paolo 685 -- 2007-01-05 686 end 687 688 place_cursor (where: GTK_TEXT_ITER) is 689 -- Moves the "insert" and "selection_bound" marks 690 -- simultaneously. If you move them to the same place in two 691 -- steps with `move_mark', you will temporarily select a 692 -- region in between their old and new locations, which can 693 -- be pretty inefficient since the temporarily-selected 694 -- region will force stuff to be recalculated. This function 695 -- moves them as a unit, which can be optimized. 696 require 697 where_not_void: where /= Void 698 where_in_current_buffer: where.buffer = Current 699 do 700 gtk_text_buffer_place_cursor(handle, where.handle) 701 ensure 702 insert_mark_moved: iter_at_mark(insert_mark).is_equal(where) 703 selection_bound_moved: iter_at_mark(selection_bound).is_equal(where) 704 selection_bound_equal_insert: selection_bound.is_equal(insert_mark) 705 end 706 707 select_range (an_insert_mark, a_bound: GTK_TEXT_ITER) is 708 -- moves the "insert" and "selection_bound" marks 709 -- simultaneously. If you move them in two steps with 710 -- `move_mark'), you will temporarily select a region in 711 -- between their old and new locations, which can be pretty 712 -- inefficient since the temporarily-selected region will 713 -- force stuff to be recalculated. This function moves them 714 -- as a unit, which can be optimized. 715 716 -- `an_insert_mark': where to put the "insert" mark 717 718 -- `a_bound': where to put the "selection_bound" mark 719 do 720 gtk_text_buffer_select_range (handle, an_insert_mark.handle, a_bound.handle) 721 end 722 723 apply_tag (a_tag: GTK_TEXT_TAG; a_start, an_end: GTK_TEXT_ITER) is 724 -- Emits the "apply_tag" signal on buffer. The default 725 -- handler for the signal applies tag to the given 726 -- range. start and end do not have to be in order. 727 728 -- `a_tag' : a GtkTextTag 729 -- `a_start' : one bound of range to be tagged 730 -- `an_end' : other bound of range to be tagged 731 require 732 tag_not_void: a_tag /= Void 733 start_not_void: a_start /= Void 734 end_not_void: an_end /= Void 735 do 736 gtk_text_buffer_apply_tag (handle, a_tag.handle, a_start.handle, an_end.handle) 737 end 738 739 remove_tag (a_tag: GTK_TEXT_TAG; a_start, an_end: GTK_TEXT_ITER) is 740 -- Emits the "remove_tag" signal. The default handler for the 741 -- signal removes all occurrences of tag from the given 742 -- range. start and end don't have to be in order. 743 744 -- `a_tag' : a GtkTextTag 745 -- `a_start' : one bound of range to be tagged 746 -- `an_end' : other bound of range to be tagged 747 require 748 tag_not_void: a_tag /= Void 749 start_not_void: a_start /= Void 750 end_not_void: an_end /= Void 751 do 752 gtk_text_buffer_remove_tag (handle, a_tag.handle, 753 a_start.handle, an_end.handle) 754 end 755 756 apply_tag_by_name (a_tag_name: STRING; a_start, an_end: GTK_TEXT_ITER) is 757 -- Calls ` gtk_text_tag_table_lookup' on the buffer's tag 758 -- table to get a GtkTextTag, then calls `apply_tag'. 759 760 -- `a_tag_name' : the name of a tag 761 -- `a_start' : one bound of range to be tagged 762 -- `an_end' : other bound of range to be tagged 763 require 764 tag_name_not_void: a_tag_name /= Void 765 start_not_void: a_start /= Void 766 end_not_void: an_end /= Void 767 do 768 gtk_text_buffer_apply_tag_by_name (handle, 769 a_tag_name.to_external, 770 a_start.handle, an_end.handle) 771 end 772 773 remove_tag_by_name (a_tag_name: STRING; a_start, an_end: GTK_TEXT_ITER) is 774 -- Calls `gtk_text_tag_table_lookup' on the buffer's tag 775 -- table to get a GtkTextTag, then calls `remove_tag'. 776 777 -- `a_tag_name' : the name of a tag 778 -- `a_start' : one bound of range to be tagged 779 -- `an_end' : other bound of range to be tagged 780 require 781 tag_name_not_void: a_tag_name /= Void 782 start_not_void: a_start /= Void 783 end_not_void: an_end /= Void 784 do 785 gtk_text_buffer_remove_tag_by_name (handle, 786 a_tag_name.to_external, 787 a_start.handle, an_end.handle) 788 end 789 790 remove_all_tags (a_start, an_end: GTK_TEXT_ITER) is 791 -- Removes all tags in the range between `a_start' and 792 -- `an_end'. Be careful with this function; it could remove 793 -- tags added in code unrelated to the code you're currently 794 -- writing. That is, using this function is probably a bad 795 -- idea if you have two or more unrelated code sections that 796 -- add tags. 797 798 -- `a_start' : one bound of range to be tagged 799 -- `an_end' : other bound of range to be tagged 800 require 801 start_not_void: a_start /= Void 802 end_not_void: an_end /= Void 803 do 804 gtk_text_buffer_remove_all_tags (handle, a_start.handle,an_end.handle) 805 end 806 807 create_tag (a_tag_name: STRING; some_properties: COLLECTION[TUPLE[STRING,G_VALUE]]): GTK_TEXT_TAG is 808 -- Creates a tag and adds it to the tag table for 809 -- buffer. Equivalent to calling `GTK_TEXT_TAG.make' and then 810 -- adding the tag to the buffer's tag table. The tag is owned 811 -- by the buffer's tag table, so the ref count will be equal 812 -- to one. 813 814 -- If a_tag_name is Void, the tag is anonymous. 815 816 -- If tag_name is non-Void, a tag called tag_name must not 817 -- already exist in the tag table for this buffer. 818 819 -- The first_property_name argument and subsequent arguments 820 -- are a list of properties to set on the tag, as with 821 -- G_OBJECT's `set'. 822 823 -- `a_tag_name': name of the new tag, or Void 824 local 825 iterator: ITERATOR[TUPLE[STRING,G_VALUE]] 826 a_name: STRING 827 a_value: G_VALUE 828 do 829 if a_tag_name /= Void then 830 create Result.with_name (a_tag_name) 831 else 832 create Result.make 833 end 834 835 tag_table.add (Result) 836 iterator := some_properties.get_new_iterator 837 from 838 iterator.start 839 until 840 iterator.is_off 841 loop 842 a_name := iterator.item.item_1 843 a_value := iterator.item.item_2 844 check 845 name_not_void: a_name /= Void 846 value_not_void: a_value /= Void 847 end 848 Result.set_property (a_name, a_value) 849 iterator.next 850 end 851 end 852 853 iter_at_line_offset (a_line_number, a_char_offset: INTEGER): GTK_TEXT_ITER is 854 -- an iterator pointing to `a_char_offset' (offset from start 855 -- of line) within `a_line_number' (counting from 0). The 856 -- `a_char_offset' must exist, offsets off the end of the 857 -- line are not allowed. Note characters, not bytes; UTF-8 858 -- may encode one character as multiple bytes. 859 do 860 create Result.make 861 gtk_text_buffer_get_iter_at_line_offset (handle, Result.handle, 862 a_line_number, a_char_offset) 863 end 864 865 iter_at_offset (an_offset: INTEGER): GTK_TEXT_ITER is 866 -- The iterator pointing to a position `an_offset' chars from 867 -- the start of the entire buffer. If `an_offset' is -1 or 868 -- greater than the number of characters in the buffer, iter 869 -- is initialized to the end iterator, the iterator one past 870 -- the last valid character in the buffer. 871 872 -- `an_offset': char offset from start of buffer, counting 873 -- from 0, or -1 874 do 875 create Result.make 876 gtk_text_buffer_get_iter_at_offset (handle, Result.handle, an_offset) 877 end 878 879 iter_at_line (a_line_number: INTEGER): GTK_TEXT_ITER is 880 -- an iterator to the start of the given line (counting from 881 -- 0). 882 do 883 create Result.make 884 gtk_text_buffer_get_iter_at_line(handle, Result.handle, a_line_number) 885 end 886 887 iter_at_line_index (a_line_number, a_byte_index: INTEGER): GTK_TEXT_ITER is 888 -- Obtains an iterator pointing to `a_byte_index' within the 889 -- `a_line_number' (counting from 0). `a_byte_index' must be 890 -- the start of a UTF-8 character, and must not be beyond the 891 -- end of the line. Note bytes, not characters; UTF-8 may 892 -- encode one character as multiple bytes. 893 894 -- buffer : a GtkTextBuffer 895 -- iter : iterator to initialize 896 897 -- byte_index : byte index from start of line 898 do 899 create Result.make 900 gtk_text_buffer_get_iter_at_line_index (handle, Result.handle, 901 a_line_number, a_byte_index) 902 ensure not_void: Result /= Void 903 end 904 905 iter_at_mark (a_mark: GTK_TEXT_MARK): GTK_TEXT_ITER is 906 -- A newly allocated iterator with the current position of `a_mark'. 907 require mark_not_void: a_mark /= Void 908 do 909 create Result.make 910 gtk_text_buffer_get_iter_at_mark(handle, Result.handle, a_mark.handle) 911 ensure not_void: Result /= Void 912 end 913 914 iter_at_child_anchor (an_anchor: GTK_TEXT_CHILD_ANCHOR): GTK_TEXT_ITER is 915 -- the location of anchor within buffer. 916 require anchor_not_void: an_anchor /= Void 917 do 918 create Result.make 919 gtk_text_buffer_get_iter_at_child_anchor(handle,Result.handle, an_anchor.handle) 920 ensure not_void: Result /= Void 921 end 922 923 start_iter: GTK_TEXT_ITER is 924 -- A newly created iterator with the first position in the 925 -- text buffer. This is the same as using 926 -- `get_iter_at_offset' to get the iter at character offset 927 -- 0. 928 do 929 --create Result.make 930 Result := iter_at_offset (0) 931 gtk_text_buffer_get_start_iter(handle, Result.handle) 932 ensure not_void: Result /= Void 933 end 934 935 end_iter: GTK_TEXT_ITER is 936 -- A newly created iterator with the "end iterator," one past 937 -- the last valid character in the text buffer. If 938 -- dereferenced with `char', the end iterator has a 939 -- character value of 0. The entire buffer lies in the range 940 -- from the first position in the buffer (call 941 -- gtk_text_buffer_get_start_iter() to get character position 942 -- 0) to the end iterator. 943 do 944 create Result.make 945 gtk_text_buffer_get_end_iter (handle, Result.handle) 946 ensure 947 not_void: Result /= Void 948 is_off: Result.is_off 949 end 950 951 bounds: TUPLE[GTK_TEXT_ITER, GTK_TEXT_ITER] is 952 -- the first and last iterators in the buffer; the entire buffer lies within the range. 953 local a_start, an_end: GTK_TEXT_ITER 954 do 955 create a_start.make; create an_end.make 956 gtk_text_buffer_get_bounds(handle, a_start.handle, an_end.handle) 957 create Result.make_2(a_start, an_end) 958 end 959 960 is_modified: BOOLEAN is 961 -- Has the buffer been modified after the last call to 962 -- `set_modified' set it to False. Used for example to enable 963 -- a "save" function in a text editor. 964 do 965 Result := gtk_text_buffer_get_modified(handle).to_boolean 966 end 967 968 set_modified (a_setting: BOOLEAN) is 969 -- Used to keep track of whether the buffer has been modified 970 -- since the last time it was saved. Whenever the buffer is 971 -- saved to disk, call `set_modified(False)'. When the buffer 972 -- is modified, it will automatically toggled on the modified 973 -- bit again. When the modified bit flips, the buffer emits a 974 -- "modified_changed" signal. 975 do 976 gtk_text_buffer_set_modified (handle, a_setting.to_integer) 977 end 978 979 delete_selection (interactive, default_editable: BOOLEAN) is 980 -- Deletes the range between the "insert" and 981 -- "selection_bound" marks, that is, the currently-selected 982 -- text. If `interactive' is True, the editability of the 983 -- selection will be considered (users can't delete 984 -- uneditable text). 985 986 -- `interactive': whether the deletion is caused by user 987 -- interaction 988 989 -- `default_editable': whether the buffer is editable by 990 -- default 991 992 -- `is_successful' will be True if there was a non-empty 993 -- selection to delete. 994 do 995 is_successful:=(gtk_text_buffer_delete_selection(handle, 996 interactive.to_integer, 997 default_editable.to_integer).to_boolean) 998 end 999 1000 paste_clipboard (a_clipboard: GTK_CLIPBOARD; an_override_location: GTK_TEXT_ITER; default_editable: BOOLEAN) is 1001 -- Pastes the contents of `a_clipboard' at the insertion 1002 -- point, or at `override_location' (if it is not 1003 -- Void). (Note: pasting is asynchronous, that is, we'll ask 1004 -- for the paste data and return, and at some point later 1005 -- after the main loop runs, the paste data will be 1006 -- inserted.) 1007 1008 -- `an_override_location': location to insert pasted text, or 1009 -- Void for at the cursor 1010 1011 -- `default_editable' : whether the buffer is editable by default 1012 require 1013 clipboard_not_void: a_clipboard /= Void 1014 location_not_void: an_override_location /= Void 1015 do 1016 gtk_text_buffer_paste_clipboard (handle, a_clipboard.handle, 1017 an_override_location.handle, default_editable.to_integer) 1018 end 1019 1020 copy_clipboard (a_clipboard: GTK_CLIPBOARD) is 1021 -- Copies the currently-selected text to `a_clipboard'. 1022 require 1023 clipboard_not_void: a_clipboard /= Void 1024 do 1025 gtk_text_buffer_copy_clipboard (handle, a_clipboard.handle) 1026 end 1027 1028 cut_clipboard (a_clipboard: GTK_CLIPBOARD; default_editable: BOOLEAN) is 1029 -- Copies the currently-selected text to `a_clipboard,' then 1030 -- deletes said text if it's editable. `default_editable' is 1031 -- the default editability of the buffer. 1032 require 1033 clipboard_not_void: a_clipboard /= Void 1034 do 1035 gtk_text_buffer_cut_clipboard (handle, a_clipboard.handle, default_editable.to_integer) 1036 end 1037 1038 selection_bounds: TUPLE[GTK_TEXT_ITER, GTK_TEXT_ITER] is 1039 -- the selection start and end; Void if there is no selection 1040 local a_start, an_end: GTK_TEXT_ITER; is_some_text_selected: BOOLEAN 1041 do 1042 create a_start.make; create an_end.make 1043 is_some_text_selected:=(gtk_text_buffer_get_selection_bounds 1044 (handle,a_start.handle, an_end.handle).to_boolean) 1045 if is_some_text_selected then 1046 create Result.make_2(a_start, an_end) 1047 end 1048 end 1049 1050 begin_user_action is 1051 -- Called to indicate that the buffer operations between here 1052 -- and a call to `end_user_action' are part of a single 1053 -- user-visible operation. The operations between 1054 -- `begin_user_action' and `end_user_action' can then be 1055 -- grouped when creating an undo stack. GtkTextBuffer 1056 -- maintains a count of calls to `begin_user_action' that 1057 -- have not been closed with a call to `end_user_action', and 1058 -- emits the "begin_user_action" and "end_user_action" 1059 -- signals only for the outermost pair of calls. This allows 1060 -- you to build user actions from other user actions. 1061 1062 -- The "interactive" buffer mutation functions, such as 1063 -- insert_interactive, automatically call begin/end user 1064 -- action around the buffer operations they perform, so 1065 -- there's no need to add extra calls if you user action 1066 -- consists solely of a single call to one of those 1067 -- functions. 1068 do 1069 gtk_text_buffer_begin_user_action(handle) 1070 end 1071 1072 end_user_action is 1073 -- See `begin_user_action' function for a full explanation.-- 1074 -- Both calls should be paired. 1075 do 1076 gtk_text_buffer_end_user_action (handle) 1077 end 1078 1079 -- gtk_text_buffer_add_selection_clipboard () 1080 1081 -- void gtk_text_buffer_add_selection_clipboard 1082 -- (GtkTextBuffer *buffer, 1083 -- GtkClipboard *clipboard); 1084 1085 -- Adds clipboard to the list of clipboards in which the selection contents of buffer are available. In most cases, clipboard will be the GtkClipboard of type GDK_SELECTION_PRIMARY for a view of buffer. 1086 1087 -- buffer : a GtkTextBuffer 1088 -- clipboard : a GtkClipboard 1089 -- gtk_text_buffer_remove_selection_clipboard () 1090 1091 -- void gtk_text_buffer_remove_selection_clipboard 1092 -- (GtkTextBuffer *buffer, 1093 -- GtkClipboard *clipboard); 1094 1095 -- Removes a GtkClipboard added with gtk_text_buffer_add_selection_clipboard() 1096 1097 -- buffer : a GtkTextBuffer 1098 -- clipboard : a GtkClipboard added to buffer by gtk_text_buffer_add_selection_clipboard(). 1099 -- Property Details 1100 -- The "tag-table" property 1101 1102 -- "tag-table" GtkTextTagTable : Read / Write / Construct Only 1103 1104 -- Text Tag Table. 1105 -- The "text" property 1106 1107 -- "text" gchararray : Read / Write 1108 1109 -- The text content of the buffer. Without child widgets and images, see gtk_text_buffer_get_text() for more information. 1110 1111 -- Default value: "" 1112 1113 -- Since 2.8 1114 -- Signal Details 1115feature -- TODO: The "apply-tag" signal 1116 1117 -- void user_function (GtkTextBuffer *textbuffer, 1118 -- GtkTextTag *arg1, 1119 -- GtkTextIter *arg2, 1120 -- GtkTextIter *arg3, 1121 -- gpointer user_data) : Run last 1122 1123 -- textbuffer : the object which received the signal. 1124 -- arg1 : 1125 -- arg2 : 1126 -- arg3 : 1127 -- user_data : user data set when the signal handler was connected. 1128 1129 1130feature -- The "begin-user-action" signal 1131 1132 begin_user_action_signal_name: STRING is "begin-user-action" 1133 -- void user_function (GtkTextBuffer *textbuffer, 1134 -- gpointer user_data) : Run last 1135 1136 enable_on_begin_user_action is 1137 -- Connects "begin_user_action" signal to `on_begin_user_action' feature. 1138 do 1139 connect (Current, begin_user_action_signal_name, $on_begin_user_action) 1140 end 1141 1142 on_begin_user_action is 1143 -- Built-in begin_user_action signal handler; empty by design; redefine it. 1144 -- Indicates that the user has begin_user_action the contents of the widget. 1145 do 1146 end 1147 1148 connect_agent_to_begin_user_action_signal (a_procedure: PROCEDURE [ANY, TUPLE[like Current]]) is 1149 -- textbuffer : the object which received the signal. 1150 require valid_procedure: a_procedure /= Void 1151 local begin_user_action_callback: BEGIN_USER_ACTION_CALLBACK 1152 do 1153 create begin_user_action_callback.make 1154 begin_user_action_callback.connect (Current, a_procedure) 1155 end 1156 1157feature -- The "changed" signal 1158 1159 changed_signal_name: STRING is "changed" 1160 1161 enable_on_changed is 1162 -- Connects "changed" signal to `on_changed' feature. 1163 do 1164 connect (Current, changed_signal_name, $on_changed) 1165 end 1166 1167 on_changed is 1168 -- Built-in changed signal handler; empty by design; redefine it. 1169 -- Indicates that the user has changed the contents of the widget. 1170 do 1171 end 1172 1173 connect_agent_to_changed_signal (a_procedure: PROCEDURE [ANY, TUPLE[like Current]]) is 1174 require valid_procedure: a_procedure /= Void 1175 local changed_callback: CHANGED_CALLBACK [like Current] 1176 do 1177 create changed_callback.make 1178 changed_callback.connect (Current, a_procedure) 1179 end 1180 1181feature -- TODO: The "delete-range" signal 1182 1183 -- void user_function (GtkTextBuffer *textbuffer, 1184 -- GtkTextIter *arg1, 1185 -- GtkTextIter *arg2, 1186 -- gpointer user_data) : Run last 1187 1188 -- textbuffer : the object which received the signal. 1189 -- arg1 : 1190 -- arg2 : 1191 -- user_data : user data set when the signal handler was connected. 1192 1193feature -- The "end-user-action" signal 1194 1195 end_user_action_signal_name: STRING is "end-user-action" 1196 -- void user_function (GtkTextBuffer *textbuffer, 1197 -- gpointer user_data) : Run last 1198 1199 enable_on_end_user_action is 1200 -- Connects "end_user_action" signal to `on_end_user_action' feature. 1201 do 1202 connect (Current, end_user_action_signal_name, $on_end_user_action) 1203 end 1204 1205 on_end_user_action is 1206 -- Built-in end_user_action signal handler; empty by design; redefine it. 1207 -- Indicates that the user has end_user_action the contents of the widget. 1208 do 1209 end 1210 1211 connect_agent_to_end_user_action_signal (a_procedure: PROCEDURE [ANY, TUPLE[like Current]]) is 1212 -- textbuffer : the object which received the signal. 1213 require valid_procedure: a_procedure /= Void 1214 local end_user_action_callback: END_USER_ACTION_CALLBACK 1215 do 1216 create end_user_action_callback.make 1217 end_user_action_callback.connect (Current, a_procedure) 1218 end 1219 1220feature -- TODO: The "insert-child-anchor" signal 1221 1222 -- void user_function (GtkTextBuffer *textbuffer, 1223 -- GtkTextIter *arg1, 1224 -- GtkTextChildAnchor *arg2, 1225 -- gpointer user_data) : Run last 1226 1227 -- textbuffer : the object which received the signal. 1228 -- arg1 : 1229 -- arg2 : 1230 -- user_data : user data set when the signal handler was connected. 1231 1232feature -- TODO: The "insert-pixbuf" signal 1233 1234 -- void user_function (GtkTextBuffer *textbuffer, GtkTextIter 1235 -- *arg1, GdkPixbuf *arg2, gpointer user_data) : Run last 1236 1237 -- textbuffer : the object which received the signal. 1238 -- arg1 : 1239 -- arg2 : 1240 -- user_data : user data set when the signal handler was connected. 1241 1242feature -- The "insert-text" signal 1243 1244 connect_agent_to_insert_text_signal (a_procedure: PROCEDURE [ANY, TUPLE[GTK_TEXT_ITER, STRING, GTK_TEXT_BUFFER]]) is 1245 -- textbuffer : the object which received the signal. 1246 -- arg1 : 1247 -- arg2 : 1248 -- arg3 : 1249 require 1250 valid_procedure: a_procedure /= Void 1251 local 1252 insert_text_callback: BUFFER_INSERT_TEXT_CALLBACK 1253 do 1254 create insert_text_callback.make 1255 insert_text_callback.connect (Current, a_procedure) 1256 end 1257 1258feature -- TODO: -- The "mark-deleted" signal 1259 1260 -- void user_function (GtkTextBuffer *textbuffer, GtkTextMark 1261 -- *arg1, gpointer user_data) : Run last 1262 1263 -- textbuffer : the object which received the signal. 1264 -- arg1 : 1265 -- user_data : user data set when the signal handler was connected. 1266 1267feature -- TODO: -- The "mark-set" signal 1268 1269 -- void user_function (GtkTextBuffer *textbuffer, GtkTextIter 1270 -- *arg1, GtkTextMark *arg2, gpointer user_data) : Run last 1271 1272 -- textbuffer : the object which received the signal. 1273 -- arg1 : 1274 -- arg2 : 1275 -- user_data : user data set when the signal handler was connected. 1276 1277feature -- TODO: -- The "modified-changed" signal 1278 1279 -- void user_function (GtkTextBuffer *textbuffer, gpointer 1280 -- user_data) : Run last 1281 1282 -- textbuffer : the object which received the signal. 1283 -- user_data : user data set when the signal handler was connected. 1284 1285feature -- TODO: -- The "remove-tag" signal 1286 1287 -- void user_function (GtkTextBuffer *textbuffer, GtkTextTag *arg1, 1288 -- GtkTextIter *arg2, GtkTextIter *arg3, gpointer user_data) : Run 1289 -- last 1290 1291 -- textbuffer : the object which received the signal. 1292 -- arg1 : 1293 -- arg2 : 1294 -- arg3 : 1295 -- user_data : user data set when the signal handler was connected. 1296 1297feature {} -- Implementation 1298 hidden_tag_table: GTK_TEXT_TAG_TABLE 1299 -- Hidden reference to the Eiffel wrapper of the 1300 -- GtkTextTagTable of Current. Handled by `tag_table'. 1301 1302feature -- struct size 1303 struct_size: INTEGER is 1304 external "C inline use <gtk/gtk.h>" 1305 alias "sizeof(GtkTextBuffer)" 1306 end 1307 1308end -- class GTK_TEXT_BUFFER