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