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 gobject.c.functions;
37 private import gtk.Clipboard;
38 private import gtk.TargetList;
39 private import gtk.TextChildAnchor;
40 private import gtk.TextIter;
41 private import gtk.TextMark;
42 private import gtk.TextTag;
43 private import gtk.TextTagTable;
44 private import gtk.c.functions;
45 public  import gtk.c.types;
46 public  import gtkc.gtktypes;
47 private import pango.PgFontDescription;
48 private import pango.PgTabArray;
49 private import std.algorithm;
50 private import std.stdio;
51 
52 
53 /**
54  * You may wish to begin by reading the
55  * [text widget conceptual overview][TextWidget]
56  * which gives an overview of all the objects and data
57  * types related to the text widget and how they work together.
58  */
59 public class TextBuffer : ObjectG
60 {
61 	/** the main Gtk struct */
62 	protected GtkTextBuffer* gtkTextBuffer;
63 
64 	/** Get the main Gtk struct */
65 	public GtkTextBuffer* getTextBufferStruct(bool transferOwnership = false)
66 	{
67 		if (transferOwnership)
68 			ownedRef = false;
69 		return gtkTextBuffer;
70 	}
71 
72 	/** the main Gtk struct as a void* */
73 	protected override void* getStruct()
74 	{
75 		return cast(void*)gtkTextBuffer;
76 	}
77 
78 	protected override void setStruct(GObject* obj)
79 	{
80 		gtkTextBuffer = cast(GtkTextBuffer*)obj;
81 		super.setStruct(obj);
82 	}
83 
84 	/**
85 	 * Sets our main struct and passes it to the parent class.
86 	 */
87 	public this (GtkTextBuffer* gtkTextBuffer, bool ownedRef = false)
88 	{
89 		this.gtkTextBuffer = gtkTextBuffer;
90 		super(cast(GObject*)gtkTextBuffer, ownedRef);
91 	}
92 
93 	/**
94 	 * Inserts text into buffer at iter, applying the list of tags to
95 	 * the newly-inserted text. The last tag specified must be NULL to
96 	 * terminate the list. Equivalent to calling gtk_text_buffer_insert(),
97 	 * then gtk_text_buffer_apply_tag() on the inserted text;
98 	 * gtk_text_buffer_insert_with_tags() is just a convenience function.
99 	 * Params:
100 	 *  iter = an iterator in buffer
101 	 *  text = UTF-8 text
102 	 *  tags = list of tags to apply
103 	 */
104 	public void insertWithTags(TextIter iter, string text, TextTag[] tags ... )
105 	{
106 		int startOffset = iter.getOffset();
107 
108 		insert(iter, text);
109 
110 		if ( tags.length == 0 )
111 			return;
112 
113 		TextIter start = new TextIter();
114 		getIterAtOffset(start, startOffset);
115 
116 		foreach( tag; tags )
117 		{
118 			applyTag(tag, start, iter);
119 		}
120 	}
121 
122 	/**
123 	 * Same as gtk_text_buffer_insert_with_tags(), but allows you
124 	 * to pass in tag names instead of tag objects.
125 	 * Params:
126 	 *  iter = position in buffer
127 	 *  text = UTF-8 text
128 	 *  tags = tag names
129 	 */
130 	public void insertWithTagsByName(TextIter iter, string text, string[] tags ... )
131 	{
132 		int startOffset = iter.getOffset();
133 
134 		insert(iter, text);
135 
136 		if ( tags.length == 0 )
137 			return;
138 
139 		TextIter start = new TextIter();
140 		getIterAtOffset(start, startOffset);
141 
142 		foreach( tag; tags )
143 		{
144 			applyTagByName(tag, start, iter);
145 		}
146 	}
147 
148 	/**
149 	 * Creates a tag and adds it to the tag table for buffer. Equivalent to
150 	 * adding a new tag to the buffer's tag table.
151 	 *
152 	 * If tagName is null, the tag is anonymous.
153 	 *
154 	 * If tagName is non-NULL, a tag called tagName must not already exist
155 	 * in the tag table for this buffer.
156 	 *
157 	 * Params:
158 	 *     tagName = the name for the new tag.
159 	 *     ...     = A list of property names and there values.
160 	 */
161 	TextTag createTag(string tagName, ...)
162 	{
163 		TextTag tag = new TextTag(gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), null, null));
164 
165 		for (size_t i = 0; i < _arguments.length; i+=2)
166 		{
167 			//TODO: Add a proper eception type for this.
168 			if ( _arguments[i] != typeid(string) )
169 				throw new Exception("TextBuffer.CreateTag: The property name must be a string.");
170 
171 			string name = va_arg!(string)(_argptr);
172 
173 			if ( _arguments[i+1] == typeid(bool) ||
174 				_arguments[i+1] == typeid(int) ||
175 			_arguments[i+1] == typeid(GtkJustification) ||
176 			_arguments[i+1] == typeid(GtkTextDirection) ||
177 			_arguments[i+1] == typeid(GtkWrapMode) ||
178 			_arguments[i+1] == typeid(PangoStretch) ||
179 			_arguments[i+1] == typeid(PangoStyle) ||
180 			_arguments[i+1] == typeid(PangoUnderline) ||
181 			_arguments[i+1] == typeid(PangoVariant) ||
182 			_arguments[i+1] == typeid(PangoWeight) )
183 			{
184 
185 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(int)(_argptr), null);
186 			}
187 			else if ( _arguments[i+1] == typeid(Color) )
188 			{
189 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(Color)(_argptr).getColorStruct(), null);
190 			}
191 			else if ( _arguments[i+1] == typeid(double) )
192 			{
193 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(double)(_argptr), null);
194 			}
195 			else if ( _arguments[i+1] == typeid(const(double)) )
196 			{
197 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(double)(_argptr), null);
198 			}
199 			else if ( _arguments[i+1] == typeid(PgFontDescription) )
200 			{
201 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(PgFontDescription)(_argptr).getPgFontDescriptionStruct(), null);
202 			}
203 			else if ( _arguments[i+1] == typeid(PgTabArray) )
204 			{
205 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), va_arg!(PgTabArray)(_argptr).getPgTabArrayStruct(), null);
206 			}
207 			else if ( _arguments[i+1] == typeid(string) )
208 			{
209 				g_object_set(tag.getObjectGStruct(), Str.toStringz(name), Str.toStringz(va_arg!(string)(_argptr)), null);
210 			}
211 			else
212 			{
213 				stderr.writefln("TextBuffer.CreateTag: Unsupported type: \"%s\" for property: \"%s\"", _arguments[i+1], name);
214 
215 				//TODO: throw segfaults, druntime bug?
216 				throw new Exception("TextBuffer.CreateTag: Unsupported type: \""~_arguments[i+1].toString()~"\" for property: \""~name~"\"");
217 			}
218 		}
219 
220 		return tag;
221 	}
222 
223 	/**
224 	 * Obtain the entire text
225 	 * Returns: The text string
226 	 */
227 	string getText()
228 	{
229 		TextIter start = new TextIter();
230 		TextIter end = new TextIter();
231 		getBounds(start,end);
232 		return Str.toString(gtk_text_buffer_get_slice(gtkTextBuffer, start.getTextIterStruct(), end.getTextIterStruct(), true));
233 	}
234 
235 	/**
236 	 */
237 
238 	/** */
239 	public static GType getType()
240 	{
241 		return gtk_text_buffer_get_type();
242 	}
243 
244 	/**
245 	 * Creates a new text buffer.
246 	 *
247 	 * Params:
248 	 *     table = a tag table, or %NULL to create a new one
249 	 *
250 	 * Returns: a new text buffer
251 	 *
252 	 * Throws: ConstructionException GTK+ fails to create the object.
253 	 */
254 	public this(TextTagTable table)
255 	{
256 		auto p = gtk_text_buffer_new((table is null) ? null : table.getTextTagTableStruct());
257 
258 		if(p is null)
259 		{
260 			throw new ConstructionException("null returned by new");
261 		}
262 
263 		this(cast(GtkTextBuffer*) p, true);
264 	}
265 
266 	/**
267 	 * Adds the mark at position @where. The mark must not be added to
268 	 * another buffer, and if its name is not %NULL then there must not
269 	 * be another mark in the buffer with the same name.
270 	 *
271 	 * Emits the #GtkTextBuffer::mark-set signal as notification of the mark's
272 	 * initial placement.
273 	 *
274 	 * Params:
275 	 *     mark = the mark to add
276 	 *     where = location to place mark
277 	 *
278 	 * Since: 2.12
279 	 */
280 	public void addMark(TextMark mark, TextIter where)
281 	{
282 		gtk_text_buffer_add_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct(), (where is null) ? null : where.getTextIterStruct());
283 	}
284 
285 	/**
286 	 * Adds @clipboard to the list of clipboards in which the selection
287 	 * contents of @buffer are available. In most cases, @clipboard will be
288 	 * the #GtkClipboard of type %GDK_SELECTION_PRIMARY for a view of @buffer.
289 	 *
290 	 * Params:
291 	 *     clipboard = a #GtkClipboard
292 	 */
293 	public void addSelectionClipboard(Clipboard clipboard)
294 	{
295 		gtk_text_buffer_add_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
296 	}
297 
298 	/**
299 	 * Emits the “apply-tag” signal on @buffer. The default
300 	 * handler for the signal applies @tag to the given range.
301 	 * @start and @end do not have to be in order.
302 	 *
303 	 * Params:
304 	 *     tag = a #GtkTextTag
305 	 *     start = one bound of range to be tagged
306 	 *     end = other bound of range to be tagged
307 	 */
308 	public void applyTag(TextTag tag, TextIter start, TextIter end)
309 	{
310 		gtk_text_buffer_apply_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
311 	}
312 
313 	/**
314 	 * Calls gtk_text_tag_table_lookup() on the buffer’s tag table to
315 	 * get a #GtkTextTag, then calls gtk_text_buffer_apply_tag().
316 	 *
317 	 * Params:
318 	 *     name = name of a named #GtkTextTag
319 	 *     start = one bound of range to be tagged
320 	 *     end = other bound of range to be tagged
321 	 */
322 	public void applyTagByName(string name, TextIter start, TextIter end)
323 	{
324 		gtk_text_buffer_apply_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
325 	}
326 
327 	/**
328 	 * Performs the appropriate action as if the user hit the delete
329 	 * key with the cursor at the position specified by @iter. In the
330 	 * normal case a single character will be deleted, but when
331 	 * combining accents are involved, more than one character can
332 	 * be deleted, and when precomposed character and accent combinations
333 	 * are involved, less than one character will be deleted.
334 	 *
335 	 * Because the buffer is modified, all outstanding iterators become
336 	 * invalid after calling this function; however, the @iter will be
337 	 * re-initialized to point to the location where text was deleted.
338 	 *
339 	 * Params:
340 	 *     iter = a position in @buffer
341 	 *     interactive = whether the deletion is caused by user interaction
342 	 *     defaultEditable = whether the buffer is editable by default
343 	 *
344 	 * Returns: %TRUE if the buffer was modified
345 	 *
346 	 * Since: 2.6
347 	 */
348 	public bool backspace(TextIter iter, bool interactive, bool defaultEditable)
349 	{
350 		return gtk_text_buffer_backspace(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), interactive, defaultEditable) != 0;
351 	}
352 
353 	/**
354 	 * Called to indicate that the buffer operations between here and a
355 	 * call to gtk_text_buffer_end_user_action() are part of a single
356 	 * user-visible operation. The operations between
357 	 * gtk_text_buffer_begin_user_action() and
358 	 * gtk_text_buffer_end_user_action() can then be grouped when creating
359 	 * an undo stack. #GtkTextBuffer maintains a count of calls to
360 	 * gtk_text_buffer_begin_user_action() that have not been closed with
361 	 * a call to gtk_text_buffer_end_user_action(), and emits the
362 	 * “begin-user-action” and “end-user-action” signals only for the
363 	 * outermost pair of calls. This allows you to build user actions
364 	 * from other user actions.
365 	 *
366 	 * The “interactive” buffer mutation functions, such as
367 	 * gtk_text_buffer_insert_interactive(), automatically call begin/end
368 	 * user action around the buffer operations they perform, so there's
369 	 * no need to add extra calls if you user action consists solely of a
370 	 * single call to one of those functions.
371 	 */
372 	public void beginUserAction()
373 	{
374 		gtk_text_buffer_begin_user_action(gtkTextBuffer);
375 	}
376 
377 	/**
378 	 * Copies the currently-selected text to a clipboard.
379 	 *
380 	 * Params:
381 	 *     clipboard = the #GtkClipboard object to copy to
382 	 */
383 	public void copyClipboard(Clipboard clipboard)
384 	{
385 		gtk_text_buffer_copy_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
386 	}
387 
388 	/**
389 	 * This is a convenience function which simply creates a child anchor
390 	 * with gtk_text_child_anchor_new() and inserts it into the buffer
391 	 * with gtk_text_buffer_insert_child_anchor(). The new anchor is
392 	 * owned by the buffer; no reference count is returned to
393 	 * the caller of gtk_text_buffer_create_child_anchor().
394 	 *
395 	 * Params:
396 	 *     iter = location in the buffer
397 	 *
398 	 * Returns: the created child anchor
399 	 */
400 	public TextChildAnchor createChildAnchor(TextIter iter)
401 	{
402 		auto p = gtk_text_buffer_create_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct());
403 
404 		if(p is null)
405 		{
406 			return null;
407 		}
408 
409 		return ObjectG.getDObject!(TextChildAnchor)(cast(GtkTextChildAnchor*) p);
410 	}
411 
412 	/**
413 	 * Creates a mark at position @where. If @mark_name is %NULL, the mark
414 	 * is anonymous; otherwise, the mark can be retrieved by name using
415 	 * gtk_text_buffer_get_mark(). If a mark has left gravity, and text is
416 	 * inserted at the mark’s current location, the mark will be moved to
417 	 * the left of the newly-inserted text. If the mark has right gravity
418 	 * (@left_gravity = %FALSE), the mark will end up on the right of
419 	 * newly-inserted text. The standard left-to-right cursor is a mark
420 	 * with right gravity (when you type, the cursor stays on the right
421 	 * side of the text you’re typing).
422 	 *
423 	 * The caller of this function does not own a
424 	 * reference to the returned #GtkTextMark, so you can ignore the
425 	 * return value if you like. Marks are owned by the buffer and go
426 	 * away when the buffer does.
427 	 *
428 	 * Emits the #GtkTextBuffer::mark-set signal as notification of the mark's
429 	 * initial placement.
430 	 *
431 	 * Params:
432 	 *     markName = name for mark, or %NULL
433 	 *     where = location to place mark
434 	 *     leftGravity = whether the mark has left gravity
435 	 *
436 	 * Returns: the new #GtkTextMark object
437 	 */
438 	public TextMark createMark(string markName, TextIter where, bool leftGravity)
439 	{
440 		auto p = gtk_text_buffer_create_mark(gtkTextBuffer, Str.toStringz(markName), (where is null) ? null : where.getTextIterStruct(), leftGravity);
441 
442 		if(p is null)
443 		{
444 			return null;
445 		}
446 
447 		return ObjectG.getDObject!(TextMark)(cast(GtkTextMark*) p);
448 	}
449 
450 	/**
451 	 * Copies the currently-selected text to a clipboard, then deletes
452 	 * said text if it’s editable.
453 	 *
454 	 * Params:
455 	 *     clipboard = the #GtkClipboard object to cut to
456 	 *     defaultEditable = default editability of the buffer
457 	 */
458 	public void cutClipboard(Clipboard clipboard, bool defaultEditable)
459 	{
460 		gtk_text_buffer_cut_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), defaultEditable);
461 	}
462 
463 	/**
464 	 * Deletes text between @start and @end. The order of @start and @end
465 	 * is not actually relevant; gtk_text_buffer_delete() will reorder
466 	 * them. This function actually emits the “delete-range” signal, and
467 	 * the default handler of that signal deletes the text. Because the
468 	 * buffer is modified, all outstanding iterators become invalid after
469 	 * calling this function; however, the @start and @end will be
470 	 * re-initialized to point to the location where text was deleted.
471 	 *
472 	 * Params:
473 	 *     start = a position in @buffer
474 	 *     end = another position in @buffer
475 	 */
476 	public void delet(TextIter start, TextIter end)
477 	{
478 		gtk_text_buffer_delete(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
479 	}
480 
481 	/**
482 	 * Deletes all editable text in the given range.
483 	 * Calls gtk_text_buffer_delete() for each editable sub-range of
484 	 * [@start,@end). @start and @end are revalidated to point to
485 	 * the location of the last deleted range, or left untouched if
486 	 * no text was deleted.
487 	 *
488 	 * Params:
489 	 *     startIter = start of range to delete
490 	 *     endIter = end of range
491 	 *     defaultEditable = whether the buffer is editable by default
492 	 *
493 	 * Returns: whether some text was actually deleted
494 	 */
495 	public bool deleteInteractive(TextIter startIter, TextIter endIter, bool defaultEditable)
496 	{
497 		return gtk_text_buffer_delete_interactive(gtkTextBuffer, (startIter is null) ? null : startIter.getTextIterStruct(), (endIter is null) ? null : endIter.getTextIterStruct(), defaultEditable) != 0;
498 	}
499 
500 	/**
501 	 * Deletes @mark, so that it’s no longer located anywhere in the
502 	 * buffer. Removes the reference the buffer holds to the mark, so if
503 	 * you haven’t called g_object_ref() on the mark, it will be freed. Even
504 	 * if the mark isn’t freed, most operations on @mark become
505 	 * invalid, until it gets added to a buffer again with
506 	 * gtk_text_buffer_add_mark(). Use gtk_text_mark_get_deleted() to
507 	 * find out if a mark has been removed from its buffer.
508 	 * The #GtkTextBuffer::mark-deleted signal will be emitted as notification after
509 	 * the mark is deleted.
510 	 *
511 	 * Params:
512 	 *     mark = a #GtkTextMark in @buffer
513 	 */
514 	public void deleteMark(TextMark mark)
515 	{
516 		gtk_text_buffer_delete_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct());
517 	}
518 
519 	/**
520 	 * Deletes the mark named @name; the mark must exist. See
521 	 * gtk_text_buffer_delete_mark() for details.
522 	 *
523 	 * Params:
524 	 *     name = name of a mark in @buffer
525 	 */
526 	public void deleteMarkByName(string name)
527 	{
528 		gtk_text_buffer_delete_mark_by_name(gtkTextBuffer, Str.toStringz(name));
529 	}
530 
531 	/**
532 	 * Deletes the range between the “insert” and “selection_bound” marks,
533 	 * that is, the currently-selected text. If @interactive is %TRUE,
534 	 * the editability of the selection will be considered (users can’t delete
535 	 * uneditable text).
536 	 *
537 	 * Params:
538 	 *     interactive = whether the deletion is caused by user interaction
539 	 *     defaultEditable = whether the buffer is editable by default
540 	 *
541 	 * Returns: whether there was a non-empty selection to delete
542 	 */
543 	public bool deleteSelection(bool interactive, bool defaultEditable)
544 	{
545 		return gtk_text_buffer_delete_selection(gtkTextBuffer, interactive, defaultEditable) != 0;
546 	}
547 
548 	/**
549 	 * This function deserializes rich text in format @format and inserts
550 	 * it at @iter.
551 	 *
552 	 * @formats to be used must be registered using
553 	 * gtk_text_buffer_register_deserialize_format() or
554 	 * gtk_text_buffer_register_deserialize_tagset() beforehand.
555 	 *
556 	 * Params:
557 	 *     contentBuffer = the #GtkTextBuffer to deserialize into
558 	 *     format = the rich text format to use for deserializing
559 	 *     iter = insertion point for the deserialized text
560 	 *     data = data to deserialize
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 	 */
1119 	public void insert(TextIter iter, string text)
1120 	{
1121 		gtk_text_buffer_insert(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), cast(int)text.length);
1122 	}
1123 
1124 	/**
1125 	 * Simply calls gtk_text_buffer_insert(), using the current
1126 	 * cursor position as the insertion point.
1127 	 *
1128 	 * Params:
1129 	 *     text = text in UTF-8 format
1130 	 */
1131 	public void insertAtCursor(string text)
1132 	{
1133 		gtk_text_buffer_insert_at_cursor(gtkTextBuffer, Str.toStringz(text), cast(int)text.length);
1134 	}
1135 
1136 	/**
1137 	 * Inserts a child widget anchor into the text buffer at @iter. The
1138 	 * anchor will be counted as one character in character counts, and
1139 	 * when obtaining the buffer contents as a string, will be represented
1140 	 * by the Unicode “object replacement character” 0xFFFC. Note that the
1141 	 * “slice” variants for obtaining portions of the buffer as a string
1142 	 * include this character for child anchors, but the “text” variants do
1143 	 * not. E.g. see gtk_text_buffer_get_slice() and
1144 	 * gtk_text_buffer_get_text(). Consider
1145 	 * gtk_text_buffer_create_child_anchor() as a more convenient
1146 	 * alternative to this function. The buffer will add a reference to
1147 	 * the anchor, so you can unref it after insertion.
1148 	 *
1149 	 * Params:
1150 	 *     iter = location to insert the anchor
1151 	 *     anchor = a #GtkTextChildAnchor
1152 	 */
1153 	public void insertChildAnchor(TextIter iter, TextChildAnchor anchor)
1154 	{
1155 		gtk_text_buffer_insert_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
1156 	}
1157 
1158 	/**
1159 	 * Like gtk_text_buffer_insert(), but the insertion will not occur if
1160 	 * @iter is at a non-editable location in the buffer. Usually you
1161 	 * want to prevent insertions at ineditable locations if the insertion
1162 	 * results from a user action (is interactive).
1163 	 *
1164 	 * @default_editable indicates the editability of text that doesn't
1165 	 * have a tag affecting editability applied to it. Typically the
1166 	 * result of gtk_text_view_get_editable() is appropriate here.
1167 	 *
1168 	 * Params:
1169 	 *     iter = a position in @buffer
1170 	 *     text = some UTF-8 text
1171 	 *     defaultEditable = default editability of buffer
1172 	 *
1173 	 * Returns: whether text was actually inserted
1174 	 */
1175 	public bool insertInteractive(TextIter iter, string text, bool defaultEditable)
1176 	{
1177 		return gtk_text_buffer_insert_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), cast(int)text.length, defaultEditable) != 0;
1178 	}
1179 
1180 	/**
1181 	 * Calls gtk_text_buffer_insert_interactive() at the cursor
1182 	 * position.
1183 	 *
1184 	 * @default_editable indicates the editability of text that doesn't
1185 	 * have a tag affecting editability applied to it. Typically the
1186 	 * result of gtk_text_view_get_editable() is appropriate here.
1187 	 *
1188 	 * Params:
1189 	 *     text = text in UTF-8 format
1190 	 *     defaultEditable = default editability of buffer
1191 	 *
1192 	 * Returns: whether text was actually inserted
1193 	 */
1194 	public bool insertInteractiveAtCursor(string text, bool defaultEditable)
1195 	{
1196 		return gtk_text_buffer_insert_interactive_at_cursor(gtkTextBuffer, Str.toStringz(text), cast(int)text.length, defaultEditable) != 0;
1197 	}
1198 
1199 	/**
1200 	 * Inserts the text in @markup at position @iter. @markup will be inserted
1201 	 * in its entirety and must be nul-terminated and valid UTF-8. Emits the
1202 	 * #GtkTextBuffer::insert-text signal, possibly multiple times; insertion
1203 	 * actually occurs in the default handler for the signal. @iter will point
1204 	 * to the end of the inserted text on return.
1205 	 *
1206 	 * Params:
1207 	 *     iter = location to insert the markup
1208 	 *     markup = a nul-terminated UTF-8 string containing [Pango markup][PangoMarkupFormat]
1209 	 *     len = length of @markup in bytes, or -1
1210 	 *
1211 	 * Since: 3.16
1212 	 */
1213 	public void insertMarkup(TextIter iter, string markup, int len)
1214 	{
1215 		gtk_text_buffer_insert_markup(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(markup), len);
1216 	}
1217 
1218 	/**
1219 	 * Inserts an image into the text buffer at @iter. The image will be
1220 	 * counted as one character in character counts, and when obtaining
1221 	 * the buffer contents as a string, will be represented by the Unicode
1222 	 * “object replacement character” 0xFFFC. Note that the “slice”
1223 	 * variants for obtaining portions of the buffer as a string include
1224 	 * this character for pixbufs, but the “text” variants do
1225 	 * not. e.g. see gtk_text_buffer_get_slice() and
1226 	 * gtk_text_buffer_get_text().
1227 	 *
1228 	 * Params:
1229 	 *     iter = location to insert the pixbuf
1230 	 *     pixbuf = a #GdkPixbuf
1231 	 */
1232 	public void insertPixbuf(TextIter iter, Pixbuf pixbuf)
1233 	{
1234 		gtk_text_buffer_insert_pixbuf(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
1235 	}
1236 
1237 	/**
1238 	 * Copies text, tags, and pixbufs between @start and @end (the order
1239 	 * of @start and @end doesn’t matter) and inserts the copy at @iter.
1240 	 * Used instead of simply getting/inserting text because it preserves
1241 	 * images and tags. If @start and @end are in a different buffer from
1242 	 * @buffer, the two buffers must share the same tag table.
1243 	 *
1244 	 * Implemented via emissions of the insert_text and apply_tag signals,
1245 	 * so expect those.
1246 	 *
1247 	 * Params:
1248 	 *     iter = a position in @buffer
1249 	 *     start = a position in a #GtkTextBuffer
1250 	 *     end = another position in the same buffer as @start
1251 	 */
1252 	public void insertRange(TextIter iter, TextIter start, TextIter end)
1253 	{
1254 		gtk_text_buffer_insert_range(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1255 	}
1256 
1257 	/**
1258 	 * Same as gtk_text_buffer_insert_range(), but does nothing if the
1259 	 * insertion point isn’t editable. The @default_editable parameter
1260 	 * indicates whether the text is editable at @iter if no tags
1261 	 * enclosing @iter affect editability. Typically the result of
1262 	 * gtk_text_view_get_editable() is appropriate here.
1263 	 *
1264 	 * Params:
1265 	 *     iter = a position in @buffer
1266 	 *     start = a position in a #GtkTextBuffer
1267 	 *     end = another position in the same buffer as @start
1268 	 *     defaultEditable = default editability of the buffer
1269 	 *
1270 	 * Returns: whether an insertion was possible at @iter
1271 	 */
1272 	public bool insertRangeInteractive(TextIter iter, TextIter start, TextIter end, bool defaultEditable)
1273 	{
1274 		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;
1275 	}
1276 
1277 	/**
1278 	 * Moves @mark to the new location @where. Emits the #GtkTextBuffer::mark-set
1279 	 * signal as notification of the move.
1280 	 *
1281 	 * Params:
1282 	 *     mark = a #GtkTextMark
1283 	 *     where = new location for @mark in @buffer
1284 	 */
1285 	public void moveMark(TextMark mark, TextIter where)
1286 	{
1287 		gtk_text_buffer_move_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct(), (where is null) ? null : where.getTextIterStruct());
1288 	}
1289 
1290 	/**
1291 	 * Moves the mark named @name (which must exist) to location @where.
1292 	 * See gtk_text_buffer_move_mark() for details.
1293 	 *
1294 	 * Params:
1295 	 *     name = name of a mark
1296 	 *     where = new location for mark
1297 	 */
1298 	public void moveMarkByName(string name, TextIter where)
1299 	{
1300 		gtk_text_buffer_move_mark_by_name(gtkTextBuffer, Str.toStringz(name), (where is null) ? null : where.getTextIterStruct());
1301 	}
1302 
1303 	/**
1304 	 * Pastes the contents of a clipboard. If @override_location is %NULL, the
1305 	 * pasted text will be inserted at the cursor position, or the buffer selection
1306 	 * will be replaced if the selection is non-empty.
1307 	 *
1308 	 * Note: pasting is asynchronous, that is, we’ll ask for the paste data and
1309 	 * return, and at some point later after the main loop runs, the paste data will
1310 	 * be inserted.
1311 	 *
1312 	 * Params:
1313 	 *     clipboard = the #GtkClipboard to paste from
1314 	 *     overrideLocation = location to insert pasted text, or %NULL
1315 	 *     defaultEditable = whether the buffer is editable by default
1316 	 */
1317 	public void pasteClipboard(Clipboard clipboard, TextIter overrideLocation, bool defaultEditable)
1318 	{
1319 		gtk_text_buffer_paste_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), (overrideLocation is null) ? null : overrideLocation.getTextIterStruct(), defaultEditable);
1320 	}
1321 
1322 	/**
1323 	 * This function moves the “insert” and “selection_bound” marks
1324 	 * simultaneously.  If you move them to the same place in two steps
1325 	 * with gtk_text_buffer_move_mark(), you will temporarily select a
1326 	 * region in between their old and new locations, which can be pretty
1327 	 * inefficient since the temporarily-selected region will force stuff
1328 	 * to be recalculated. This function moves them as a unit, which can
1329 	 * be optimized.
1330 	 *
1331 	 * Params:
1332 	 *     where = where to put the cursor
1333 	 */
1334 	public void placeCursor(TextIter where)
1335 	{
1336 		gtk_text_buffer_place_cursor(gtkTextBuffer, (where is null) ? null : where.getTextIterStruct());
1337 	}
1338 
1339 	/**
1340 	 * This function registers a rich text deserialization @function along with
1341 	 * its @mime_type with the passed @buffer.
1342 	 *
1343 	 * Params:
1344 	 *     mimeType = the format’s mime-type
1345 	 *     funct = the deserialize function to register
1346 	 *     userData = @function’s user_data
1347 	 *     userDataDestroy = a function to call when @user_data is no longer needed
1348 	 *
1349 	 * Returns: the #GdkAtom that corresponds to the
1350 	 *     newly registered format’s mime-type.
1351 	 *
1352 	 * Since: 2.10
1353 	 */
1354 	public GdkAtom registerDeserializeFormat(string mimeType, GtkTextBufferDeserializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
1355 	{
1356 		return gtk_text_buffer_register_deserialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
1357 	}
1358 
1359 	/**
1360 	 * This function registers GTK+’s internal rich text serialization
1361 	 * format with the passed @buffer. See
1362 	 * gtk_text_buffer_register_serialize_tagset() for details.
1363 	 *
1364 	 * Params:
1365 	 *     tagsetName = an optional tagset name, on %NULL
1366 	 *
1367 	 * Returns: the #GdkAtom that corresponds to the
1368 	 *     newly registered format’s mime-type.
1369 	 *
1370 	 * Since: 2.10
1371 	 */
1372 	public GdkAtom registerDeserializeTagset(string tagsetName)
1373 	{
1374 		return gtk_text_buffer_register_deserialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
1375 	}
1376 
1377 	/**
1378 	 * This function registers a rich text serialization @function along with
1379 	 * its @mime_type with the passed @buffer.
1380 	 *
1381 	 * Params:
1382 	 *     mimeType = the format’s mime-type
1383 	 *     funct = the serialize function to register
1384 	 *     userData = @function’s user_data
1385 	 *     userDataDestroy = a function to call when @user_data is no longer needed
1386 	 *
1387 	 * Returns: the #GdkAtom that corresponds to the
1388 	 *     newly registered format’s mime-type.
1389 	 *
1390 	 * Since: 2.10
1391 	 */
1392 	public GdkAtom registerSerializeFormat(string mimeType, GtkTextBufferSerializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
1393 	{
1394 		return gtk_text_buffer_register_serialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
1395 	}
1396 
1397 	/**
1398 	 * This function registers GTK+’s internal rich text serialization
1399 	 * format with the passed @buffer. The internal format does not comply
1400 	 * to any standard rich text format and only works between #GtkTextBuffer
1401 	 * instances. It is capable of serializing all of a text buffer’s tags
1402 	 * and embedded pixbufs.
1403 	 *
1404 	 * This function is just a wrapper around
1405 	 * gtk_text_buffer_register_serialize_format(). The mime type used
1406 	 * for registering is “application/x-gtk-text-buffer-rich-text”, or
1407 	 * “application/x-gtk-text-buffer-rich-text;format=@tagset_name” if a
1408 	 * @tagset_name was passed.
1409 	 *
1410 	 * The @tagset_name can be used to restrict the transfer of rich text
1411 	 * to buffers with compatible sets of tags, in order to avoid unknown
1412 	 * tags from being pasted. It is probably the common case to pass an
1413 	 * identifier != %NULL here, since the %NULL tagset requires the
1414 	 * receiving buffer to deal with with pasting of arbitrary tags.
1415 	 *
1416 	 * Params:
1417 	 *     tagsetName = an optional tagset name, on %NULL
1418 	 *
1419 	 * Returns: the #GdkAtom that corresponds to the
1420 	 *     newly registered format’s mime-type.
1421 	 *
1422 	 * Since: 2.10
1423 	 */
1424 	public GdkAtom registerSerializeTagset(string tagsetName)
1425 	{
1426 		return gtk_text_buffer_register_serialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
1427 	}
1428 
1429 	/**
1430 	 * Removes all tags in the range between @start and @end.  Be careful
1431 	 * with this function; it could remove tags added in code unrelated to
1432 	 * the code you’re currently writing. That is, using this function is
1433 	 * probably a bad idea if you have two or more unrelated code sections
1434 	 * that add tags.
1435 	 *
1436 	 * Params:
1437 	 *     start = one bound of range to be untagged
1438 	 *     end = other bound of range to be untagged
1439 	 */
1440 	public void removeAllTags(TextIter start, TextIter end)
1441 	{
1442 		gtk_text_buffer_remove_all_tags(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1443 	}
1444 
1445 	/**
1446 	 * Removes a #GtkClipboard added with
1447 	 * gtk_text_buffer_add_selection_clipboard().
1448 	 *
1449 	 * Params:
1450 	 *     clipboard = a #GtkClipboard added to @buffer by
1451 	 *         gtk_text_buffer_add_selection_clipboard()
1452 	 */
1453 	public void removeSelectionClipboard(Clipboard clipboard)
1454 	{
1455 		gtk_text_buffer_remove_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
1456 	}
1457 
1458 	/**
1459 	 * Emits the “remove-tag” signal. The default handler for the signal
1460 	 * removes all occurrences of @tag from the given range. @start and
1461 	 * @end don’t have to be in order.
1462 	 *
1463 	 * Params:
1464 	 *     tag = a #GtkTextTag
1465 	 *     start = one bound of range to be untagged
1466 	 *     end = other bound of range to be untagged
1467 	 */
1468 	public void removeTag(TextTag tag, TextIter start, TextIter end)
1469 	{
1470 		gtk_text_buffer_remove_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1471 	}
1472 
1473 	/**
1474 	 * Calls gtk_text_tag_table_lookup() on the buffer’s tag table to
1475 	 * get a #GtkTextTag, then calls gtk_text_buffer_remove_tag().
1476 	 *
1477 	 * Params:
1478 	 *     name = name of a #GtkTextTag
1479 	 *     start = one bound of range to be untagged
1480 	 *     end = other bound of range to be untagged
1481 	 */
1482 	public void removeTagByName(string name, TextIter start, TextIter end)
1483 	{
1484 		gtk_text_buffer_remove_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1485 	}
1486 
1487 	/**
1488 	 * This function moves the “insert” and “selection_bound” marks
1489 	 * simultaneously.  If you move them in two steps
1490 	 * with gtk_text_buffer_move_mark(), you will temporarily select a
1491 	 * region in between their old and new locations, which can be pretty
1492 	 * inefficient since the temporarily-selected region will force stuff
1493 	 * to be recalculated. This function moves them as a unit, which can
1494 	 * be optimized.
1495 	 *
1496 	 * Params:
1497 	 *     ins = where to put the “insert” mark
1498 	 *     bound = where to put the “selection_bound” mark
1499 	 *
1500 	 * Since: 2.4
1501 	 */
1502 	public void selectRange(TextIter ins, TextIter bound)
1503 	{
1504 		gtk_text_buffer_select_range(gtkTextBuffer, (ins is null) ? null : ins.getTextIterStruct(), (bound is null) ? null : bound.getTextIterStruct());
1505 	}
1506 
1507 	/**
1508 	 * This function serializes the portion of text between @start
1509 	 * and @end in the rich text format represented by @format.
1510 	 *
1511 	 * @formats to be used must be registered using
1512 	 * gtk_text_buffer_register_serialize_format() or
1513 	 * gtk_text_buffer_register_serialize_tagset() beforehand.
1514 	 *
1515 	 * Params:
1516 	 *     contentBuffer = the #GtkTextBuffer to serialize
1517 	 *     format = the rich text format to use for serializing
1518 	 *     start = start of block of text to serialize
1519 	 *     end = end of block of test to serialize
1520 	 *
1521 	 * Returns: the serialized
1522 	 *     data, encoded as @format
1523 	 *
1524 	 * Since: 2.10
1525 	 */
1526 	public ubyte[] serialize(TextBuffer contentBuffer, GdkAtom format, TextIter start, TextIter end)
1527 	{
1528 		size_t length;
1529 
1530 		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);
1531 
1532 		return p[0 .. length];
1533 	}
1534 
1535 	/**
1536 	 * Used to keep track of whether the buffer has been modified since the
1537 	 * last time it was saved. Whenever the buffer is saved to disk, call
1538 	 * gtk_text_buffer_set_modified (@buffer, FALSE). When the buffer is modified,
1539 	 * it will automatically toggled on the modified bit again. When the modified
1540 	 * bit flips, the buffer emits the #GtkTextBuffer::modified-changed signal.
1541 	 *
1542 	 * Params:
1543 	 *     setting = modification flag setting
1544 	 */
1545 	public void setModified(bool setting)
1546 	{
1547 		gtk_text_buffer_set_modified(gtkTextBuffer, setting);
1548 	}
1549 
1550 	/**
1551 	 * Deletes current contents of @buffer, and inserts @text instead. If
1552 	 * @len is -1, @text must be nul-terminated. @text must be valid UTF-8.
1553 	 *
1554 	 * Params:
1555 	 *     text = UTF-8 text to insert
1556 	 */
1557 	public void setText(string text)
1558 	{
1559 		gtk_text_buffer_set_text(gtkTextBuffer, Str.toStringz(text), cast(int)text.length);
1560 	}
1561 
1562 	/**
1563 	 * This function unregisters a rich text format that was previously
1564 	 * registered using gtk_text_buffer_register_deserialize_format() or
1565 	 * gtk_text_buffer_register_deserialize_tagset().
1566 	 *
1567 	 * Params:
1568 	 *     format = a #GdkAtom representing a registered rich text format.
1569 	 *
1570 	 * Since: 2.10
1571 	 */
1572 	public void unregisterDeserializeFormat(GdkAtom format)
1573 	{
1574 		gtk_text_buffer_unregister_deserialize_format(gtkTextBuffer, format);
1575 	}
1576 
1577 	/**
1578 	 * This function unregisters a rich text format that was previously
1579 	 * registered using gtk_text_buffer_register_serialize_format() or
1580 	 * gtk_text_buffer_register_serialize_tagset()
1581 	 *
1582 	 * Params:
1583 	 *     format = a #GdkAtom representing a registered rich text format.
1584 	 *
1585 	 * Since: 2.10
1586 	 */
1587 	public void unregisterSerializeFormat(GdkAtom format)
1588 	{
1589 		gtk_text_buffer_unregister_serialize_format(gtkTextBuffer, format);
1590 	}
1591 
1592 	protected class OnApplyTagDelegateWrapper
1593 	{
1594 		void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg;
1595 		gulong handlerId;
1596 
1597 		this(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg)
1598 		{
1599 			this.dlg = dlg;
1600 			onApplyTagListeners ~= this;
1601 		}
1602 
1603 		void remove(OnApplyTagDelegateWrapper source)
1604 		{
1605 			foreach(index, wrapper; onApplyTagListeners)
1606 			{
1607 				if (wrapper.handlerId == source.handlerId)
1608 				{
1609 					onApplyTagListeners[index] = null;
1610 					onApplyTagListeners = std.algorithm.remove(onApplyTagListeners, index);
1611 					break;
1612 				}
1613 			}
1614 		}
1615 	}
1616 	OnApplyTagDelegateWrapper[] onApplyTagListeners;
1617 
1618 	/**
1619 	 * The ::apply-tag signal is emitted to apply a tag to a
1620 	 * range of text in a #GtkTextBuffer.
1621 	 * Applying actually occurs in the default handler.
1622 	 *
1623 	 * Note that if your handler runs before the default handler it must not
1624 	 * invalidate the @start and @end iters (or has to revalidate them).
1625 	 *
1626 	 * See also:
1627 	 * gtk_text_buffer_apply_tag(),
1628 	 * gtk_text_buffer_insert_with_tags(),
1629 	 * gtk_text_buffer_insert_range().
1630 	 *
1631 	 * Params:
1632 	 *     tag = the applied tag
1633 	 *     start = the start of the range the tag is applied to
1634 	 *     end = the end of the range the tag is applied to
1635 	 */
1636 	gulong addOnApplyTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1637 	{
1638 		auto wrapper = new OnApplyTagDelegateWrapper(dlg);
1639 		wrapper.handlerId = Signals.connectData(
1640 			this,
1641 			"apply-tag",
1642 			cast(GCallback)&callBackApplyTag,
1643 			cast(void*)wrapper,
1644 			cast(GClosureNotify)&callBackApplyTagDestroy,
1645 			connectFlags);
1646 		return wrapper.handlerId;
1647 	}
1648 
1649 	extern(C) static void callBackApplyTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, OnApplyTagDelegateWrapper wrapper)
1650 	{
1651 		wrapper.dlg(ObjectG.getDObject!(TextTag)(tag), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
1652 	}
1653 
1654 	extern(C) static void callBackApplyTagDestroy(OnApplyTagDelegateWrapper wrapper, GClosure* closure)
1655 	{
1656 		wrapper.remove(wrapper);
1657 	}
1658 
1659 	protected class OnBeginUserActionDelegateWrapper
1660 	{
1661 		void delegate(TextBuffer) dlg;
1662 		gulong handlerId;
1663 
1664 		this(void delegate(TextBuffer) dlg)
1665 		{
1666 			this.dlg = dlg;
1667 			onBeginUserActionListeners ~= this;
1668 		}
1669 
1670 		void remove(OnBeginUserActionDelegateWrapper source)
1671 		{
1672 			foreach(index, wrapper; onBeginUserActionListeners)
1673 			{
1674 				if (wrapper.handlerId == source.handlerId)
1675 				{
1676 					onBeginUserActionListeners[index] = null;
1677 					onBeginUserActionListeners = std.algorithm.remove(onBeginUserActionListeners, index);
1678 					break;
1679 				}
1680 			}
1681 		}
1682 	}
1683 	OnBeginUserActionDelegateWrapper[] onBeginUserActionListeners;
1684 
1685 	/**
1686 	 * The ::begin-user-action signal is emitted at the beginning of a single
1687 	 * user-visible operation on a #GtkTextBuffer.
1688 	 *
1689 	 * See also:
1690 	 * gtk_text_buffer_begin_user_action(),
1691 	 * gtk_text_buffer_insert_interactive(),
1692 	 * gtk_text_buffer_insert_range_interactive(),
1693 	 * gtk_text_buffer_delete_interactive(),
1694 	 * gtk_text_buffer_backspace(),
1695 	 * gtk_text_buffer_delete_selection().
1696 	 */
1697 	gulong addOnBeginUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1698 	{
1699 		auto wrapper = new OnBeginUserActionDelegateWrapper(dlg);
1700 		wrapper.handlerId = Signals.connectData(
1701 			this,
1702 			"begin-user-action",
1703 			cast(GCallback)&callBackBeginUserAction,
1704 			cast(void*)wrapper,
1705 			cast(GClosureNotify)&callBackBeginUserActionDestroy,
1706 			connectFlags);
1707 		return wrapper.handlerId;
1708 	}
1709 
1710 	extern(C) static void callBackBeginUserAction(GtkTextBuffer* textbufferStruct, OnBeginUserActionDelegateWrapper wrapper)
1711 	{
1712 		wrapper.dlg(wrapper.outer);
1713 	}
1714 
1715 	extern(C) static void callBackBeginUserActionDestroy(OnBeginUserActionDelegateWrapper wrapper, GClosure* closure)
1716 	{
1717 		wrapper.remove(wrapper);
1718 	}
1719 
1720 	protected class OnChangedDelegateWrapper
1721 	{
1722 		void delegate(TextBuffer) dlg;
1723 		gulong handlerId;
1724 
1725 		this(void delegate(TextBuffer) dlg)
1726 		{
1727 			this.dlg = dlg;
1728 			onChangedListeners ~= this;
1729 		}
1730 
1731 		void remove(OnChangedDelegateWrapper source)
1732 		{
1733 			foreach(index, wrapper; onChangedListeners)
1734 			{
1735 				if (wrapper.handlerId == source.handlerId)
1736 				{
1737 					onChangedListeners[index] = null;
1738 					onChangedListeners = std.algorithm.remove(onChangedListeners, index);
1739 					break;
1740 				}
1741 			}
1742 		}
1743 	}
1744 	OnChangedDelegateWrapper[] onChangedListeners;
1745 
1746 	/**
1747 	 * The ::changed signal is emitted when the content of a #GtkTextBuffer
1748 	 * has changed.
1749 	 */
1750 	gulong addOnChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1751 	{
1752 		auto wrapper = new OnChangedDelegateWrapper(dlg);
1753 		wrapper.handlerId = Signals.connectData(
1754 			this,
1755 			"changed",
1756 			cast(GCallback)&callBackChanged,
1757 			cast(void*)wrapper,
1758 			cast(GClosureNotify)&callBackChangedDestroy,
1759 			connectFlags);
1760 		return wrapper.handlerId;
1761 	}
1762 
1763 	extern(C) static void callBackChanged(GtkTextBuffer* textbufferStruct, OnChangedDelegateWrapper wrapper)
1764 	{
1765 		wrapper.dlg(wrapper.outer);
1766 	}
1767 
1768 	extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
1769 	{
1770 		wrapper.remove(wrapper);
1771 	}
1772 
1773 	protected class OnDeleteRangeDelegateWrapper
1774 	{
1775 		void delegate(TextIter, TextIter, TextBuffer) dlg;
1776 		gulong handlerId;
1777 
1778 		this(void delegate(TextIter, TextIter, TextBuffer) dlg)
1779 		{
1780 			this.dlg = dlg;
1781 			onDeleteRangeListeners ~= this;
1782 		}
1783 
1784 		void remove(OnDeleteRangeDelegateWrapper source)
1785 		{
1786 			foreach(index, wrapper; onDeleteRangeListeners)
1787 			{
1788 				if (wrapper.handlerId == source.handlerId)
1789 				{
1790 					onDeleteRangeListeners[index] = null;
1791 					onDeleteRangeListeners = std.algorithm.remove(onDeleteRangeListeners, index);
1792 					break;
1793 				}
1794 			}
1795 		}
1796 	}
1797 	OnDeleteRangeDelegateWrapper[] onDeleteRangeListeners;
1798 
1799 	/**
1800 	 * The ::delete-range signal is emitted to delete a range
1801 	 * from a #GtkTextBuffer.
1802 	 *
1803 	 * Note that if your handler runs before the default handler it must not
1804 	 * invalidate the @start and @end iters (or has to revalidate them).
1805 	 * The default signal handler revalidates the @start and @end iters to
1806 	 * both point to the location where text was deleted. Handlers
1807 	 * which run after the default handler (see g_signal_connect_after())
1808 	 * do not have access to the deleted text.
1809 	 *
1810 	 * See also: gtk_text_buffer_delete().
1811 	 *
1812 	 * Params:
1813 	 *     start = the start of the range to be deleted
1814 	 *     end = the end of the range to be deleted
1815 	 */
1816 	gulong addOnDeleteRange(void delegate(TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1817 	{
1818 		auto wrapper = new OnDeleteRangeDelegateWrapper(dlg);
1819 		wrapper.handlerId = Signals.connectData(
1820 			this,
1821 			"delete-range",
1822 			cast(GCallback)&callBackDeleteRange,
1823 			cast(void*)wrapper,
1824 			cast(GClosureNotify)&callBackDeleteRangeDestroy,
1825 			connectFlags);
1826 		return wrapper.handlerId;
1827 	}
1828 
1829 	extern(C) static void callBackDeleteRange(GtkTextBuffer* textbufferStruct, GtkTextIter* start, GtkTextIter* end, OnDeleteRangeDelegateWrapper wrapper)
1830 	{
1831 		wrapper.dlg(ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
1832 	}
1833 
1834 	extern(C) static void callBackDeleteRangeDestroy(OnDeleteRangeDelegateWrapper wrapper, GClosure* closure)
1835 	{
1836 		wrapper.remove(wrapper);
1837 	}
1838 
1839 	protected class OnEndUserActionDelegateWrapper
1840 	{
1841 		void delegate(TextBuffer) dlg;
1842 		gulong handlerId;
1843 
1844 		this(void delegate(TextBuffer) dlg)
1845 		{
1846 			this.dlg = dlg;
1847 			onEndUserActionListeners ~= this;
1848 		}
1849 
1850 		void remove(OnEndUserActionDelegateWrapper source)
1851 		{
1852 			foreach(index, wrapper; onEndUserActionListeners)
1853 			{
1854 				if (wrapper.handlerId == source.handlerId)
1855 				{
1856 					onEndUserActionListeners[index] = null;
1857 					onEndUserActionListeners = std.algorithm.remove(onEndUserActionListeners, index);
1858 					break;
1859 				}
1860 			}
1861 		}
1862 	}
1863 	OnEndUserActionDelegateWrapper[] onEndUserActionListeners;
1864 
1865 	/**
1866 	 * The ::end-user-action signal is emitted at the end of a single
1867 	 * user-visible operation on the #GtkTextBuffer.
1868 	 *
1869 	 * See also:
1870 	 * gtk_text_buffer_end_user_action(),
1871 	 * gtk_text_buffer_insert_interactive(),
1872 	 * gtk_text_buffer_insert_range_interactive(),
1873 	 * gtk_text_buffer_delete_interactive(),
1874 	 * gtk_text_buffer_backspace(),
1875 	 * gtk_text_buffer_delete_selection(),
1876 	 * gtk_text_buffer_backspace().
1877 	 */
1878 	gulong addOnEndUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1879 	{
1880 		auto wrapper = new OnEndUserActionDelegateWrapper(dlg);
1881 		wrapper.handlerId = Signals.connectData(
1882 			this,
1883 			"end-user-action",
1884 			cast(GCallback)&callBackEndUserAction,
1885 			cast(void*)wrapper,
1886 			cast(GClosureNotify)&callBackEndUserActionDestroy,
1887 			connectFlags);
1888 		return wrapper.handlerId;
1889 	}
1890 
1891 	extern(C) static void callBackEndUserAction(GtkTextBuffer* textbufferStruct, OnEndUserActionDelegateWrapper wrapper)
1892 	{
1893 		wrapper.dlg(wrapper.outer);
1894 	}
1895 
1896 	extern(C) static void callBackEndUserActionDestroy(OnEndUserActionDelegateWrapper wrapper, GClosure* closure)
1897 	{
1898 		wrapper.remove(wrapper);
1899 	}
1900 
1901 	protected class OnInsertChildAnchorDelegateWrapper
1902 	{
1903 		void delegate(TextIter, TextChildAnchor, TextBuffer) dlg;
1904 		gulong handlerId;
1905 
1906 		this(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg)
1907 		{
1908 			this.dlg = dlg;
1909 			onInsertChildAnchorListeners ~= this;
1910 		}
1911 
1912 		void remove(OnInsertChildAnchorDelegateWrapper source)
1913 		{
1914 			foreach(index, wrapper; onInsertChildAnchorListeners)
1915 			{
1916 				if (wrapper.handlerId == source.handlerId)
1917 				{
1918 					onInsertChildAnchorListeners[index] = null;
1919 					onInsertChildAnchorListeners = std.algorithm.remove(onInsertChildAnchorListeners, index);
1920 					break;
1921 				}
1922 			}
1923 		}
1924 	}
1925 	OnInsertChildAnchorDelegateWrapper[] onInsertChildAnchorListeners;
1926 
1927 	/**
1928 	 * The ::insert-child-anchor signal is emitted to insert a
1929 	 * #GtkTextChildAnchor in a #GtkTextBuffer.
1930 	 * Insertion actually occurs in the default handler.
1931 	 *
1932 	 * Note that if your handler runs before the default handler it must
1933 	 * not invalidate the @location iter (or has to revalidate it).
1934 	 * The default signal handler revalidates it to be placed after the
1935 	 * inserted @anchor.
1936 	 *
1937 	 * See also: gtk_text_buffer_insert_child_anchor().
1938 	 *
1939 	 * Params:
1940 	 *     location = position to insert @anchor in @textbuffer
1941 	 *     anchor = the #GtkTextChildAnchor to be inserted
1942 	 */
1943 	gulong addOnInsertChildAnchor(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1944 	{
1945 		auto wrapper = new OnInsertChildAnchorDelegateWrapper(dlg);
1946 		wrapper.handlerId = Signals.connectData(
1947 			this,
1948 			"insert-child-anchor",
1949 			cast(GCallback)&callBackInsertChildAnchor,
1950 			cast(void*)wrapper,
1951 			cast(GClosureNotify)&callBackInsertChildAnchorDestroy,
1952 			connectFlags);
1953 		return wrapper.handlerId;
1954 	}
1955 
1956 	extern(C) static void callBackInsertChildAnchor(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextChildAnchor* anchor, OnInsertChildAnchorDelegateWrapper wrapper)
1957 	{
1958 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextChildAnchor)(anchor), wrapper.outer);
1959 	}
1960 
1961 	extern(C) static void callBackInsertChildAnchorDestroy(OnInsertChildAnchorDelegateWrapper wrapper, GClosure* closure)
1962 	{
1963 		wrapper.remove(wrapper);
1964 	}
1965 
1966 	protected class OnInsertPixbufDelegateWrapper
1967 	{
1968 		void delegate(TextIter, Pixbuf, TextBuffer) dlg;
1969 		gulong handlerId;
1970 
1971 		this(void delegate(TextIter, Pixbuf, TextBuffer) dlg)
1972 		{
1973 			this.dlg = dlg;
1974 			onInsertPixbufListeners ~= this;
1975 		}
1976 
1977 		void remove(OnInsertPixbufDelegateWrapper source)
1978 		{
1979 			foreach(index, wrapper; onInsertPixbufListeners)
1980 			{
1981 				if (wrapper.handlerId == source.handlerId)
1982 				{
1983 					onInsertPixbufListeners[index] = null;
1984 					onInsertPixbufListeners = std.algorithm.remove(onInsertPixbufListeners, index);
1985 					break;
1986 				}
1987 			}
1988 		}
1989 	}
1990 	OnInsertPixbufDelegateWrapper[] onInsertPixbufListeners;
1991 
1992 	/**
1993 	 * The ::insert-pixbuf signal is emitted to insert a #GdkPixbuf
1994 	 * in a #GtkTextBuffer. Insertion actually occurs in the default handler.
1995 	 *
1996 	 * Note that if your handler runs before the default handler it must not
1997 	 * invalidate the @location iter (or has to revalidate it).
1998 	 * The default signal handler revalidates it to be placed after the
1999 	 * inserted @pixbuf.
2000 	 *
2001 	 * See also: gtk_text_buffer_insert_pixbuf().
2002 	 *
2003 	 * Params:
2004 	 *     location = position to insert @pixbuf in @textbuffer
2005 	 *     pixbuf = the #GdkPixbuf to be inserted
2006 	 */
2007 	gulong addOnInsertPixbuf(void delegate(TextIter, Pixbuf, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2008 	{
2009 		auto wrapper = new OnInsertPixbufDelegateWrapper(dlg);
2010 		wrapper.handlerId = Signals.connectData(
2011 			this,
2012 			"insert-pixbuf",
2013 			cast(GCallback)&callBackInsertPixbuf,
2014 			cast(void*)wrapper,
2015 			cast(GClosureNotify)&callBackInsertPixbufDestroy,
2016 			connectFlags);
2017 		return wrapper.handlerId;
2018 	}
2019 
2020 	extern(C) static void callBackInsertPixbuf(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GdkPixbuf* pixbuf, OnInsertPixbufDelegateWrapper wrapper)
2021 	{
2022 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(Pixbuf)(pixbuf), wrapper.outer);
2023 	}
2024 
2025 	extern(C) static void callBackInsertPixbufDestroy(OnInsertPixbufDelegateWrapper wrapper, GClosure* closure)
2026 	{
2027 		wrapper.remove(wrapper);
2028 	}
2029 
2030 	protected class OnInsertTextDelegateWrapper
2031 	{
2032 		void delegate(TextIter, string, int, TextBuffer) dlg;
2033 		gulong handlerId;
2034 
2035 		this(void delegate(TextIter, string, int, TextBuffer) dlg)
2036 		{
2037 			this.dlg = dlg;
2038 			onInsertTextListeners ~= this;
2039 		}
2040 
2041 		void remove(OnInsertTextDelegateWrapper source)
2042 		{
2043 			foreach(index, wrapper; onInsertTextListeners)
2044 			{
2045 				if (wrapper.handlerId == source.handlerId)
2046 				{
2047 					onInsertTextListeners[index] = null;
2048 					onInsertTextListeners = std.algorithm.remove(onInsertTextListeners, index);
2049 					break;
2050 				}
2051 			}
2052 		}
2053 	}
2054 	OnInsertTextDelegateWrapper[] onInsertTextListeners;
2055 
2056 	/**
2057 	 * The ::insert-text signal is emitted to insert text in a #GtkTextBuffer.
2058 	 * Insertion actually occurs in the default handler.
2059 	 *
2060 	 * Note that if your handler runs before the default handler it must not
2061 	 * invalidate the @location iter (or has to revalidate it).
2062 	 * The default signal handler revalidates it to point to the end of the
2063 	 * inserted text.
2064 	 *
2065 	 * See also:
2066 	 * gtk_text_buffer_insert(),
2067 	 * gtk_text_buffer_insert_range().
2068 	 *
2069 	 * Params:
2070 	 *     location = position to insert @text in @textbuffer
2071 	 *     text = the UTF-8 text to be inserted
2072 	 *     len = length of the inserted text in bytes
2073 	 */
2074 	gulong addOnInsertText(void delegate(TextIter, string, int, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2075 	{
2076 		auto wrapper = new OnInsertTextDelegateWrapper(dlg);
2077 		wrapper.handlerId = Signals.connectData(
2078 			this,
2079 			"insert-text",
2080 			cast(GCallback)&callBackInsertText,
2081 			cast(void*)wrapper,
2082 			cast(GClosureNotify)&callBackInsertTextDestroy,
2083 			connectFlags);
2084 		return wrapper.handlerId;
2085 	}
2086 
2087 	extern(C) static void callBackInsertText(GtkTextBuffer* textbufferStruct, GtkTextIter* location, char* text, int len, OnInsertTextDelegateWrapper wrapper)
2088 	{
2089 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), Str.toString(text), len, wrapper.outer);
2090 	}
2091 
2092 	extern(C) static void callBackInsertTextDestroy(OnInsertTextDelegateWrapper wrapper, GClosure* closure)
2093 	{
2094 		wrapper.remove(wrapper);
2095 	}
2096 
2097 	protected class OnMarkDeletedDelegateWrapper
2098 	{
2099 		void delegate(TextMark, TextBuffer) dlg;
2100 		gulong handlerId;
2101 
2102 		this(void delegate(TextMark, TextBuffer) dlg)
2103 		{
2104 			this.dlg = dlg;
2105 			onMarkDeletedListeners ~= this;
2106 		}
2107 
2108 		void remove(OnMarkDeletedDelegateWrapper source)
2109 		{
2110 			foreach(index, wrapper; onMarkDeletedListeners)
2111 			{
2112 				if (wrapper.handlerId == source.handlerId)
2113 				{
2114 					onMarkDeletedListeners[index] = null;
2115 					onMarkDeletedListeners = std.algorithm.remove(onMarkDeletedListeners, index);
2116 					break;
2117 				}
2118 			}
2119 		}
2120 	}
2121 	OnMarkDeletedDelegateWrapper[] onMarkDeletedListeners;
2122 
2123 	/**
2124 	 * The ::mark-deleted signal is emitted as notification
2125 	 * after a #GtkTextMark is deleted.
2126 	 *
2127 	 * See also:
2128 	 * gtk_text_buffer_delete_mark().
2129 	 *
2130 	 * Params:
2131 	 *     mark = The mark that was deleted
2132 	 */
2133 	gulong addOnMarkDeleted(void delegate(TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2134 	{
2135 		auto wrapper = new OnMarkDeletedDelegateWrapper(dlg);
2136 		wrapper.handlerId = Signals.connectData(
2137 			this,
2138 			"mark-deleted",
2139 			cast(GCallback)&callBackMarkDeleted,
2140 			cast(void*)wrapper,
2141 			cast(GClosureNotify)&callBackMarkDeletedDestroy,
2142 			connectFlags);
2143 		return wrapper.handlerId;
2144 	}
2145 
2146 	extern(C) static void callBackMarkDeleted(GtkTextBuffer* textbufferStruct, GtkTextMark* mark, OnMarkDeletedDelegateWrapper wrapper)
2147 	{
2148 		wrapper.dlg(ObjectG.getDObject!(TextMark)(mark), wrapper.outer);
2149 	}
2150 
2151 	extern(C) static void callBackMarkDeletedDestroy(OnMarkDeletedDelegateWrapper wrapper, GClosure* closure)
2152 	{
2153 		wrapper.remove(wrapper);
2154 	}
2155 
2156 	protected class OnMarkSetDelegateWrapper
2157 	{
2158 		void delegate(TextIter, TextMark, TextBuffer) dlg;
2159 		gulong handlerId;
2160 
2161 		this(void delegate(TextIter, TextMark, TextBuffer) dlg)
2162 		{
2163 			this.dlg = dlg;
2164 			onMarkSetListeners ~= this;
2165 		}
2166 
2167 		void remove(OnMarkSetDelegateWrapper source)
2168 		{
2169 			foreach(index, wrapper; onMarkSetListeners)
2170 			{
2171 				if (wrapper.handlerId == source.handlerId)
2172 				{
2173 					onMarkSetListeners[index] = null;
2174 					onMarkSetListeners = std.algorithm.remove(onMarkSetListeners, index);
2175 					break;
2176 				}
2177 			}
2178 		}
2179 	}
2180 	OnMarkSetDelegateWrapper[] onMarkSetListeners;
2181 
2182 	/**
2183 	 * The ::mark-set signal is emitted as notification
2184 	 * after a #GtkTextMark is set.
2185 	 *
2186 	 * See also:
2187 	 * gtk_text_buffer_create_mark(),
2188 	 * gtk_text_buffer_move_mark().
2189 	 *
2190 	 * Params:
2191 	 *     location = The location of @mark in @textbuffer
2192 	 *     mark = The mark that is set
2193 	 */
2194 	gulong addOnMarkSet(void delegate(TextIter, TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2195 	{
2196 		auto wrapper = new OnMarkSetDelegateWrapper(dlg);
2197 		wrapper.handlerId = Signals.connectData(
2198 			this,
2199 			"mark-set",
2200 			cast(GCallback)&callBackMarkSet,
2201 			cast(void*)wrapper,
2202 			cast(GClosureNotify)&callBackMarkSetDestroy,
2203 			connectFlags);
2204 		return wrapper.handlerId;
2205 	}
2206 
2207 	extern(C) static void callBackMarkSet(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextMark* mark, OnMarkSetDelegateWrapper wrapper)
2208 	{
2209 		wrapper.dlg(ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextMark)(mark), wrapper.outer);
2210 	}
2211 
2212 	extern(C) static void callBackMarkSetDestroy(OnMarkSetDelegateWrapper wrapper, GClosure* closure)
2213 	{
2214 		wrapper.remove(wrapper);
2215 	}
2216 
2217 	protected class OnModifiedChangedDelegateWrapper
2218 	{
2219 		void delegate(TextBuffer) dlg;
2220 		gulong handlerId;
2221 
2222 		this(void delegate(TextBuffer) dlg)
2223 		{
2224 			this.dlg = dlg;
2225 			onModifiedChangedListeners ~= this;
2226 		}
2227 
2228 		void remove(OnModifiedChangedDelegateWrapper source)
2229 		{
2230 			foreach(index, wrapper; onModifiedChangedListeners)
2231 			{
2232 				if (wrapper.handlerId == source.handlerId)
2233 				{
2234 					onModifiedChangedListeners[index] = null;
2235 					onModifiedChangedListeners = std.algorithm.remove(onModifiedChangedListeners, index);
2236 					break;
2237 				}
2238 			}
2239 		}
2240 	}
2241 	OnModifiedChangedDelegateWrapper[] onModifiedChangedListeners;
2242 
2243 	/**
2244 	 * The ::modified-changed signal is emitted when the modified bit of a
2245 	 * #GtkTextBuffer flips.
2246 	 *
2247 	 * See also:
2248 	 * gtk_text_buffer_set_modified().
2249 	 */
2250 	gulong addOnModifiedChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2251 	{
2252 		auto wrapper = new OnModifiedChangedDelegateWrapper(dlg);
2253 		wrapper.handlerId = Signals.connectData(
2254 			this,
2255 			"modified-changed",
2256 			cast(GCallback)&callBackModifiedChanged,
2257 			cast(void*)wrapper,
2258 			cast(GClosureNotify)&callBackModifiedChangedDestroy,
2259 			connectFlags);
2260 		return wrapper.handlerId;
2261 	}
2262 
2263 	extern(C) static void callBackModifiedChanged(GtkTextBuffer* textbufferStruct, OnModifiedChangedDelegateWrapper wrapper)
2264 	{
2265 		wrapper.dlg(wrapper.outer);
2266 	}
2267 
2268 	extern(C) static void callBackModifiedChangedDestroy(OnModifiedChangedDelegateWrapper wrapper, GClosure* closure)
2269 	{
2270 		wrapper.remove(wrapper);
2271 	}
2272 
2273 	protected class OnPasteDoneDelegateWrapper
2274 	{
2275 		void delegate(Clipboard, TextBuffer) dlg;
2276 		gulong handlerId;
2277 
2278 		this(void delegate(Clipboard, TextBuffer) dlg)
2279 		{
2280 			this.dlg = dlg;
2281 			onPasteDoneListeners ~= this;
2282 		}
2283 
2284 		void remove(OnPasteDoneDelegateWrapper source)
2285 		{
2286 			foreach(index, wrapper; onPasteDoneListeners)
2287 			{
2288 				if (wrapper.handlerId == source.handlerId)
2289 				{
2290 					onPasteDoneListeners[index] = null;
2291 					onPasteDoneListeners = std.algorithm.remove(onPasteDoneListeners, index);
2292 					break;
2293 				}
2294 			}
2295 		}
2296 	}
2297 	OnPasteDoneDelegateWrapper[] onPasteDoneListeners;
2298 
2299 	/**
2300 	 * The paste-done signal is emitted after paste operation has been completed.
2301 	 * This is useful to properly scroll the view to the end of the pasted text.
2302 	 * See gtk_text_buffer_paste_clipboard() for more details.
2303 	 *
2304 	 * Params:
2305 	 *     clipboard = the #GtkClipboard pasted from
2306 	 *
2307 	 * Since: 2.16
2308 	 */
2309 	gulong addOnPasteDone(void delegate(Clipboard, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2310 	{
2311 		auto wrapper = new OnPasteDoneDelegateWrapper(dlg);
2312 		wrapper.handlerId = Signals.connectData(
2313 			this,
2314 			"paste-done",
2315 			cast(GCallback)&callBackPasteDone,
2316 			cast(void*)wrapper,
2317 			cast(GClosureNotify)&callBackPasteDoneDestroy,
2318 			connectFlags);
2319 		return wrapper.handlerId;
2320 	}
2321 
2322 	extern(C) static void callBackPasteDone(GtkTextBuffer* textbufferStruct, GtkClipboard* clipboard, OnPasteDoneDelegateWrapper wrapper)
2323 	{
2324 		wrapper.dlg(ObjectG.getDObject!(Clipboard)(clipboard), wrapper.outer);
2325 	}
2326 
2327 	extern(C) static void callBackPasteDoneDestroy(OnPasteDoneDelegateWrapper wrapper, GClosure* closure)
2328 	{
2329 		wrapper.remove(wrapper);
2330 	}
2331 
2332 	protected class OnRemoveTagDelegateWrapper
2333 	{
2334 		void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg;
2335 		gulong handlerId;
2336 
2337 		this(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg)
2338 		{
2339 			this.dlg = dlg;
2340 			onRemoveTagListeners ~= this;
2341 		}
2342 
2343 		void remove(OnRemoveTagDelegateWrapper source)
2344 		{
2345 			foreach(index, wrapper; onRemoveTagListeners)
2346 			{
2347 				if (wrapper.handlerId == source.handlerId)
2348 				{
2349 					onRemoveTagListeners[index] = null;
2350 					onRemoveTagListeners = std.algorithm.remove(onRemoveTagListeners, index);
2351 					break;
2352 				}
2353 			}
2354 		}
2355 	}
2356 	OnRemoveTagDelegateWrapper[] onRemoveTagListeners;
2357 
2358 	/**
2359 	 * The ::remove-tag signal is emitted to remove all occurrences of @tag from
2360 	 * a range of text in a #GtkTextBuffer.
2361 	 * Removal actually occurs in the default handler.
2362 	 *
2363 	 * Note that if your handler runs before the default handler it must not
2364 	 * invalidate the @start and @end iters (or has to revalidate them).
2365 	 *
2366 	 * See also:
2367 	 * gtk_text_buffer_remove_tag().
2368 	 *
2369 	 * Params:
2370 	 *     tag = the tag to be removed
2371 	 *     start = the start of the range the tag is removed from
2372 	 *     end = the end of the range the tag is removed from
2373 	 */
2374 	gulong addOnRemoveTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2375 	{
2376 		auto wrapper = new OnRemoveTagDelegateWrapper(dlg);
2377 		wrapper.handlerId = Signals.connectData(
2378 			this,
2379 			"remove-tag",
2380 			cast(GCallback)&callBackRemoveTag,
2381 			cast(void*)wrapper,
2382 			cast(GClosureNotify)&callBackRemoveTagDestroy,
2383 			connectFlags);
2384 		return wrapper.handlerId;
2385 	}
2386 
2387 	extern(C) static void callBackRemoveTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, OnRemoveTagDelegateWrapper wrapper)
2388 	{
2389 		wrapper.dlg(ObjectG.getDObject!(TextTag)(tag), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
2390 	}
2391 
2392 	extern(C) static void callBackRemoveTagDestroy(OnRemoveTagDelegateWrapper wrapper, GClosure* closure)
2393 	{
2394 		wrapper.remove(wrapper);
2395 	}
2396 }