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