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