1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.TextBuffer;
26 
27 private import core.vararg;
28 private import gdk.Color;
29 private import gdkpixbuf.Pixbuf;
30 private import glib.ConstructionException;
31 private import glib.ErrorG;
32 private import glib.GException;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 private import gobject.Signals;
36 private import gtk.Clipboard;
37 private import gtk.TargetList;
38 private import gtk.TextChildAnchor;
39 private import gtk.TextIter;
40 private import gtk.TextMark;
41 private import gtk.TextTag;
42 private import gtk.TextTagTable;
43 private import gtkc.gobject;
44 private import gtkc.gtk;
45 public  import gtkc.gtktypes;
46 private import pango.PgFontDescription;
47 private import pango.PgTabArray;
48 private import std.algorithm;
49 private import std.stdio;
50 
51 
52 /**
53  * You may wish to begin by reading the
54  * [text widget conceptual overview][TextWidget]
55  * which gives an overview of all the objects and data
56  * types related to the text widget and how they work together.
57  */
58 public class TextBuffer : ObjectG
59 {
60 	/** the main Gtk struct */
61 	protected GtkTextBuffer* gtkTextBuffer;
62 
63 	/** Get the main Gtk struct */
64 	public GtkTextBuffer* getTextBufferStruct(bool transferOwnership = false)
65 	{
66 		if (transferOwnership)
67 			ownedRef = false;
68 		return gtkTextBuffer;
69 	}
70 
71 	/** the main Gtk struct as a void* */
72 	protected override void* getStruct()
73 	{
74 		return cast(void*)gtkTextBuffer;
75 	}
76 
77 	protected override void setStruct(GObject* obj)
78 	{
79 		gtkTextBuffer = cast(GtkTextBuffer*)obj;
80 		super.setStruct(obj);
81 	}
82 
83 	/**
84 	 * Sets our main struct and passes it to the parent class.
85 	 */
86 	public this (GtkTextBuffer* gtkTextBuffer, bool ownedRef = false)
87 	{
88 		this.gtkTextBuffer = gtkTextBuffer;
89 		super(cast(GObject*)gtkTextBuffer, ownedRef);
90 	}
91 
92 	/**
93 	 * Inserts text into buffer at iter, applying the list of tags to
94 	 * the newly-inserted text. The last tag specified must be NULL to
95 	 * terminate the list. Equivalent to calling gtk_text_buffer_insert(),
96 	 * then gtk_text_buffer_apply_tag() on the inserted text;
97 	 * gtk_text_buffer_insert_with_tags() is just a convenience function.
98 	 * Params:
99 	 *  iter = an iterator in buffer
100 	 *  text = UTF-8 text
101 	 *  tags = list of tags to apply
102 	 */
103 	public void insertWithTags(TextIter iter, string text, TextTag[] tags ... )
104 	{
105 		int startOffset = iter.getOffset();
106 		
107 		insert(iter, text);
108 		
109 		if ( tags.length == 0 )
110 			return;
111 		
112 		TextIter start = new TextIter();
113 		getIterAtOffset(start, startOffset);
114 		
115 		foreach( tag; tags )
116 		{
117 			applyTag(tag, start, iter);
118 		}
119 	}
120 	
121 	/**
122 	 * Same as gtk_text_buffer_insert_with_tags(), but allows you
123 	 * to pass in tag names instead of tag objects.
124 	 * Params:
125 	 *  iter = position in buffer
126 	 *  text = UTF-8 text
127 	 *  tags = tag names
128 	 */
129 	public void insertWithTagsByName(TextIter iter, string text, string[] tags ... )
130 	{
131 		int startOffset = iter.getOffset();
132 		
133 		insert(iter, text);
134 		
135 		if ( tags.length == 0 )
136 			return;
137 		
138 		TextIter start = new TextIter();
139 		getIterAtOffset(start, startOffset);
140 		
141 		foreach( tag; tags )
142 		{
143 			applyTagByName(tag, start, iter);
144 		}
145 	}
146 	
147 	/**
148 	 * Creates a tag and adds it to the tag table for buffer. Equivalent to
149 	 * adding a new tag to the buffer's tag table.
150 	 *
151 	 * If tagName is null, the tag is anonymous.
152 	 *
153 	 * If tagName is non-NULL, a tag called tagName must not already exist
154 	 * in the tag table for this buffer.
155 	 *
156 	 * Params:
157 	 *     tagName = the name for the new tag.
158 	 *     ...     = A list of property names and there values.
159 	 */
160 	TextTag createTag(string tagName, ...)
161 	{
162 		TextTag tag = new TextTag(gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), null, null));
163 		
164 		for (size_t i = 0; i < _arguments.length; i+=2)
165 		{
166 			//TODO: Add a proper eception type for this.
167 			if ( _arguments[i] != typeid(string) )
168 				throw new Exception("TextBuffer.CreateTag: The property name must be a string.");
169 			
170 			string name = va_arg!(string)(_argptr);
171 			
172 			if ( _arguments[i+1] == typeid(bool) ||
173 				_arguments[i+1] == typeid(int) ||
174 			_arguments[i+1] == typeid(GtkJustification) ||
175 			_arguments[i+1] == typeid(GtkTextDirection) ||
176 			_arguments[i+1] == typeid(GtkWrapMode) ||
177 			_arguments[i+1] == typeid(PangoStretch) ||
178 			_arguments[i+1] == typeid(PangoStyle) ||
179 			_arguments[i+1] == typeid(PangoUnderline) ||
180 			_arguments[i+1] == typeid(PangoVariant) ||
181 			_arguments[i+1] == typeid(PangoWeight) )
182 			{
183 				
184 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(int)(_argptr), null);
185 			}
186 			else if ( _arguments[i+1] == typeid(Color) )
187 			{
188 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(Color)(_argptr).getColorStruct(), null);
189 			}
190 			else if ( _arguments[i+1] == typeid(double) )
191 			{
192 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(double)(_argptr), null);
193 			}
194 			else if ( _arguments[i+1] == typeid(const(double)) )
195 			{
196 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(double)(_argptr), null);
197 			}
198 			else if ( _arguments[i+1] == typeid(PgFontDescription) )
199 			{
200 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(PgFontDescription)(_argptr).getPgFontDescriptionStruct(), null);
201 			}
202 			else if ( _arguments[i+1] == typeid(PgTabArray) )
203 			{
204 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(PgTabArray)(_argptr).getPgTabArrayStruct(), null);
205 			}
206 			else if ( _arguments[i+1] == typeid(string) )
207 			{
208 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), Str.toStringz(va_arg!(string)(_argptr)), null);
209 			}
210 			else
211 			{
212 				stderr.writefln("TextBuffer.CreateTag: Unsupported type: \"%s\" for property: \"%s\"", _arguments[i+1], name);
213 				
214 				//TODO: throw segfaults, druntime bug?
215 				throw new Exception("TextBuffer.CreateTag: Unsupported type: \""~_arguments[i+1].toString()~"\" for property: \""~name~"\"");
216 			}
217 		}
218 		
219 		return tag;
220 	}
221 	
222 	/**
223 	 * Obtain the entire text
224 	 * Returns: The text string
225 	 */
226 	string getText()
227 	{
228 		TextIter start = new TextIter();
229 		TextIter end = new TextIter();
230 		getBounds(start,end);
231 		return Str.toString(gtk_text_buffer_get_slice(gtkTextBuffer, start.getTextIterStruct(), end.getTextIterStruct(), true));
232 	}
233 
234 	/**
235 	 */
236 
237 	/** */
238 	public static GType getType()
239 	{
240 		return gtk_text_buffer_get_type();
241 	}
242 
243 	/**
244 	 * Creates a new text buffer.
245 	 *
246 	 * Params:
247 	 *     table = a tag table, or %NULL to create a new one
248 	 *
249 	 * Returns: a new text buffer
250 	 *
251 	 * Throws: ConstructionException GTK+ fails to create the object.
252 	 */
253 	public this(TextTagTable table)
254 	{
255 		auto p = gtk_text_buffer_new((table is null) ? null : table.getTextTagTableStruct());
256 		
257 		if(p is null)
258 		{
259 			throw new ConstructionException("null returned by new");
260 		}
261 		
262 		this(cast(GtkTextBuffer*) p, true);
263 	}
264 
265 	/**
266 	 * Adds the mark at position @where. The mark must not be added to
267 	 * another buffer, and if its name is not %NULL then there must not
268 	 * be another mark in the buffer with the same name.
269 	 *
270 	 * Emits the #GtkTextBuffer::mark-set signal as notification of the mark's
271 	 * initial placement.
272 	 *
273 	 * Params:
274 	 *     mark = the mark to add
275 	 *     where = location to place mark
276 	 *
277 	 * Since: 2.12
278 	 */
279 	public void addMark(TextMark mark, TextIter where)
280 	{
281 		gtk_text_buffer_add_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct(), (where is null) ? null : where.getTextIterStruct());
282 	}
283 
284 	/**
285 	 * Adds @clipboard to the list of clipboards in which the selection
286 	 * contents of @buffer are available. In most cases, @clipboard will be
287 	 * the #GtkClipboard of type %GDK_SELECTION_PRIMARY for a view of @buffer.
288 	 *
289 	 * Params:
290 	 *     clipboard = a #GtkClipboard
291 	 */
292 	public void addSelectionClipboard(Clipboard clipboard)
293 	{
294 		gtk_text_buffer_add_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
295 	}
296 
297 	/**
298 	 * Emits the “apply-tag” signal on @buffer. The default
299 	 * handler for the signal applies @tag to the given range.
300 	 * @start and @end do not have to be in order.
301 	 *
302 	 * Params:
303 	 *     tag = a #GtkTextTag
304 	 *     start = one bound of range to be tagged
305 	 *     end = other bound of range to be tagged
306 	 */
307 	public void applyTag(TextTag tag, TextIter start, TextIter end)
308 	{
309 		gtk_text_buffer_apply_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
310 	}
311 
312 	/**
313 	 * Calls gtk_text_tag_table_lookup() on the buffer’s tag table to
314 	 * get a #GtkTextTag, then calls gtk_text_buffer_apply_tag().
315 	 *
316 	 * Params:
317 	 *     name = name of a named #GtkTextTag
318 	 *     start = one bound of range to be tagged
319 	 *     end = other bound of range to be tagged
320 	 */
321 	public void applyTagByName(string name, TextIter start, TextIter end)
322 	{
323 		gtk_text_buffer_apply_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
324 	}
325 
326 	/**
327 	 * Performs the appropriate action as if the user hit the delete
328 	 * key with the cursor at the position specified by @iter. In the
329 	 * normal case a single character will be deleted, but when
330 	 * combining accents are involved, more than one character can
331 	 * be deleted, and when precomposed character and accent combinations
332 	 * are involved, less than one character will be deleted.
333 	 *
334 	 * Because the buffer is modified, all outstanding iterators become
335 	 * invalid after calling this function; however, the @iter will be
336 	 * re-initialized to point to the location where text was deleted.
337 	 *
338 	 * Params:
339 	 *     iter = a position in @buffer
340 	 *     interactive = whether the deletion is caused by user interaction
341 	 *     defaultEditable = whether the buffer is editable by default
342 	 *
343 	 * Returns: %TRUE if the buffer was modified
344 	 *
345 	 * Since: 2.6
346 	 */
347 	public bool backspace(TextIter iter, bool interactive, bool defaultEditable)
348 	{
349 		return gtk_text_buffer_backspace(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), interactive, defaultEditable) != 0;
350 	}
351 
352 	/**
353 	 * Called to indicate that the buffer operations between here and a
354 	 * call to gtk_text_buffer_end_user_action() are part of a single
355 	 * user-visible operation. The operations between
356 	 * gtk_text_buffer_begin_user_action() and
357 	 * gtk_text_buffer_end_user_action() can then be grouped when creating
358 	 * an undo stack. #GtkTextBuffer maintains a count of calls to
359 	 * gtk_text_buffer_begin_user_action() that have not been closed with
360 	 * a call to gtk_text_buffer_end_user_action(), and emits the
361 	 * “begin-user-action” and “end-user-action” signals only for the
362 	 * outermost pair of calls. This allows you to build user actions
363 	 * from other user actions.
364 	 *
365 	 * The “interactive” buffer mutation functions, such as
366 	 * gtk_text_buffer_insert_interactive(), automatically call begin/end
367 	 * user action around the buffer operations they perform, so there's
368 	 * no need to add extra calls if you user action consists solely of a
369 	 * single call to one of those functions.
370 	 */
371 	public void beginUserAction()
372 	{
373 		gtk_text_buffer_begin_user_action(gtkTextBuffer);
374 	}
375 
376 	/**
377 	 * Copies the currently-selected text to a clipboard.
378 	 *
379 	 * Params:
380 	 *     clipboard = the #GtkClipboard object to copy to
381 	 */
382 	public void copyClipboard(Clipboard clipboard)
383 	{
384 		gtk_text_buffer_copy_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
385 	}
386 
387 	/**
388 	 * This is a convenience function which simply creates a child anchor
389 	 * with gtk_text_child_anchor_new() and inserts it into the buffer
390 	 * with gtk_text_buffer_insert_child_anchor(). The new anchor is
391 	 * owned by the buffer; no reference count is returned to
392 	 * the caller of gtk_text_buffer_create_child_anchor().
393 	 *
394 	 * Params:
395 	 *     iter = location in the buffer
396 	 *
397 	 * Returns: the created child anchor
398 	 */
399 	public TextChildAnchor createChildAnchor(TextIter iter)
400 	{
401 		auto p = gtk_text_buffer_create_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct());
402 		
403 		if(p is null)
404 		{
405 			return null;
406 		}
407 		
408 		return ObjectG.getDObject!(TextChildAnchor)(cast(GtkTextChildAnchor*) p);
409 	}
410 
411 	/**
412 	 * Creates a mark at position @where. If @mark_name is %NULL, the mark
413 	 * is anonymous; otherwise, the mark can be retrieved by name using
414 	 * gtk_text_buffer_get_mark(). If a mark has left gravity, and text is
415 	 * inserted at the mark’s current location, the mark will be moved to
416 	 * the left of the newly-inserted text. If the mark has right gravity
417 	 * (@left_gravity = %FALSE), the mark will end up on the right of
418 	 * newly-inserted text. The standard left-to-right cursor is a mark
419 	 * with right gravity (when you type, the cursor stays on the right
420 	 * side of the text you’re typing).
421 	 *
422 	 * The caller of this function does not own a
423 	 * reference to the returned #GtkTextMark, so you can ignore the
424 	 * return value if you like. Marks are owned by the buffer and go
425 	 * away when the buffer does.
426 	 *
427 	 * Emits the #GtkTextBuffer::mark-set signal as notification of the mark's
428 	 * initial placement.
429 	 *
430 	 * Params:
431 	 *     markName = name for mark, or %NULL
432 	 *     where = location to place mark
433 	 *     leftGravity = whether the mark has left gravity
434 	 *
435 	 * Returns: the new #GtkTextMark object
436 	 */
437 	public TextMark createMark(string markName, TextIter where, bool leftGravity)
438 	{
439 		auto p = gtk_text_buffer_create_mark(gtkTextBuffer, Str.toStringz(markName), (where is null) ? null : where.getTextIterStruct(), leftGravity);
440 		
441 		if(p is null)
442 		{
443 			return null;
444 		}
445 		
446 		return ObjectG.getDObject!(TextMark)(cast(GtkTextMark*) p);
447 	}
448 
449 	/**
450 	 * Copies the currently-selected text to a clipboard, then deletes
451 	 * said text if it’s editable.
452 	 *
453 	 * Params:
454 	 *     clipboard = the #GtkClipboard object to cut to
455 	 *     defaultEditable = default editability of the buffer
456 	 */
457 	public void cutClipboard(Clipboard clipboard, bool defaultEditable)
458 	{
459 		gtk_text_buffer_cut_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), defaultEditable);
460 	}
461 
462 	/**
463 	 * Deletes text between @start and @end. The order of @start and @end
464 	 * is not actually relevant; gtk_text_buffer_delete() will reorder
465 	 * them. This function actually emits the “delete-range” signal, and
466 	 * the default handler of that signal deletes the text. Because the
467 	 * buffer is modified, all outstanding iterators become invalid after
468 	 * calling this function; however, the @start and @end will be
469 	 * re-initialized to point to the location where text was deleted.
470 	 *
471 	 * Params:
472 	 *     start = a position in @buffer
473 	 *     end = another position in @buffer
474 	 */
475 	public void delet(TextIter start, TextIter end)
476 	{
477 		gtk_text_buffer_delete(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
478 	}
479 
480 	/**
481 	 * Deletes all editable text in the given range.
482 	 * Calls gtk_text_buffer_delete() for each editable sub-range of
483 	 * [@start,@end). @start and @end are revalidated to point to
484 	 * the location of the last deleted range, or left untouched if
485 	 * no text was deleted.
486 	 *
487 	 * Params:
488 	 *     startIter = start of range to delete
489 	 *     endIter = end of range
490 	 *     defaultEditable = whether the buffer is editable by default
491 	 *
492 	 * Returns: whether some text was actually deleted
493 	 */
494 	public bool deleteInteractive(TextIter startIter, TextIter endIter, bool defaultEditable)
495 	{
496 		return gtk_text_buffer_delete_interactive(gtkTextBuffer, (startIter is null) ? null : startIter.getTextIterStruct(), (endIter is null) ? null : endIter.getTextIterStruct(), defaultEditable) != 0;
497 	}
498 
499 	/**
500 	 * Deletes @mark, so that it’s no longer located anywhere in the
501 	 * buffer. Removes the reference the buffer holds to the mark, so if
502 	 * you haven’t called g_object_ref() on the mark, it will be freed. Even
503 	 * if the mark isn’t freed, most operations on @mark become
504 	 * invalid, until it gets added to a buffer again with
505 	 * gtk_text_buffer_add_mark(). Use gtk_text_mark_get_deleted() to
506 	 * find out if a mark has been removed from its buffer.
507 	 * The #GtkTextBuffer::mark-deleted signal will be emitted as notification after
508 	 * the mark is deleted.
509 	 *
510 	 * Params:
511 	 *     mark = a #GtkTextMark in @buffer
512 	 */
513 	public void deleteMark(TextMark mark)
514 	{
515 		gtk_text_buffer_delete_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct());
516 	}
517 
518 	/**
519 	 * Deletes the mark named @name; the mark must exist. See
520 	 * gtk_text_buffer_delete_mark() for details.
521 	 *
522 	 * Params:
523 	 *     name = name of a mark in @buffer
524 	 */
525 	public void deleteMarkByName(string name)
526 	{
527 		gtk_text_buffer_delete_mark_by_name(gtkTextBuffer, Str.toStringz(name));
528 	}
529 
530 	/**
531 	 * Deletes the range between the “insert” and “selection_bound” marks,
532 	 * that is, the currently-selected text. If @interactive is %TRUE,
533 	 * the editability of the selection will be considered (users can’t delete
534 	 * uneditable text).
535 	 *
536 	 * Params:
537 	 *     interactive = whether the deletion is caused by user interaction
538 	 *     defaultEditable = whether the buffer is editable by default
539 	 *
540 	 * Returns: whether there was a non-empty selection to delete
541 	 */
542 	public bool deleteSelection(bool interactive, bool defaultEditable)
543 	{
544 		return gtk_text_buffer_delete_selection(gtkTextBuffer, interactive, defaultEditable) != 0;
545 	}
546 
547 	/**
548 	 * This function deserializes rich text in format @format and inserts
549 	 * it at @iter.
550 	 *
551 	 * @formats to be used must be registered using
552 	 * gtk_text_buffer_register_deserialize_format() or
553 	 * gtk_text_buffer_register_deserialize_tagset() beforehand.
554 	 *
555 	 * Params:
556 	 *     contentBuffer = the #GtkTextBuffer to deserialize into
557 	 *     format = the rich text format to use for deserializing
558 	 *     iter = insertion point for the deserialized text
559 	 *     data = data to deserialize
560 	 *     length = length of @data
561 	 *
562 	 * Returns: %TRUE on success, %FALSE otherwise.
563 	 *
564 	 * Since: 2.10
565 	 *
566 	 * Throws: GException on failure.
567 	 */
568 	public bool deserialize(TextBuffer contentBuffer, GdkAtom format, TextIter iter, ubyte[] data)
569 	{
570 		GError* err = null;
571 		
572 		auto p = gtk_text_buffer_deserialize(gtkTextBuffer, (contentBuffer is null) ? null : contentBuffer.getTextBufferStruct(), format, (iter is null) ? null : iter.getTextIterStruct(), data.ptr, cast(size_t)data.length, &err) != 0;
573 		
574 		if (err !is null)
575 		{
576 			throw new GException( new ErrorG(err) );
577 		}
578 		
579 		return p;
580 	}
581 
582 	/**
583 	 * This functions returns the value set with
584 	 * gtk_text_buffer_deserialize_set_can_create_tags()
585 	 *
586 	 * Params:
587 	 *     format = a #GdkAtom representing a registered rich text format
588 	 *
589 	 * Returns: whether deserializing this format may create tags
590 	 *
591 	 * Since: 2.10
592 	 */
593 	public bool deserializeGetCanCreateTags(GdkAtom format)
594 	{
595 		return gtk_text_buffer_deserialize_get_can_create_tags(gtkTextBuffer, format) != 0;
596 	}
597 
598 	/**
599 	 * Use this function to allow a rich text deserialization function to
600 	 * create new tags in the receiving buffer. Note that using this
601 	 * function is almost always a bad idea, because the rich text
602 	 * functions you register should know how to map the rich text format
603 	 * they handler to your text buffers set of tags.
604 	 *
605 	 * The ability of creating new (arbitrary!) tags in the receiving buffer
606 	 * is meant for special rich text formats like the internal one that
607 	 * is registered using gtk_text_buffer_register_deserialize_tagset(),
608 	 * because that format is essentially a dump of the internal structure
609 	 * of the source buffer, including its tag names.
610 	 *
611 	 * You should allow creation of tags only if you know what you are
612 	 * doing, e.g. if you defined a tagset name for your application
613 	 * suite’s text buffers and you know that it’s fine to receive new
614 	 * tags from these buffers, because you know that your application can
615 	 * handle the newly created tags.
616 	 *
617 	 * Params:
618 	 *     format = a #GdkAtom representing a registered rich text format
619 	 *     canCreateTags = whether deserializing this format may create tags
620 	 *
621 	 * Since: 2.10
622 	 */
623 	public void deserializeSetCanCreateTags(GdkAtom format, bool canCreateTags)
624 	{
625 		gtk_text_buffer_deserialize_set_can_create_tags(gtkTextBuffer, format, canCreateTags);
626 	}
627 
628 	/**
629 	 * Should be paired with a call to gtk_text_buffer_begin_user_action().
630 	 * See that function for a full explanation.
631 	 */
632 	public void endUserAction()
633 	{
634 		gtk_text_buffer_end_user_action(gtkTextBuffer);
635 	}
636 
637 	/**
638 	 * Retrieves the first and last iterators in the buffer, i.e. the
639 	 * entire buffer lies within the range [@start,@end).
640 	 *
641 	 * Params:
642 	 *     start = iterator to initialize with first position in the buffer
643 	 *     end = iterator to initialize with the end iterator
644 	 */
645 	public void getBounds(out TextIter start, out TextIter end)
646 	{
647 		GtkTextIter* outstart = gMalloc!GtkTextIter();
648 		GtkTextIter* outend = gMalloc!GtkTextIter();
649 		
650 		gtk_text_buffer_get_bounds(gtkTextBuffer, outstart, outend);
651 		
652 		start = ObjectG.getDObject!(TextIter)(outstart, true);
653 		end = ObjectG.getDObject!(TextIter)(outend, true);
654 	}
655 
656 	/**
657 	 * Gets the number of characters in the buffer; note that characters
658 	 * and bytes are not the same, you can’t e.g. expect the contents of
659 	 * the buffer in string form to be this many bytes long. The character
660 	 * count is cached, so this function is very fast.
661 	 *
662 	 * Returns: number of characters in the buffer
663 	 */
664 	public int getCharCount()
665 	{
666 		return gtk_text_buffer_get_char_count(gtkTextBuffer);
667 	}
668 
669 	/**
670 	 * This function returns the list of targets this text buffer can
671 	 * provide for copying and as DND source. The targets in the list are
672 	 * added with @info values from the #GtkTextBufferTargetInfo enum,
673 	 * using gtk_target_list_add_rich_text_targets() and
674 	 * gtk_target_list_add_text_targets().
675 	 *
676 	 * Returns: the #GtkTargetList
677 	 *
678 	 * Since: 2.10
679 	 */
680 	public TargetList getCopyTargetList()
681 	{
682 		auto p = gtk_text_buffer_get_copy_target_list(gtkTextBuffer);
683 		
684 		if(p is null)
685 		{
686 			return null;
687 		}
688 		
689 		return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p);
690 	}
691 
692 	/**
693 	 * This function returns the rich text deserialize formats registered
694 	 * with @buffer using gtk_text_buffer_register_deserialize_format() or
695 	 * gtk_text_buffer_register_deserialize_tagset()
696 	 *
697 	 * Returns: an array of
698 	 *     #GdkAtoms representing the registered formats.
699 	 *
700 	 * Since: 2.10
701 	 */
702 	public GdkAtom[] getDeserializeFormats()
703 	{
704 		int nFormats;
705 		
706 		auto p = gtk_text_buffer_get_deserialize_formats(gtkTextBuffer, &nFormats);
707 		
708 		return p[0 .. nFormats];
709 	}
710 
711 	/**
712 	 * Initializes @iter with the “end iterator,” one past the last valid
713 	 * character in the text buffer. If dereferenced with
714 	 * gtk_text_iter_get_char(), the end iterator has a character value of 0.
715 	 * The entire buffer lies in the range from the first position in
716 	 * the buffer (call gtk_text_buffer_get_start_iter() to get
717 	 * character position 0) to the end iterator.
718 	 *
719 	 * Params:
720 	 *     iter = iterator to initialize
721 	 */
722 	public void getEndIter(out TextIter iter)
723 	{
724 		GtkTextIter* outiter = gMalloc!GtkTextIter();
725 		
726 		gtk_text_buffer_get_end_iter(gtkTextBuffer, outiter);
727 		
728 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
729 	}
730 
731 	/**
732 	 * Indicates whether the buffer has some text currently selected.
733 	 *
734 	 * Returns: %TRUE if the there is text selected
735 	 *
736 	 * Since: 2.10
737 	 */
738 	public bool getHasSelection()
739 	{
740 		return gtk_text_buffer_get_has_selection(gtkTextBuffer) != 0;
741 	}
742 
743 	/**
744 	 * Returns the mark that represents the cursor (insertion point).
745 	 * Equivalent to calling gtk_text_buffer_get_mark() to get the mark
746 	 * named “insert”, but very slightly more efficient, and involves less
747 	 * typing.
748 	 *
749 	 * Returns: insertion point mark
750 	 */
751 	public TextMark getInsert()
752 	{
753 		auto p = gtk_text_buffer_get_insert(gtkTextBuffer);
754 		
755 		if(p is null)
756 		{
757 			return null;
758 		}
759 		
760 		return ObjectG.getDObject!(TextMark)(cast(GtkTextMark*) p);
761 	}
762 
763 	/**
764 	 * Obtains the location of @anchor within @buffer.
765 	 *
766 	 * Params:
767 	 *     iter = an iterator to be initialized
768 	 *     anchor = a child anchor that appears in @buffer
769 	 */
770 	public void getIterAtChildAnchor(out TextIter iter, TextChildAnchor anchor)
771 	{
772 		GtkTextIter* outiter = gMalloc!GtkTextIter();
773 		
774 		gtk_text_buffer_get_iter_at_child_anchor(gtkTextBuffer, outiter, (anchor is null) ? null : anchor.getTextChildAnchorStruct());
775 		
776 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
777 	}
778 
779 	/**
780 	 * Initializes @iter to the start of the given line. If @line_number is greater
781 	 * than the number of lines in the @buffer, the end iterator is returned.
782 	 *
783 	 * Params:
784 	 *     iter = iterator to initialize
785 	 *     lineNumber = line number counting from 0
786 	 */
787 	public void getIterAtLine(out TextIter iter, int lineNumber)
788 	{
789 		GtkTextIter* outiter = gMalloc!GtkTextIter();
790 		
791 		gtk_text_buffer_get_iter_at_line(gtkTextBuffer, outiter, lineNumber);
792 		
793 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
794 	}
795 
796 	/**
797 	 * Obtains an iterator pointing to @byte_index within the given line.
798 	 * @byte_index must be the start of a UTF-8 character. Note bytes, not
799 	 * characters; UTF-8 may encode one character as multiple bytes.
800 	 *
801 	 * Before the 3.20 version, it was not allowed to pass an invalid location.
802 	 *
803 	 * Since the 3.20 version, if @line_number is greater than the number of lines
804 	 * in the @buffer, the end iterator is returned. And if @byte_index is off the
805 	 * end of the line, the iterator at the end of the line is returned.
806 	 *
807 	 * Params:
808 	 *     iter = iterator to initialize
809 	 *     lineNumber = line number counting from 0
810 	 *     byteIndex = byte index from start of line
811 	 */
812 	public void getIterAtLineIndex(out TextIter iter, int lineNumber, int byteIndex)
813 	{
814 		GtkTextIter* outiter = gMalloc!GtkTextIter();
815 		
816 		gtk_text_buffer_get_iter_at_line_index(gtkTextBuffer, outiter, lineNumber, byteIndex);
817 		
818 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
819 	}
820 
821 	/**
822 	 * Obtains an iterator pointing to @char_offset within the given line. Note
823 	 * characters, not bytes; UTF-8 may encode one character as multiple bytes.
824 	 *
825 	 * Before the 3.20 version, it was not allowed to pass an invalid location.
826 	 *
827 	 * Since the 3.20 version, if @line_number is greater than the number of lines
828 	 * in the @buffer, the end iterator is returned. And if @char_offset is off the
829 	 * end of the line, the iterator at the end of the line is returned.
830 	 *
831 	 * Params:
832 	 *     iter = iterator to initialize
833 	 *     lineNumber = line number counting from 0
834 	 *     charOffset = char offset from start of line
835 	 */
836 	public void getIterAtLineOffset(out TextIter iter, int lineNumber, int charOffset)
837 	{
838 		GtkTextIter* outiter = gMalloc!GtkTextIter();
839 		
840 		gtk_text_buffer_get_iter_at_line_offset(gtkTextBuffer, outiter, lineNumber, charOffset);
841 		
842 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
843 	}
844 
845 	/**
846 	 * Initializes @iter with the current position of @mark.
847 	 *
848 	 * Params:
849 	 *     iter = iterator to initialize
850 	 *     mark = a #GtkTextMark in @buffer
851 	 */
852 	public void getIterAtMark(out TextIter iter, TextMark mark)
853 	{
854 		GtkTextIter* outiter = gMalloc!GtkTextIter();
855 		
856 		gtk_text_buffer_get_iter_at_mark(gtkTextBuffer, outiter, (mark is null) ? null : mark.getTextMarkStruct());
857 		
858 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
859 	}
860 
861 	/**
862 	 * Initializes @iter to a position @char_offset chars from the start
863 	 * of the entire buffer. If @char_offset is -1 or greater than the number
864 	 * of characters in the buffer, @iter is initialized to the end iterator,
865 	 * the iterator one past the last valid character in the buffer.
866 	 *
867 	 * Params:
868 	 *     iter = iterator to initialize
869 	 *     charOffset = char offset from start of buffer, counting from 0, or -1
870 	 */
871 	public void getIterAtOffset(out TextIter iter, int charOffset)
872 	{
873 		GtkTextIter* outiter = gMalloc!GtkTextIter();
874 		
875 		gtk_text_buffer_get_iter_at_offset(gtkTextBuffer, outiter, charOffset);
876 		
877 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
878 	}
879 
880 	/**
881 	 * Obtains the number of lines in the buffer. This value is cached, so
882 	 * the function is very fast.
883 	 *
884 	 * Returns: number of lines in the buffer
885 	 */
886 	public int getLineCount()
887 	{
888 		return gtk_text_buffer_get_line_count(gtkTextBuffer);
889 	}
890 
891 	/**
892 	 * Returns the mark named @name in buffer @buffer, or %NULL if no such
893 	 * mark exists in the buffer.
894 	 *
895 	 * Params:
896 	 *     name = a mark name
897 	 *
898 	 * Returns: a #GtkTextMark, or %NULL
899 	 */
900 	public TextMark getMark(string name)
901 	{
902 		auto p = gtk_text_buffer_get_mark(gtkTextBuffer, Str.toStringz(name));
903 		
904 		if(p is null)
905 		{
906 			return null;
907 		}
908 		
909 		return ObjectG.getDObject!(TextMark)(cast(GtkTextMark*) p);
910 	}
911 
912 	/**
913 	 * Indicates whether the buffer has been modified since the last call
914 	 * to gtk_text_buffer_set_modified() set the modification flag to
915 	 * %FALSE. Used for example to enable a “save” function in a text
916 	 * editor.
917 	 *
918 	 * Returns: %TRUE if the buffer has been modified
919 	 */
920 	public bool getModified()
921 	{
922 		return gtk_text_buffer_get_modified(gtkTextBuffer) != 0;
923 	}
924 
925 	/**
926 	 * This function returns the list of targets this text buffer supports
927 	 * for pasting and as DND destination. The targets in the list are
928 	 * added with @info values from the #GtkTextBufferTargetInfo enum,
929 	 * using gtk_target_list_add_rich_text_targets() and
930 	 * gtk_target_list_add_text_targets().
931 	 *
932 	 * Returns: the #GtkTargetList
933 	 *
934 	 * Since: 2.10
935 	 */
936 	public TargetList getPasteTargetList()
937 	{
938 		auto p = gtk_text_buffer_get_paste_target_list(gtkTextBuffer);
939 		
940 		if(p is null)
941 		{
942 			return null;
943 		}
944 		
945 		return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p);
946 	}
947 
948 	/**
949 	 * Returns the mark that represents the selection bound.  Equivalent
950 	 * to calling gtk_text_buffer_get_mark() to get the mark named
951 	 * “selection_bound”, but very slightly more efficient, and involves
952 	 * less typing.
953 	 *
954 	 * The currently-selected text in @buffer is the region between the
955 	 * “selection_bound” and “insert” marks. If “selection_bound” and
956 	 * “insert” are in the same place, then there is no current selection.
957 	 * gtk_text_buffer_get_selection_bounds() is another convenient function
958 	 * for handling the selection, if you just want to know whether there’s a
959 	 * selection and what its bounds are.
960 	 *
961 	 * Returns: selection bound mark
962 	 */
963 	public TextMark getSelectionBound()
964 	{
965 		auto p = gtk_text_buffer_get_selection_bound(gtkTextBuffer);
966 		
967 		if(p is null)
968 		{
969 			return null;
970 		}
971 		
972 		return ObjectG.getDObject!(TextMark)(cast(GtkTextMark*) p);
973 	}
974 
975 	/**
976 	 * Returns %TRUE if some text is selected; places the bounds
977 	 * of the selection in @start and @end (if the selection has length 0,
978 	 * then @start and @end are filled in with the same value).
979 	 * @start and @end will be in ascending order. If @start and @end are
980 	 * NULL, then they are not filled in, but the return value still indicates
981 	 * whether text is selected.
982 	 *
983 	 * Params:
984 	 *     start = iterator to initialize with selection start
985 	 *     end = iterator to initialize with selection end
986 	 *
987 	 * Returns: whether the selection has nonzero length
988 	 */
989 	public bool getSelectionBounds(out TextIter start, out TextIter end)
990 	{
991 		GtkTextIter* outstart = gMalloc!GtkTextIter();
992 		GtkTextIter* outend = gMalloc!GtkTextIter();
993 		
994 		auto p = gtk_text_buffer_get_selection_bounds(gtkTextBuffer, outstart, outend) != 0;
995 		
996 		start = ObjectG.getDObject!(TextIter)(outstart, true);
997 		end = ObjectG.getDObject!(TextIter)(outend, true);
998 		
999 		return p;
1000 	}
1001 
1002 	/**
1003 	 * This function returns the rich text serialize formats registered
1004 	 * with @buffer using gtk_text_buffer_register_serialize_format() or
1005 	 * gtk_text_buffer_register_serialize_tagset()
1006 	 *
1007 	 * Returns: an array of
1008 	 *     #GdkAtoms representing the registered formats.
1009 	 *
1010 	 * Since: 2.10
1011 	 */
1012 	public GdkAtom[] getSerializeFormats()
1013 	{
1014 		int nFormats;
1015 		
1016 		auto p = gtk_text_buffer_get_serialize_formats(gtkTextBuffer, &nFormats);
1017 		
1018 		return p[0 .. nFormats];
1019 	}
1020 
1021 	/**
1022 	 * Returns the text in the range [@start,@end). Excludes undisplayed
1023 	 * text (text marked with tags that set the invisibility attribute) if
1024 	 * @include_hidden_chars is %FALSE. The returned string includes a
1025 	 * 0xFFFC character whenever the buffer contains
1026 	 * embedded images, so byte and character indexes into
1027 	 * the returned string do correspond to byte
1028 	 * and character indexes into the buffer. Contrast with
1029 	 * gtk_text_buffer_get_text(). Note that 0xFFFC can occur in normal
1030 	 * text as well, so it is not a reliable indicator that a pixbuf or
1031 	 * widget is in the buffer.
1032 	 *
1033 	 * Params:
1034 	 *     start = start of a range
1035 	 *     end = end of a range
1036 	 *     includeHiddenChars = whether to include invisible text
1037 	 *
1038 	 * Returns: an allocated UTF-8 string
1039 	 */
1040 	public string getSlice(TextIter start, TextIter end, bool includeHiddenChars)
1041 	{
1042 		auto retStr = gtk_text_buffer_get_slice(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), includeHiddenChars);
1043 		
1044 		scope(exit) Str.freeString(retStr);
1045 		return Str.toString(retStr);
1046 	}
1047 
1048 	/**
1049 	 * Initialized @iter with the first position in the text buffer. This
1050 	 * is the same as using gtk_text_buffer_get_iter_at_offset() to get
1051 	 * the iter at character offset 0.
1052 	 *
1053 	 * Params:
1054 	 *     iter = iterator to initialize
1055 	 */
1056 	public void getStartIter(out TextIter iter)
1057 	{
1058 		GtkTextIter* outiter = gMalloc!GtkTextIter();
1059 		
1060 		gtk_text_buffer_get_start_iter(gtkTextBuffer, outiter);
1061 		
1062 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
1063 	}
1064 
1065 	/**
1066 	 * Get the #GtkTextTagTable associated with this buffer.
1067 	 *
1068 	 * Returns: the buffer’s tag table
1069 	 */
1070 	public TextTagTable getTagTable()
1071 	{
1072 		auto p = gtk_text_buffer_get_tag_table(gtkTextBuffer);
1073 		
1074 		if(p is null)
1075 		{
1076 			return null;
1077 		}
1078 		
1079 		return ObjectG.getDObject!(TextTagTable)(cast(GtkTextTagTable*) p);
1080 	}
1081 
1082 	/**
1083 	 * Returns the text in the range [@start,@end). Excludes undisplayed
1084 	 * text (text marked with tags that set the invisibility attribute) if
1085 	 * @include_hidden_chars is %FALSE. Does not include characters
1086 	 * representing embedded images, so byte and character indexes into
1087 	 * the returned string do not correspond to byte
1088 	 * and character indexes into the buffer. Contrast with
1089 	 * gtk_text_buffer_get_slice().
1090 	 *
1091 	 * Params:
1092 	 *     start = start of a range
1093 	 *     end = end of a range
1094 	 *     includeHiddenChars = whether to include invisible text
1095 	 *
1096 	 * Returns: an allocated UTF-8 string
1097 	 */
1098 	public string getText(TextIter start, TextIter end, bool includeHiddenChars)
1099 	{
1100 		auto retStr = gtk_text_buffer_get_text(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), includeHiddenChars);
1101 		
1102 		scope(exit) Str.freeString(retStr);
1103 		return Str.toString(retStr);
1104 	}
1105 
1106 	/**
1107 	 * Inserts @len bytes of @text at position @iter.  If @len is -1,
1108 	 * @text must be nul-terminated and will be inserted in its
1109 	 * entirety. Emits the “insert-text” signal; insertion actually occurs
1110 	 * in the default handler for the signal. @iter is invalidated when
1111 	 * insertion occurs (because the buffer contents change), but the
1112 	 * default signal handler revalidates it to point to the end of the
1113 	 * inserted text.
1114 	 *
1115 	 * Params:
1116 	 *     iter = a position in the buffer
1117 	 *     text = text in UTF-8 format
1118 	 *     len = length of text in bytes, or -1
1119 	 */
1120 	public void insert(TextIter iter, string text)
1121 	{
1122 		gtk_text_buffer_insert(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), cast(int)text.length);
1123 	}
1124 
1125 	/**
1126 	 * Simply calls gtk_text_buffer_insert(), using the current
1127 	 * cursor position as the insertion point.
1128 	 *
1129 	 * Params:
1130 	 *     text = text in UTF-8 format
1131 	 *     len = length of text, in bytes
1132 	 */
1133 	public void insertAtCursor(string text)
1134 	{
1135 		gtk_text_buffer_insert_at_cursor(gtkTextBuffer, Str.toStringz(text), cast(int)text.length);
1136 	}
1137 
1138 	/**
1139 	 * Inserts a child widget anchor into the text buffer at @iter. The
1140 	 * anchor will be counted as one character in character counts, and
1141 	 * when obtaining the buffer contents as a string, will be represented
1142 	 * by the Unicode “object replacement character” 0xFFFC. Note that the
1143 	 * “slice” variants for obtaining portions of the buffer as a string
1144 	 * include this character for child anchors, but the “text” variants do
1145 	 * not. E.g. see gtk_text_buffer_get_slice() and
1146 	 * gtk_text_buffer_get_text(). Consider
1147 	 * gtk_text_buffer_create_child_anchor() as a more convenient
1148 	 * alternative to this function. The buffer will add a reference to
1149 	 * the anchor, so you can unref it after insertion.
1150 	 *
1151 	 * Params:
1152 	 *     iter = location to insert the anchor
1153 	 *     anchor = a #GtkTextChildAnchor
1154 	 */
1155 	public void insertChildAnchor(TextIter iter, TextChildAnchor anchor)
1156 	{
1157 		gtk_text_buffer_insert_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
1158 	}
1159 
1160 	/**
1161 	 * Like gtk_text_buffer_insert(), but the insertion will not occur if
1162 	 * @iter is at a non-editable location in the buffer. Usually you
1163 	 * want to prevent insertions at ineditable locations if the insertion
1164 	 * results from a user action (is interactive).
1165 	 *
1166 	 * @default_editable indicates the editability of text that doesn't
1167 	 * have a tag affecting editability applied to it. Typically the
1168 	 * result of gtk_text_view_get_editable() is appropriate here.
1169 	 *
1170 	 * Params:
1171 	 *     iter = a position in @buffer
1172 	 *     text = some UTF-8 text
1173 	 *     len = length of text in bytes, or -1
1174 	 *     defaultEditable = default editability of buffer
1175 	 *
1176 	 * Returns: whether text was actually inserted
1177 	 */
1178 	public bool insertInteractive(TextIter iter, string text, bool defaultEditable)
1179 	{
1180 		return gtk_text_buffer_insert_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), cast(int)text.length, defaultEditable) != 0;
1181 	}
1182 
1183 	/**
1184 	 * Calls gtk_text_buffer_insert_interactive() at the cursor
1185 	 * position.
1186 	 *
1187 	 * @default_editable indicates the editability of text that doesn't
1188 	 * have a tag affecting editability applied to it. Typically the
1189 	 * result of gtk_text_view_get_editable() is appropriate here.
1190 	 *
1191 	 * Params:
1192 	 *     text = text in UTF-8 format
1193 	 *     len = length of text in bytes, or -1
1194 	 *     defaultEditable = default editability of buffer
1195 	 *
1196 	 * Returns: whether text was actually inserted
1197 	 */
1198 	public bool insertInteractiveAtCursor(string text, bool defaultEditable)
1199 	{
1200 		return gtk_text_buffer_insert_interactive_at_cursor(gtkTextBuffer, Str.toStringz(text), cast(int)text.length, defaultEditable) != 0;
1201 	}
1202 
1203 	/**
1204 	 * Inserts the text in @markup at position @iter. @markup will be inserted
1205 	 * in its entirety and must be nul-terminated and valid UTF-8. Emits the
1206 	 * #GtkTextBuffer::insert-text signal, possibly multiple times; insertion
1207 	 * actually occurs in the default handler for the signal. @iter will point
1208 	 * to the end of the inserted text on return.
1209 	 *
1210 	 * Params:
1211 	 *     iter = location to insert the markup
1212 	 *     markup = a nul-terminated UTF-8 string containing [Pango markup][PangoMarkupFormat]
1213 	 *     len = length of @markup in bytes, or -1
1214 	 *
1215 	 * Since: 3.16
1216 	 */
1217 	public void insertMarkup(TextIter iter, string markup, int len)
1218 	{
1219 		gtk_text_buffer_insert_markup(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(markup), len);
1220 	}
1221 
1222 	/**
1223 	 * Inserts an image into the text buffer at @iter. The image will be
1224 	 * counted as one character in character counts, and when obtaining
1225 	 * the buffer contents as a string, will be represented by the Unicode
1226 	 * “object replacement character” 0xFFFC. Note that the “slice”
1227 	 * variants for obtaining portions of the buffer as a string include
1228 	 * this character for pixbufs, but the “text” variants do
1229 	 * not. e.g. see gtk_text_buffer_get_slice() and
1230 	 * gtk_text_buffer_get_text().
1231 	 *
1232 	 * Params:
1233 	 *     iter = location to insert the pixbuf
1234 	 *     pixbuf = a #GdkPixbuf
1235 	 */
1236 	public void insertPixbuf(TextIter iter, Pixbuf pixbuf)
1237 	{
1238 		gtk_text_buffer_insert_pixbuf(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
1239 	}
1240 
1241 	/**
1242 	 * Copies text, tags, and pixbufs between @start and @end (the order
1243 	 * of @start and @end doesn’t matter) and inserts the copy at @iter.
1244 	 * Used instead of simply getting/inserting text because it preserves
1245 	 * images and tags. If @start and @end are in a different buffer from
1246 	 * @buffer, the two buffers must share the same tag table.
1247 	 *
1248 	 * Implemented via emissions of the insert_text and apply_tag signals,
1249 	 * so expect those.
1250 	 *
1251 	 * Params:
1252 	 *     iter = a position in @buffer
1253 	 *     start = a position in a #GtkTextBuffer
1254 	 *     end = another position in the same buffer as @start
1255 	 */
1256 	public void insertRange(TextIter iter, TextIter start, TextIter end)
1257 	{
1258 		gtk_text_buffer_insert_range(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1259 	}
1260 
1261 	/**
1262 	 * Same as gtk_text_buffer_insert_range(), but does nothing if the
1263 	 * insertion point isn’t editable. The @default_editable parameter
1264 	 * indicates whether the text is editable at @iter if no tags
1265 	 * enclosing @iter affect editability. Typically the result of
1266 	 * gtk_text_view_get_editable() is appropriate here.
1267 	 *
1268 	 * Params:
1269 	 *     iter = a position in @buffer
1270 	 *     start = a position in a #GtkTextBuffer
1271 	 *     end = another position in the same buffer as @start
1272 	 *     defaultEditable = default editability of the buffer
1273 	 *
1274 	 * Returns: whether an insertion was possible at @iter
1275 	 */
1276 	public bool insertRangeInteractive(TextIter iter, TextIter start, TextIter end, bool defaultEditable)
1277 	{
1278 		return gtk_text_buffer_insert_range_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), defaultEditable) != 0;
1279 	}
1280 
1281 	/**
1282 	 * Moves @mark to the new location @where. Emits the #GtkTextBuffer::mark-set
1283 	 * signal as notification of the move.
1284 	 *
1285 	 * Params:
1286 	 *     mark = a #GtkTextMark
1287 	 *     where = new location for @mark in @buffer
1288 	 */
1289 	public void moveMark(TextMark mark, TextIter where)
1290 	{
1291 		gtk_text_buffer_move_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct(), (where is null) ? null : where.getTextIterStruct());
1292 	}
1293 
1294 	/**
1295 	 * Moves the mark named @name (which must exist) to location @where.
1296 	 * See gtk_text_buffer_move_mark() for details.
1297 	 *
1298 	 * Params:
1299 	 *     name = name of a mark
1300 	 *     where = new location for mark
1301 	 */
1302 	public void moveMarkByName(string name, TextIter where)
1303 	{
1304 		gtk_text_buffer_move_mark_by_name(gtkTextBuffer, Str.toStringz(name), (where is null) ? null : where.getTextIterStruct());
1305 	}
1306 
1307 	/**
1308 	 * Pastes the contents of a clipboard. If @override_location is %NULL, the
1309 	 * pasted text will be inserted at the cursor position, or the buffer selection
1310 	 * will be replaced if the selection is non-empty.
1311 	 *
1312 	 * Note: pasting is asynchronous, that is, we’ll ask for the paste data and
1313 	 * return, and at some point later after the main loop runs, the paste data will
1314 	 * be inserted.
1315 	 *
1316 	 * Params:
1317 	 *     clipboard = the #GtkClipboard to paste from
1318 	 *     overrideLocation = location to insert pasted text, or %NULL
1319 	 *     defaultEditable = whether the buffer is editable by default
1320 	 */
1321 	public void pasteClipboard(Clipboard clipboard, TextIter overrideLocation, bool defaultEditable)
1322 	{
1323 		gtk_text_buffer_paste_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), (overrideLocation is null) ? null : overrideLocation.getTextIterStruct(), defaultEditable);
1324 	}
1325 
1326 	/**
1327 	 * This function moves the “insert” and “selection_bound” marks
1328 	 * simultaneously.  If you move them to the same place in two steps
1329 	 * with gtk_text_buffer_move_mark(), you will temporarily select a
1330 	 * region in between their old and new locations, which can be pretty
1331 	 * inefficient since the temporarily-selected region will force stuff
1332 	 * to be recalculated. This function moves them as a unit, which can
1333 	 * be optimized.
1334 	 *
1335 	 * Params:
1336 	 *     where = where to put the cursor
1337 	 */
1338 	public void placeCursor(TextIter where)
1339 	{
1340 		gtk_text_buffer_place_cursor(gtkTextBuffer, (where is null) ? null : where.getTextIterStruct());
1341 	}
1342 
1343 	/**
1344 	 * This function registers a rich text deserialization @function along with
1345 	 * its @mime_type with the passed @buffer.
1346 	 *
1347 	 * Params:
1348 	 *     mimeType = the format’s mime-type
1349 	 *     funct = the deserialize function to register
1350 	 *     userData = @function’s user_data
1351 	 *     userDataDestroy = a function to call when @user_data is no longer needed
1352 	 *
1353 	 * Returns: the #GdkAtom that corresponds to the
1354 	 *     newly registered format’s mime-type.
1355 	 *
1356 	 * Since: 2.10
1357 	 */
1358 	public GdkAtom registerDeserializeFormat(string mimeType, GtkTextBufferDeserializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
1359 	{
1360 		return gtk_text_buffer_register_deserialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
1361 	}
1362 
1363 	/**
1364 	 * This function registers GTK+’s internal rich text serialization
1365 	 * format with the passed @buffer. See
1366 	 * gtk_text_buffer_register_serialize_tagset() for details.
1367 	 *
1368 	 * Params:
1369 	 *     tagsetName = an optional tagset name, on %NULL
1370 	 *
1371 	 * Returns: the #GdkAtom that corresponds to the
1372 	 *     newly registered format’s mime-type.
1373 	 *
1374 	 * Since: 2.10
1375 	 */
1376 	public GdkAtom registerDeserializeTagset(string tagsetName)
1377 	{
1378 		return gtk_text_buffer_register_deserialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
1379 	}
1380 
1381 	/**
1382 	 * This function registers a rich text serialization @function along with
1383 	 * its @mime_type with the passed @buffer.
1384 	 *
1385 	 * Params:
1386 	 *     mimeType = the format’s mime-type
1387 	 *     funct = the serialize function to register
1388 	 *     userData = @function’s user_data
1389 	 *     userDataDestroy = a function to call when @user_data is no longer needed
1390 	 *
1391 	 * Returns: the #GdkAtom that corresponds to the
1392 	 *     newly registered format’s mime-type.
1393 	 *
1394 	 * Since: 2.10
1395 	 */
1396 	public GdkAtom registerSerializeFormat(string mimeType, GtkTextBufferSerializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
1397 	{
1398 		return gtk_text_buffer_register_serialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
1399 	}
1400 
1401 	/**
1402 	 * This function registers GTK+’s internal rich text serialization
1403 	 * format with the passed @buffer. The internal format does not comply
1404 	 * to any standard rich text format and only works between #GtkTextBuffer
1405 	 * instances. It is capable of serializing all of a text buffer’s tags
1406 	 * and embedded pixbufs.
1407 	 *
1408 	 * This function is just a wrapper around
1409 	 * gtk_text_buffer_register_serialize_format(). The mime type used
1410 	 * for registering is “application/x-gtk-text-buffer-rich-text”, or
1411 	 * “application/x-gtk-text-buffer-rich-text;format=@tagset_name” if a
1412 	 * @tagset_name was passed.
1413 	 *
1414 	 * The @tagset_name can be used to restrict the transfer of rich text
1415 	 * to buffers with compatible sets of tags, in order to avoid unknown
1416 	 * tags from being pasted. It is probably the common case to pass an
1417 	 * identifier != %NULL here, since the %NULL tagset requires the
1418 	 * receiving buffer to deal with with pasting of arbitrary tags.
1419 	 *
1420 	 * Params:
1421 	 *     tagsetName = an optional tagset name, on %NULL
1422 	 *
1423 	 * Returns: the #GdkAtom that corresponds to the
1424 	 *     newly registered format’s mime-type.
1425 	 *
1426 	 * Since: 2.10
1427 	 */
1428 	public GdkAtom registerSerializeTagset(string tagsetName)
1429 	{
1430 		return gtk_text_buffer_register_serialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
1431 	}
1432 
1433 	/**
1434 	 * Removes all tags in the range between @start and @end.  Be careful
1435 	 * with this function; it could remove tags added in code unrelated to
1436 	 * the code you’re currently writing. That is, using this function is
1437 	 * probably a bad idea if you have two or more unrelated code sections
1438 	 * that add tags.
1439 	 *
1440 	 * Params:
1441 	 *     start = one bound of range to be untagged
1442 	 *     end = other bound of range to be untagged
1443 	 */
1444 	public void removeAllTags(TextIter start, TextIter end)
1445 	{
1446 		gtk_text_buffer_remove_all_tags(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1447 	}
1448 
1449 	/**
1450 	 * Removes a #GtkClipboard added with
1451 	 * gtk_text_buffer_add_selection_clipboard().
1452 	 *
1453 	 * Params:
1454 	 *     clipboard = a #GtkClipboard added to @buffer by
1455 	 *         gtk_text_buffer_add_selection_clipboard()
1456 	 */
1457 	public void removeSelectionClipboard(Clipboard clipboard)
1458 	{
1459 		gtk_text_buffer_remove_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
1460 	}
1461 
1462 	/**
1463 	 * Emits the “remove-tag” signal. The default handler for the signal
1464 	 * removes all occurrences of @tag from the given range. @start and
1465 	 * @end don’t have to be in order.
1466 	 *
1467 	 * Params:
1468 	 *     tag = a #GtkTextTag
1469 	 *     start = one bound of range to be untagged
1470 	 *     end = other bound of range to be untagged
1471 	 */
1472 	public void removeTag(TextTag tag, TextIter start, TextIter end)
1473 	{
1474 		gtk_text_buffer_remove_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1475 	}
1476 
1477 	/**
1478 	 * Calls gtk_text_tag_table_lookup() on the buffer’s tag table to
1479 	 * get a #GtkTextTag, then calls gtk_text_buffer_remove_tag().
1480 	 *
1481 	 * Params:
1482 	 *     name = name of a #GtkTextTag
1483 	 *     start = one bound of range to be untagged
1484 	 *     end = other bound of range to be untagged
1485 	 */
1486 	public void removeTagByName(string name, TextIter start, TextIter end)
1487 	{
1488 		gtk_text_buffer_remove_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1489 	}
1490 
1491 	/**
1492 	 * This function moves the “insert” and “selection_bound” marks
1493 	 * simultaneously.  If you move them in two steps
1494 	 * with gtk_text_buffer_move_mark(), you will temporarily select a
1495 	 * region in between their old and new locations, which can be pretty
1496 	 * inefficient since the temporarily-selected region will force stuff
1497 	 * to be recalculated. This function moves them as a unit, which can
1498 	 * be optimized.
1499 	 *
1500 	 * Params:
1501 	 *     ins = where to put the “insert” mark
1502 	 *     bound = where to put the “selection_bound” mark
1503 	 *
1504 	 * Since: 2.4
1505 	 */
1506 	public void selectRange(TextIter ins, TextIter bound)
1507 	{
1508 		gtk_text_buffer_select_range(gtkTextBuffer, (ins is null) ? null : ins.getTextIterStruct(), (bound is null) ? null : bound.getTextIterStruct());
1509 	}
1510 
1511 	/**
1512 	 * This function serializes the portion of text between @start
1513 	 * and @end in the rich text format represented by @format.
1514 	 *
1515 	 * @formats to be used must be registered using
1516 	 * gtk_text_buffer_register_serialize_format() or
1517 	 * gtk_text_buffer_register_serialize_tagset() beforehand.
1518 	 *
1519 	 * Params:
1520 	 *     contentBuffer = the #GtkTextBuffer to serialize
1521 	 *     format = the rich text format to use for serializing
1522 	 *     start = start of block of text to serialize
1523 	 *     end = end of block of test to serialize
1524 	 *
1525 	 * Returns: the serialized
1526 	 *     data, encoded as @format
1527 	 *
1528 	 * Since: 2.10
1529 	 */
1530 	public ubyte[] serialize(TextBuffer contentBuffer, GdkAtom format, TextIter start, TextIter end)
1531 	{
1532 		size_t length;
1533 		
1534 		auto p = gtk_text_buffer_serialize(gtkTextBuffer, (contentBuffer is null) ? null : contentBuffer.getTextBufferStruct(), format, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), &length);
1535 		
1536 		return p[0 .. length];
1537 	}
1538 
1539 	/**
1540 	 * Used to keep track of whether the buffer has been modified since the
1541 	 * last time it was saved. Whenever the buffer is saved to disk, call
1542 	 * gtk_text_buffer_set_modified (@buffer, FALSE). When the buffer is modified,
1543 	 * it will automatically toggled on the modified bit again. When the modified
1544 	 * bit flips, the buffer emits the #GtkTextBuffer::modified-changed signal.
1545 	 *
1546 	 * Params:
1547 	 *     setting = modification flag setting
1548 	 */
1549 	public void setModified(bool setting)
1550 	{
1551 		gtk_text_buffer_set_modified(gtkTextBuffer, setting);
1552 	}
1553 
1554 	/**
1555 	 * Deletes current contents of @buffer, and inserts @text instead. If
1556 	 * @len is -1, @text must be nul-terminated. @text must be valid UTF-8.
1557 	 *
1558 	 * Params:
1559 	 *     text = UTF-8 text to insert
1560 	 *     len = length of @text in bytes
1561 	 */
1562 	public void setText(string text)
1563 	{
1564 		gtk_text_buffer_set_text(gtkTextBuffer, Str.toStringz(text), cast(int)text.length);
1565 	}
1566 
1567 	/**
1568 	 * This function unregisters a rich text format that was previously
1569 	 * registered using gtk_text_buffer_register_deserialize_format() or
1570 	 * gtk_text_buffer_register_deserialize_tagset().
1571 	 *
1572 	 * Params:
1573 	 *     format = a #GdkAtom representing a registered rich text format.
1574 	 *
1575 	 * Since: 2.10
1576 	 */
1577 	public void unregisterDeserializeFormat(GdkAtom format)
1578 	{
1579 		gtk_text_buffer_unregister_deserialize_format(gtkTextBuffer, format);
1580 	}
1581 
1582 	/**
1583 	 * This function unregisters a rich text format that was previously
1584 	 * registered using gtk_text_buffer_register_serialize_format() or
1585 	 * gtk_text_buffer_register_serialize_tagset()
1586 	 *
1587 	 * Params:
1588 	 *     format = a #GdkAtom representing a registered rich text format.
1589 	 *
1590 	 * Since: 2.10
1591 	 */
1592 	public void unregisterSerializeFormat(GdkAtom format)
1593 	{
1594 		gtk_text_buffer_unregister_serialize_format(gtkTextBuffer, format);
1595 	}
1596 
1597 	protected class OnApplyTagDelegateWrapper
1598 	{
1599 		static OnApplyTagDelegateWrapper[] listeners;
1600 		void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg;
1601 		gulong handlerId;
1602 		
1603 		this(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg)
1604 		{
1605 			this.dlg = dlg;
1606 			this.listeners ~= this;
1607 		}
1608 		
1609 		void remove(OnApplyTagDelegateWrapper source)
1610 		{
1611 			foreach(index, wrapper; listeners)
1612 			{
1613 				if (wrapper.handlerId == source.handlerId)
1614 				{
1615 					listeners[index] = null;
1616 					listeners = std.algorithm.remove(listeners, index);
1617 					break;
1618 				}
1619 			}
1620 		}
1621 	}
1622 
1623 	/**
1624 	 * The ::apply-tag signal is emitted to apply a tag to a
1625 	 * range of text in a #GtkTextBuffer.
1626 	 * Applying actually occurs in the default handler.
1627 	 *
1628 	 * Note that if your handler runs before the default handler it must not
1629 	 * invalidate the @start and @end iters (or has to revalidate them).
1630 	 *
1631 	 * See also:
1632 	 * gtk_text_buffer_apply_tag(),
1633 	 * gtk_text_buffer_insert_with_tags(),
1634 	 * gtk_text_buffer_insert_range().
1635 	 *
1636 	 * Params:
1637 	 *     tag = the applied tag
1638 	 *     start = the start of the range the tag is applied to
1639 	 *     end = the end of the range the tag is applied to
1640 	 */
1641 	gulong addOnApplyTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1642 	{
1643 		auto wrapper = new OnApplyTagDelegateWrapper(dlg);
1644 		wrapper.handlerId = Signals.connectData(
1645 			this,
1646 			"apply-tag",
1647 			cast(GCallback)&callBackApplyTag,
1648 			cast(void*)wrapper,
1649 			cast(GClosureNotify)&callBackApplyTagDestroy,
1650 			connectFlags);
1651 		return wrapper.handlerId;
1652 	}
1653 	
1654 	extern(C) static void callBackApplyTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, OnApplyTagDelegateWrapper wrapper)
1655 	{
1656 		wrapper.dlg(ObjectG.getDObject!(TextTag)(tag), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
1657 	}
1658 	
1659 	extern(C) static void callBackApplyTagDestroy(OnApplyTagDelegateWrapper wrapper, GClosure* closure)
1660 	{
1661 		wrapper.remove(wrapper);
1662 	}
1663 
1664 	protected class OnBeginUserActionDelegateWrapper
1665 	{
1666 		static OnBeginUserActionDelegateWrapper[] listeners;
1667 		void delegate(TextBuffer) dlg;
1668 		gulong handlerId;
1669 		
1670 		this(void delegate(TextBuffer) dlg)
1671 		{
1672 			this.dlg = dlg;
1673 			this.listeners ~= this;
1674 		}
1675 		
1676 		void remove(OnBeginUserActionDelegateWrapper source)
1677 		{
1678 			foreach(index, wrapper; listeners)
1679 			{
1680 				if (wrapper.handlerId == source.handlerId)
1681 				{
1682 					listeners[index] = null;
1683 					listeners = std.algorithm.remove(listeners, index);
1684 					break;
1685 				}
1686 			}
1687 		}
1688 	}
1689 
1690 	/**
1691 	 * The ::begin-user-action signal is emitted at the beginning of a single
1692 	 * user-visible operation on a #GtkTextBuffer.
1693 	 *
1694 	 * See also:
1695 	 * gtk_text_buffer_begin_user_action(),
1696 	 * gtk_text_buffer_insert_interactive(),
1697 	 * gtk_text_buffer_insert_range_interactive(),
1698 	 * gtk_text_buffer_delete_interactive(),
1699 	 * gtk_text_buffer_backspace(),
1700 	 * gtk_text_buffer_delete_selection().
1701 	 */
1702 	gulong addOnBeginUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1703 	{
1704 		auto wrapper = new OnBeginUserActionDelegateWrapper(dlg);
1705 		wrapper.handlerId = Signals.connectData(
1706 			this,
1707 			"begin-user-action",
1708 			cast(GCallback)&callBackBeginUserAction,
1709 			cast(void*)wrapper,
1710 			cast(GClosureNotify)&callBackBeginUserActionDestroy,
1711 			connectFlags);
1712 		return wrapper.handlerId;
1713 	}
1714 	
1715 	extern(C) static void callBackBeginUserAction(GtkTextBuffer* textbufferStruct, OnBeginUserActionDelegateWrapper wrapper)
1716 	{
1717 		wrapper.dlg(wrapper.outer);
1718 	}
1719 	
1720 	extern(C) static void callBackBeginUserActionDestroy(OnBeginUserActionDelegateWrapper wrapper, GClosure* closure)
1721 	{
1722 		wrapper.remove(wrapper);
1723 	}
1724 
1725 	protected class OnChangedDelegateWrapper
1726 	{
1727 		static OnChangedDelegateWrapper[] listeners;
1728 		void delegate(TextBuffer) dlg;
1729 		gulong handlerId;
1730 		
1731 		this(void delegate(TextBuffer) dlg)
1732 		{
1733 			this.dlg = dlg;
1734 			this.listeners ~= this;
1735 		}
1736 		
1737 		void remove(OnChangedDelegateWrapper source)
1738 		{
1739 			foreach(index, wrapper; listeners)
1740 			{
1741 				if (wrapper.handlerId == source.handlerId)
1742 				{
1743 					listeners[index] = null;
1744 					listeners = std.algorithm.remove(listeners, index);
1745 					break;
1746 				}
1747 			}
1748 		}
1749 	}
1750 
1751 	/**
1752 	 * The ::changed signal is emitted when the content of a #GtkTextBuffer
1753 	 * has changed.
1754 	 */
1755 	gulong addOnChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1756 	{
1757 		auto wrapper = new OnChangedDelegateWrapper(dlg);
1758 		wrapper.handlerId = Signals.connectData(
1759 			this,
1760 			"changed",
1761 			cast(GCallback)&callBackChanged,
1762 			cast(void*)wrapper,
1763 			cast(GClosureNotify)&callBackChangedDestroy,
1764 			connectFlags);
1765 		return wrapper.handlerId;
1766 	}
1767 	
1768 	extern(C) static void callBackChanged(GtkTextBuffer* textbufferStruct, OnChangedDelegateWrapper wrapper)
1769 	{
1770 		wrapper.dlg(wrapper.outer);
1771 	}
1772 	
1773 	extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
1774 	{
1775 		wrapper.remove(wrapper);
1776 	}
1777 
1778 	protected class OnDeleteRangeDelegateWrapper
1779 	{
1780 		static OnDeleteRangeDelegateWrapper[] listeners;
1781 		void delegate(TextIter, TextIter, TextBuffer) dlg;
1782 		gulong handlerId;
1783 		
1784 		this(void delegate(TextIter, TextIter, TextBuffer) dlg)
1785 		{
1786 			this.dlg = dlg;
1787 			this.listeners ~= this;
1788 		}
1789 		
1790 		void remove(OnDeleteRangeDelegateWrapper source)
1791 		{
1792 			foreach(index, wrapper; listeners)
1793 			{
1794 				if (wrapper.handlerId == source.handlerId)
1795 				{
1796 					listeners[index] = null;
1797 					listeners = std.algorithm.remove(listeners, index);
1798 					break;
1799 				}
1800 			}
1801 		}
1802 	}
1803 
1804 	/**
1805 	 * The ::delete-range signal is emitted to delete a range
1806 	 * from a #GtkTextBuffer.
1807 	 *
1808 	 * Note that if your handler runs before the default handler it must not
1809 	 * invalidate the @start and @end iters (or has to revalidate them).
1810 	 * The default signal handler revalidates the @start and @end iters to
1811 	 * both point to the location where text was deleted. Handlers
1812 	 * which run after the default handler (see g_signal_connect_after())
1813 	 * do not have access to the deleted text.
1814 	 *
1815 	 * See also: gtk_text_buffer_delete().
1816 	 *
1817 	 * Params:
1818 	 *     start = the start of the range to be deleted
1819 	 *     end = the end of the range to be deleted
1820 	 */
1821 	gulong addOnDeleteRange(void delegate(TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1822 	{
1823 		auto wrapper = new OnDeleteRangeDelegateWrapper(dlg);
1824 		wrapper.handlerId = Signals.connectData(
1825 			this,
1826 			"delete-range",
1827 			cast(GCallback)&callBackDeleteRange,
1828 			cast(void*)wrapper,
1829 			cast(GClosureNotify)&callBackDeleteRangeDestroy,
1830 			connectFlags);
1831 		return wrapper.handlerId;
1832 	}
1833 	
1834 	extern(C) static void callBackDeleteRange(GtkTextBuffer* textbufferStruct, GtkTextIter* start, GtkTextIter* end, OnDeleteRangeDelegateWrapper wrapper)
1835 	{
1836 		wrapper.dlg(ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
1837 	}
1838 	
1839 	extern(C) static void callBackDeleteRangeDestroy(OnDeleteRangeDelegateWrapper wrapper, GClosure* closure)
1840 	{
1841 		wrapper.remove(wrapper);
1842 	}
1843 
1844 	protected class OnEndUserActionDelegateWrapper
1845 	{
1846 		static OnEndUserActionDelegateWrapper[] listeners;
1847 		void delegate(TextBuffer) dlg;
1848 		gulong handlerId;
1849 		
1850 		this(void delegate(TextBuffer) dlg)
1851 		{
1852 			this.dlg = dlg;
1853 			this.listeners ~= this;
1854 		}
1855 		
1856 		void remove(OnEndUserActionDelegateWrapper source)
1857 		{
1858 			foreach(index, wrapper; listeners)
1859 			{
1860 				if (wrapper.handlerId == source.handlerId)
1861 				{
1862 					listeners[index] = null;
1863 					listeners = std.algorithm.remove(listeners, index);
1864 					break;
1865 				}
1866 			}
1867 		}
1868 	}
1869 
1870 	/**
1871 	 * The ::end-user-action signal is emitted at the end of a single
1872 	 * user-visible operation on the #GtkTextBuffer.
1873 	 *
1874 	 * See also:
1875 	 * gtk_text_buffer_end_user_action(),
1876 	 * gtk_text_buffer_insert_interactive(),
1877 	 * gtk_text_buffer_insert_range_interactive(),
1878 	 * gtk_text_buffer_delete_interactive(),
1879 	 * gtk_text_buffer_backspace(),
1880 	 * gtk_text_buffer_delete_selection(),
1881 	 * gtk_text_buffer_backspace().
1882 	 */
1883 	gulong addOnEndUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1884 	{
1885 		auto wrapper = new OnEndUserActionDelegateWrapper(dlg);
1886 		wrapper.handlerId = Signals.connectData(
1887 			this,
1888 			"end-user-action",
1889 			cast(GCallback)&callBackEndUserAction,
1890 			cast(void*)wrapper,
1891 			cast(GClosureNotify)&callBackEndUserActionDestroy,
1892 			connectFlags);
1893 		return wrapper.handlerId;
1894 	}
1895 	
1896 	extern(C) static void callBackEndUserAction(GtkTextBuffer* textbufferStruct, OnEndUserActionDelegateWrapper wrapper)
1897 	{
1898 		wrapper.dlg(wrapper.outer);
1899 	}
1900 	
1901 	extern(C) static void callBackEndUserActionDestroy(OnEndUserActionDelegateWrapper wrapper, GClosure* closure)
1902 	{
1903 		wrapper.remove(wrapper);
1904 	}
1905 
1906 	protected class OnInsertChildAnchorDelegateWrapper
1907 	{
1908 		static OnInsertChildAnchorDelegateWrapper[] listeners;
1909 		void delegate(TextIter, TextChildAnchor, TextBuffer) dlg;
1910 		gulong handlerId;
1911 		
1912 		this(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg)
1913 		{
1914 			this.dlg = dlg;
1915 			this.listeners ~= this;
1916 		}
1917 		
1918 		void remove(OnInsertChildAnchorDelegateWrapper source)
1919 		{
1920 			foreach(index, wrapper; listeners)
1921 			{
1922 				if (wrapper.handlerId == source.handlerId)
1923 				{
1924 					listeners[index] = null;
1925 					listeners = std.algorithm.remove(listeners, index);
1926 					break;
1927 				}
1928 			}
1929 		}
1930 	}
1931 
1932 	/**
1933 	 * The ::insert-child-anchor signal is emitted to insert a
1934 	 * #GtkTextChildAnchor in a #GtkTextBuffer.
1935 	 * Insertion actually occurs in the default handler.
1936 	 *
1937 	 * Note that if your handler runs before the default handler it must
1938 	 * not invalidate the @location iter (or has to revalidate it).
1939 	 * The default signal handler revalidates it to be placed after the
1940 	 * inserted @anchor.
1941 	 *
1942 	 * See also: gtk_text_buffer_insert_child_anchor().
1943 	 *
1944 	 * Params:
1945 	 *     location = position to insert @anchor in @textbuffer
1946 	 *     anchor = the #GtkTextChildAnchor to be inserted
1947 	 */
1948 	gulong addOnInsertChildAnchor(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1949 	{
1950 		auto wrapper = new OnInsertChildAnchorDelegateWrapper(dlg);
1951 		wrapper.handlerId = Signals.connectData(
1952 			this,
1953 			"insert-child-anchor",
1954 			cast(GCallback)&callBackInsertChildAnchor,
1955 			cast(void*)wrapper,
1956 			cast(GClosureNotify)&callBackInsertChildAnchorDestroy,
1957 			connectFlags);
1958 		return wrapper.handlerId;
1959 	}
1960 	
1961 	extern(C) static void callBackInsertChildAnchor(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextChildAnchor* anchor, OnInsertChildAnchorDelegateWrapper wrapper)
1962 	{
1963 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextChildAnchor)(anchor), wrapper.outer);
1964 	}
1965 	
1966 	extern(C) static void callBackInsertChildAnchorDestroy(OnInsertChildAnchorDelegateWrapper wrapper, GClosure* closure)
1967 	{
1968 		wrapper.remove(wrapper);
1969 	}
1970 
1971 	protected class OnInsertPixbufDelegateWrapper
1972 	{
1973 		static OnInsertPixbufDelegateWrapper[] listeners;
1974 		void delegate(TextIter, Pixbuf, TextBuffer) dlg;
1975 		gulong handlerId;
1976 		
1977 		this(void delegate(TextIter, Pixbuf, TextBuffer) dlg)
1978 		{
1979 			this.dlg = dlg;
1980 			this.listeners ~= this;
1981 		}
1982 		
1983 		void remove(OnInsertPixbufDelegateWrapper source)
1984 		{
1985 			foreach(index, wrapper; listeners)
1986 			{
1987 				if (wrapper.handlerId == source.handlerId)
1988 				{
1989 					listeners[index] = null;
1990 					listeners = std.algorithm.remove(listeners, index);
1991 					break;
1992 				}
1993 			}
1994 		}
1995 	}
1996 
1997 	/**
1998 	 * The ::insert-pixbuf signal is emitted to insert a #GdkPixbuf
1999 	 * in a #GtkTextBuffer. Insertion actually occurs in the default handler.
2000 	 *
2001 	 * Note that if your handler runs before the default handler it must not
2002 	 * invalidate the @location iter (or has to revalidate it).
2003 	 * The default signal handler revalidates it to be placed after the
2004 	 * inserted @pixbuf.
2005 	 *
2006 	 * See also: gtk_text_buffer_insert_pixbuf().
2007 	 *
2008 	 * Params:
2009 	 *     location = position to insert @pixbuf in @textbuffer
2010 	 *     pixbuf = the #GdkPixbuf to be inserted
2011 	 */
2012 	gulong addOnInsertPixbuf(void delegate(TextIter, Pixbuf, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2013 	{
2014 		auto wrapper = new OnInsertPixbufDelegateWrapper(dlg);
2015 		wrapper.handlerId = Signals.connectData(
2016 			this,
2017 			"insert-pixbuf",
2018 			cast(GCallback)&callBackInsertPixbuf,
2019 			cast(void*)wrapper,
2020 			cast(GClosureNotify)&callBackInsertPixbufDestroy,
2021 			connectFlags);
2022 		return wrapper.handlerId;
2023 	}
2024 	
2025 	extern(C) static void callBackInsertPixbuf(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GdkPixbuf* pixbuf, OnInsertPixbufDelegateWrapper wrapper)
2026 	{
2027 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(Pixbuf)(pixbuf), wrapper.outer);
2028 	}
2029 	
2030 	extern(C) static void callBackInsertPixbufDestroy(OnInsertPixbufDelegateWrapper wrapper, GClosure* closure)
2031 	{
2032 		wrapper.remove(wrapper);
2033 	}
2034 
2035 	protected class OnInsertTextDelegateWrapper
2036 	{
2037 		static OnInsertTextDelegateWrapper[] listeners;
2038 		void delegate(TextIter, string, int, TextBuffer) dlg;
2039 		gulong handlerId;
2040 		
2041 		this(void delegate(TextIter, string, int, TextBuffer) dlg)
2042 		{
2043 			this.dlg = dlg;
2044 			this.listeners ~= this;
2045 		}
2046 		
2047 		void remove(OnInsertTextDelegateWrapper source)
2048 		{
2049 			foreach(index, wrapper; listeners)
2050 			{
2051 				if (wrapper.handlerId == source.handlerId)
2052 				{
2053 					listeners[index] = null;
2054 					listeners = std.algorithm.remove(listeners, index);
2055 					break;
2056 				}
2057 			}
2058 		}
2059 	}
2060 
2061 	/**
2062 	 * The ::insert-text signal is emitted to insert text in a #GtkTextBuffer.
2063 	 * Insertion actually occurs in the default handler.
2064 	 *
2065 	 * Note that if your handler runs before the default handler it must not
2066 	 * invalidate the @location iter (or has to revalidate it).
2067 	 * The default signal handler revalidates it to point to the end of the
2068 	 * inserted text.
2069 	 *
2070 	 * See also:
2071 	 * gtk_text_buffer_insert(),
2072 	 * gtk_text_buffer_insert_range().
2073 	 *
2074 	 * Params:
2075 	 *     location = position to insert @text in @textbuffer
2076 	 *     text = the UTF-8 text to be inserted
2077 	 *     len = length of the inserted text in bytes
2078 	 */
2079 	gulong addOnInsertText(void delegate(TextIter, string, int, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2080 	{
2081 		auto wrapper = new OnInsertTextDelegateWrapper(dlg);
2082 		wrapper.handlerId = Signals.connectData(
2083 			this,
2084 			"insert-text",
2085 			cast(GCallback)&callBackInsertText,
2086 			cast(void*)wrapper,
2087 			cast(GClosureNotify)&callBackInsertTextDestroy,
2088 			connectFlags);
2089 		return wrapper.handlerId;
2090 	}
2091 	
2092 	extern(C) static void callBackInsertText(GtkTextBuffer* textbufferStruct, GtkTextIter* location, char* text, int len, OnInsertTextDelegateWrapper wrapper)
2093 	{
2094 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), Str.toString(text), len, wrapper.outer);
2095 	}
2096 	
2097 	extern(C) static void callBackInsertTextDestroy(OnInsertTextDelegateWrapper wrapper, GClosure* closure)
2098 	{
2099 		wrapper.remove(wrapper);
2100 	}
2101 
2102 	protected class OnMarkDeletedDelegateWrapper
2103 	{
2104 		static OnMarkDeletedDelegateWrapper[] listeners;
2105 		void delegate(TextMark, TextBuffer) dlg;
2106 		gulong handlerId;
2107 		
2108 		this(void delegate(TextMark, TextBuffer) dlg)
2109 		{
2110 			this.dlg = dlg;
2111 			this.listeners ~= this;
2112 		}
2113 		
2114 		void remove(OnMarkDeletedDelegateWrapper source)
2115 		{
2116 			foreach(index, wrapper; listeners)
2117 			{
2118 				if (wrapper.handlerId == source.handlerId)
2119 				{
2120 					listeners[index] = null;
2121 					listeners = std.algorithm.remove(listeners, index);
2122 					break;
2123 				}
2124 			}
2125 		}
2126 	}
2127 
2128 	/**
2129 	 * The ::mark-deleted signal is emitted as notification
2130 	 * after a #GtkTextMark is deleted.
2131 	 *
2132 	 * See also:
2133 	 * gtk_text_buffer_delete_mark().
2134 	 *
2135 	 * Params:
2136 	 *     mark = The mark that was deleted
2137 	 */
2138 	gulong addOnMarkDeleted(void delegate(TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2139 	{
2140 		auto wrapper = new OnMarkDeletedDelegateWrapper(dlg);
2141 		wrapper.handlerId = Signals.connectData(
2142 			this,
2143 			"mark-deleted",
2144 			cast(GCallback)&callBackMarkDeleted,
2145 			cast(void*)wrapper,
2146 			cast(GClosureNotify)&callBackMarkDeletedDestroy,
2147 			connectFlags);
2148 		return wrapper.handlerId;
2149 	}
2150 	
2151 	extern(C) static void callBackMarkDeleted(GtkTextBuffer* textbufferStruct, GtkTextMark* mark, OnMarkDeletedDelegateWrapper wrapper)
2152 	{
2153 		wrapper.dlg(ObjectG.getDObject!(TextMark)(mark), wrapper.outer);
2154 	}
2155 	
2156 	extern(C) static void callBackMarkDeletedDestroy(OnMarkDeletedDelegateWrapper wrapper, GClosure* closure)
2157 	{
2158 		wrapper.remove(wrapper);
2159 	}
2160 
2161 	protected class OnMarkSetDelegateWrapper
2162 	{
2163 		static OnMarkSetDelegateWrapper[] listeners;
2164 		void delegate(TextIter, TextMark, TextBuffer) dlg;
2165 		gulong handlerId;
2166 		
2167 		this(void delegate(TextIter, TextMark, TextBuffer) dlg)
2168 		{
2169 			this.dlg = dlg;
2170 			this.listeners ~= this;
2171 		}
2172 		
2173 		void remove(OnMarkSetDelegateWrapper source)
2174 		{
2175 			foreach(index, wrapper; listeners)
2176 			{
2177 				if (wrapper.handlerId == source.handlerId)
2178 				{
2179 					listeners[index] = null;
2180 					listeners = std.algorithm.remove(listeners, index);
2181 					break;
2182 				}
2183 			}
2184 		}
2185 	}
2186 
2187 	/**
2188 	 * The ::mark-set signal is emitted as notification
2189 	 * after a #GtkTextMark is set.
2190 	 *
2191 	 * See also:
2192 	 * gtk_text_buffer_create_mark(),
2193 	 * gtk_text_buffer_move_mark().
2194 	 *
2195 	 * Params:
2196 	 *     location = The location of @mark in @textbuffer
2197 	 *     mark = The mark that is set
2198 	 */
2199 	gulong addOnMarkSet(void delegate(TextIter, TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2200 	{
2201 		auto wrapper = new OnMarkSetDelegateWrapper(dlg);
2202 		wrapper.handlerId = Signals.connectData(
2203 			this,
2204 			"mark-set",
2205 			cast(GCallback)&callBackMarkSet,
2206 			cast(void*)wrapper,
2207 			cast(GClosureNotify)&callBackMarkSetDestroy,
2208 			connectFlags);
2209 		return wrapper.handlerId;
2210 	}
2211 	
2212 	extern(C) static void callBackMarkSet(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextMark* mark, OnMarkSetDelegateWrapper wrapper)
2213 	{
2214 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextMark)(mark), wrapper.outer);
2215 	}
2216 	
2217 	extern(C) static void callBackMarkSetDestroy(OnMarkSetDelegateWrapper wrapper, GClosure* closure)
2218 	{
2219 		wrapper.remove(wrapper);
2220 	}
2221 
2222 	protected class OnModifiedChangedDelegateWrapper
2223 	{
2224 		static OnModifiedChangedDelegateWrapper[] listeners;
2225 		void delegate(TextBuffer) dlg;
2226 		gulong handlerId;
2227 		
2228 		this(void delegate(TextBuffer) dlg)
2229 		{
2230 			this.dlg = dlg;
2231 			this.listeners ~= this;
2232 		}
2233 		
2234 		void remove(OnModifiedChangedDelegateWrapper source)
2235 		{
2236 			foreach(index, wrapper; listeners)
2237 			{
2238 				if (wrapper.handlerId == source.handlerId)
2239 				{
2240 					listeners[index] = null;
2241 					listeners = std.algorithm.remove(listeners, index);
2242 					break;
2243 				}
2244 			}
2245 		}
2246 	}
2247 
2248 	/**
2249 	 * The ::modified-changed signal is emitted when the modified bit of a
2250 	 * #GtkTextBuffer flips.
2251 	 *
2252 	 * See also:
2253 	 * gtk_text_buffer_set_modified().
2254 	 */
2255 	gulong addOnModifiedChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2256 	{
2257 		auto wrapper = new OnModifiedChangedDelegateWrapper(dlg);
2258 		wrapper.handlerId = Signals.connectData(
2259 			this,
2260 			"modified-changed",
2261 			cast(GCallback)&callBackModifiedChanged,
2262 			cast(void*)wrapper,
2263 			cast(GClosureNotify)&callBackModifiedChangedDestroy,
2264 			connectFlags);
2265 		return wrapper.handlerId;
2266 	}
2267 	
2268 	extern(C) static void callBackModifiedChanged(GtkTextBuffer* textbufferStruct, OnModifiedChangedDelegateWrapper wrapper)
2269 	{
2270 		wrapper.dlg(wrapper.outer);
2271 	}
2272 	
2273 	extern(C) static void callBackModifiedChangedDestroy(OnModifiedChangedDelegateWrapper wrapper, GClosure* closure)
2274 	{
2275 		wrapper.remove(wrapper);
2276 	}
2277 
2278 	protected class OnPasteDoneDelegateWrapper
2279 	{
2280 		static OnPasteDoneDelegateWrapper[] listeners;
2281 		void delegate(Clipboard, TextBuffer) dlg;
2282 		gulong handlerId;
2283 		
2284 		this(void delegate(Clipboard, TextBuffer) dlg)
2285 		{
2286 			this.dlg = dlg;
2287 			this.listeners ~= this;
2288 		}
2289 		
2290 		void remove(OnPasteDoneDelegateWrapper source)
2291 		{
2292 			foreach(index, wrapper; listeners)
2293 			{
2294 				if (wrapper.handlerId == source.handlerId)
2295 				{
2296 					listeners[index] = null;
2297 					listeners = std.algorithm.remove(listeners, index);
2298 					break;
2299 				}
2300 			}
2301 		}
2302 	}
2303 
2304 	/**
2305 	 * The paste-done signal is emitted after paste operation has been completed.
2306 	 * This is useful to properly scroll the view to the end of the pasted text.
2307 	 * See gtk_text_buffer_paste_clipboard() for more details.
2308 	 *
2309 	 * Params:
2310 	 *     clipboard = the #GtkClipboard pasted from
2311 	 *
2312 	 * Since: 2.16
2313 	 */
2314 	gulong addOnPasteDone(void delegate(Clipboard, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2315 	{
2316 		auto wrapper = new OnPasteDoneDelegateWrapper(dlg);
2317 		wrapper.handlerId = Signals.connectData(
2318 			this,
2319 			"paste-done",
2320 			cast(GCallback)&callBackPasteDone,
2321 			cast(void*)wrapper,
2322 			cast(GClosureNotify)&callBackPasteDoneDestroy,
2323 			connectFlags);
2324 		return wrapper.handlerId;
2325 	}
2326 	
2327 	extern(C) static void callBackPasteDone(GtkTextBuffer* textbufferStruct, GtkClipboard* clipboard, OnPasteDoneDelegateWrapper wrapper)
2328 	{
2329 		wrapper.dlg(ObjectG.getDObject!(Clipboard)(clipboard), wrapper.outer);
2330 	}
2331 	
2332 	extern(C) static void callBackPasteDoneDestroy(OnPasteDoneDelegateWrapper wrapper, GClosure* closure)
2333 	{
2334 		wrapper.remove(wrapper);
2335 	}
2336 
2337 	protected class OnRemoveTagDelegateWrapper
2338 	{
2339 		static OnRemoveTagDelegateWrapper[] listeners;
2340 		void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg;
2341 		gulong handlerId;
2342 		
2343 		this(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg)
2344 		{
2345 			this.dlg = dlg;
2346 			this.listeners ~= this;
2347 		}
2348 		
2349 		void remove(OnRemoveTagDelegateWrapper source)
2350 		{
2351 			foreach(index, wrapper; listeners)
2352 			{
2353 				if (wrapper.handlerId == source.handlerId)
2354 				{
2355 					listeners[index] = null;
2356 					listeners = std.algorithm.remove(listeners, index);
2357 					break;
2358 				}
2359 			}
2360 		}
2361 	}
2362 
2363 	/**
2364 	 * The ::remove-tag signal is emitted to remove all occurrences of @tag from
2365 	 * a range of text in a #GtkTextBuffer.
2366 	 * Removal actually occurs in the default handler.
2367 	 *
2368 	 * Note that if your handler runs before the default handler it must not
2369 	 * invalidate the @start and @end iters (or has to revalidate them).
2370 	 *
2371 	 * See also:
2372 	 * gtk_text_buffer_remove_tag().
2373 	 *
2374 	 * Params:
2375 	 *     tag = the tag to be removed
2376 	 *     start = the start of the range the tag is removed from
2377 	 *     end = the end of the range the tag is removed from
2378 	 */
2379 	gulong addOnRemoveTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2380 	{
2381 		auto wrapper = new OnRemoveTagDelegateWrapper(dlg);
2382 		wrapper.handlerId = Signals.connectData(
2383 			this,
2384 			"remove-tag",
2385 			cast(GCallback)&callBackRemoveTag,
2386 			cast(void*)wrapper,
2387 			cast(GClosureNotify)&callBackRemoveTagDestroy,
2388 			connectFlags);
2389 		return wrapper.handlerId;
2390 	}
2391 	
2392 	extern(C) static void callBackRemoveTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, OnRemoveTagDelegateWrapper wrapper)
2393 	{
2394 		wrapper.dlg(ObjectG.getDObject!(TextTag)(tag), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
2395 	}
2396 	
2397 	extern(C) static void callBackRemoveTagDestroy(OnRemoveTagDelegateWrapper wrapper, GClosure* closure)
2398 	{
2399 		wrapper.remove(wrapper);
2400 	}
2401 }