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.TextView;
26 
27 private import gdk.Window;
28 private import glib.ConstructionException;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gtk.Container;
33 private import gtk.ScrollableIF;
34 private import gtk.ScrollableT;
35 private import gtk.TextAttributes;
36 private import gtk.TextBuffer;
37 private import gtk.TextChildAnchor;
38 private import gtk.TextIter;
39 private import gtk.TextMark;
40 private import gtk.Widget;
41 private import gtk.c.functions;
42 public  import gtk.c.types;
43 public  import gtkc.gtktypes;
44 private import pango.PgTabArray;
45 private import std.algorithm;
46 
47 
48 /**
49  * You may wish to begin by reading the
50  * [text widget conceptual overview][TextWidget]
51  * which gives an overview of all the objects and data
52  * types related to the text widget and how they work together.
53  * 
54  * # CSS nodes
55  * 
56  * |[<!-- language="plain" -->
57  * textview.view
58  * ├── border.top
59  * ├── border.left
60  * ├── text
61  * │   ╰── [selection]
62  * ├── border.right
63  * ├── border.bottom
64  * ╰── [window.popup]
65  * ]|
66  * 
67  * GtkTextView has a main css node with name textview and style class .view,
68  * and subnodes for each of the border windows, and the main text area,
69  * with names border and text, respectively. The border nodes each get
70  * one of the style classes .left, .right, .top or .bottom.
71  * 
72  * A node representing the selection will appear below the text node.
73  * 
74  * If a context menu is opened, the window node will appear as a subnode
75  * of the main node.
76  */
77 public class TextView : Container, ScrollableIF
78 {
79 	/** the main Gtk struct */
80 	protected GtkTextView* gtkTextView;
81 
82 	/** Get the main Gtk struct */
83 	public GtkTextView* getTextViewStruct(bool transferOwnership = false)
84 	{
85 		if (transferOwnership)
86 			ownedRef = false;
87 		return gtkTextView;
88 	}
89 
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gtkTextView;
94 	}
95 
96 	protected override void setStruct(GObject* obj)
97 	{
98 		gtkTextView = cast(GtkTextView*)obj;
99 		super.setStruct(obj);
100 	}
101 
102 	/**
103 	 * Sets our main struct and passes it to the parent class.
104 	 */
105 	public this (GtkTextView* gtkTextView, bool ownedRef = false)
106 	{
107 		this.gtkTextView = gtkTextView;
108 		super(cast(GtkContainer*)gtkTextView, ownedRef);
109 	}
110 
111 	// add the Scrollable capabilities
112 	mixin ScrollableT!(GtkTextView);
113 
114 	/**
115 	 * Get the text line at the pixel y
116 	 */
117 	string getLineTextAt(int y)
118 	{
119 
120 		TextIter iter = new TextIter();
121 		int windowX;
122 		int windowY;
123 		bufferToWindowCoords(TextWindowType.TEXT, 0, y, windowX, windowY);
124 
125 		gtk_text_view_get_line_at_y(gtkTextView, iter.getTextIterStruct(), y+y-windowY, null);
126 
127 		TextIter iterEnd = new TextIter();
128 		TextBuffer buffer = getBuffer();
129 		buffer.getIterAtOffset(iterEnd, iter.getOffset()+iter.getCharsInLine());
130 		return buffer.getText(iter, iterEnd, false);
131 	}
132 
133 	/**
134 	 * Simply appends some on the cursor position
135 	 * Params:
136 	 *  text = the text to append
137 	 */
138 	void insertText(string text)
139 	{
140 		TextBuffer buf = getBuffer();
141 		buf.insertAtCursor(text);
142 	}
143 
144 	/**
145 	 * Simply appends some text to this view
146 	 * Params:
147 	 *  text = the text to append
148 	 */
149 	void appendText(string text, bool ensureVisible=true)
150 	{
151 		TextBuffer buf = getBuffer();
152 		TextIter iter = new TextIter();
153 		buf.getEndIter(iter);
154 		buf.insert(iter, text);
155 		if ( ensureVisible )
156 		{
157 			double within_margin = 0.0;
158 			bool use_align = false;
159 			double xalign = 0.0;
160 			double yalign = 0.0;
161 			scrollToMark(buf.createMark("",iter,true), within_margin, use_align, xalign, yalign);
162 		}
163 	}
164 
165 	/**
166 	 */
167 
168 	/** */
169 	public static GType getType()
170 	{
171 		return gtk_text_view_get_type();
172 	}
173 
174 	/**
175 	 * Creates a new #GtkTextView. If you don’t call gtk_text_view_set_buffer()
176 	 * before using the text view, an empty default buffer will be created
177 	 * for you. Get the buffer with gtk_text_view_get_buffer(). If you want
178 	 * to specify your own buffer, consider gtk_text_view_new_with_buffer().
179 	 *
180 	 * Returns: a new #GtkTextView
181 	 *
182 	 * Throws: ConstructionException GTK+ fails to create the object.
183 	 */
184 	public this()
185 	{
186 		auto p = gtk_text_view_new();
187 
188 		if(p is null)
189 		{
190 			throw new ConstructionException("null returned by new");
191 		}
192 
193 		this(cast(GtkTextView*) p);
194 	}
195 
196 	/**
197 	 * Creates a new #GtkTextView widget displaying the buffer
198 	 * @buffer. One buffer can be shared among many widgets.
199 	 * @buffer may be %NULL to create a default buffer, in which case
200 	 * this function is equivalent to gtk_text_view_new(). The
201 	 * text view adds its own reference count to the buffer; it does not
202 	 * take over an existing reference.
203 	 *
204 	 * Params:
205 	 *     buffer = a #GtkTextBuffer
206 	 *
207 	 * Returns: a new #GtkTextView.
208 	 *
209 	 * Throws: ConstructionException GTK+ fails to create the object.
210 	 */
211 	public this(TextBuffer buffer)
212 	{
213 		auto p = gtk_text_view_new_with_buffer((buffer is null) ? null : buffer.getTextBufferStruct());
214 
215 		if(p is null)
216 		{
217 			throw new ConstructionException("null returned by new_with_buffer");
218 		}
219 
220 		this(cast(GtkTextView*) p);
221 	}
222 
223 	/**
224 	 * Adds a child widget in the text buffer, at the given @anchor.
225 	 *
226 	 * Params:
227 	 *     child = a #GtkWidget
228 	 *     anchor = a #GtkTextChildAnchor in the #GtkTextBuffer for @text_view
229 	 */
230 	public void addChildAtAnchor(Widget child, TextChildAnchor anchor)
231 	{
232 		gtk_text_view_add_child_at_anchor(gtkTextView, (child is null) ? null : child.getWidgetStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
233 	}
234 
235 	/**
236 	 * Adds a child at fixed coordinates in one of the text widget's
237 	 * windows.
238 	 *
239 	 * The window must have nonzero size (see
240 	 * gtk_text_view_set_border_window_size()). Note that the child
241 	 * coordinates are given relative to scrolling. When
242 	 * placing a child in #GTK_TEXT_WINDOW_WIDGET, scrolling is
243 	 * irrelevant, the child floats above all scrollable areas. But when
244 	 * placing a child in one of the scrollable windows (border windows or
245 	 * text window) it will move with the scrolling as needed.
246 	 *
247 	 * Params:
248 	 *     child = a #GtkWidget
249 	 *     whichWindow = which window the child should appear in
250 	 *     xpos = X position of child in window coordinates
251 	 *     ypos = Y position of child in window coordinates
252 	 */
253 	public void addChildInWindow(Widget child, GtkTextWindowType whichWindow, int xpos, int ypos)
254 	{
255 		gtk_text_view_add_child_in_window(gtkTextView, (child is null) ? null : child.getWidgetStruct(), whichWindow, xpos, ypos);
256 	}
257 
258 	/**
259 	 * Moves the given @iter backward by one display (wrapped) line.
260 	 * A display line is different from a paragraph. Paragraphs are
261 	 * separated by newlines or other paragraph separator characters.
262 	 * Display lines are created by line-wrapping a paragraph. If
263 	 * wrapping is turned off, display lines and paragraphs will be the
264 	 * same. Display lines are divided differently for each view, since
265 	 * they depend on the view’s width; paragraphs are the same in all
266 	 * views, since they depend on the contents of the #GtkTextBuffer.
267 	 *
268 	 * Params:
269 	 *     iter = a #GtkTextIter
270 	 *
271 	 * Returns: %TRUE if @iter was moved and is not on the end iterator
272 	 */
273 	public bool backwardDisplayLine(TextIter iter)
274 	{
275 		return gtk_text_view_backward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
276 	}
277 
278 	/**
279 	 * Moves the given @iter backward to the next display line start.
280 	 * A display line is different from a paragraph. Paragraphs are
281 	 * separated by newlines or other paragraph separator characters.
282 	 * Display lines are created by line-wrapping a paragraph. If
283 	 * wrapping is turned off, display lines and paragraphs will be the
284 	 * same. Display lines are divided differently for each view, since
285 	 * they depend on the view’s width; paragraphs are the same in all
286 	 * views, since they depend on the contents of the #GtkTextBuffer.
287 	 *
288 	 * Params:
289 	 *     iter = a #GtkTextIter
290 	 *
291 	 * Returns: %TRUE if @iter was moved and is not on the end iterator
292 	 */
293 	public bool backwardDisplayLineStart(TextIter iter)
294 	{
295 		return gtk_text_view_backward_display_line_start(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
296 	}
297 
298 	/**
299 	 * Converts coordinate (@buffer_x, @buffer_y) to coordinates for the window
300 	 * @win, and stores the result in (@window_x, @window_y).
301 	 *
302 	 * Note that you can’t convert coordinates for a nonexisting window (see
303 	 * gtk_text_view_set_border_window_size()).
304 	 *
305 	 * Params:
306 	 *     win = a #GtkTextWindowType, except %GTK_TEXT_WINDOW_PRIVATE
307 	 *     bufferX = buffer x coordinate
308 	 *     bufferY = buffer y coordinate
309 	 *     windowX = window x coordinate return location or %NULL
310 	 *     windowY = window y coordinate return location or %NULL
311 	 */
312 	public void bufferToWindowCoords(GtkTextWindowType win, int bufferX, int bufferY, out int windowX, out int windowY)
313 	{
314 		gtk_text_view_buffer_to_window_coords(gtkTextView, win, bufferX, bufferY, &windowX, &windowY);
315 	}
316 
317 	/**
318 	 * Moves the given @iter forward by one display (wrapped) line.
319 	 * A display line is different from a paragraph. Paragraphs are
320 	 * separated by newlines or other paragraph separator characters.
321 	 * Display lines are created by line-wrapping a paragraph. If
322 	 * wrapping is turned off, display lines and paragraphs will be the
323 	 * same. Display lines are divided differently for each view, since
324 	 * they depend on the view’s width; paragraphs are the same in all
325 	 * views, since they depend on the contents of the #GtkTextBuffer.
326 	 *
327 	 * Params:
328 	 *     iter = a #GtkTextIter
329 	 *
330 	 * Returns: %TRUE if @iter was moved and is not on the end iterator
331 	 */
332 	public bool forwardDisplayLine(TextIter iter)
333 	{
334 		return gtk_text_view_forward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
335 	}
336 
337 	/**
338 	 * Moves the given @iter forward to the next display line end.
339 	 * A display line is different from a paragraph. Paragraphs are
340 	 * separated by newlines or other paragraph separator characters.
341 	 * Display lines are created by line-wrapping a paragraph. If
342 	 * wrapping is turned off, display lines and paragraphs will be the
343 	 * same. Display lines are divided differently for each view, since
344 	 * they depend on the view’s width; paragraphs are the same in all
345 	 * views, since they depend on the contents of the #GtkTextBuffer.
346 	 *
347 	 * Params:
348 	 *     iter = a #GtkTextIter
349 	 *
350 	 * Returns: %TRUE if @iter was moved and is not on the end iterator
351 	 */
352 	public bool forwardDisplayLineEnd(TextIter iter)
353 	{
354 		return gtk_text_view_forward_display_line_end(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
355 	}
356 
357 	/**
358 	 * Returns whether pressing the Tab key inserts a tab characters.
359 	 * gtk_text_view_set_accepts_tab().
360 	 *
361 	 * Returns: %TRUE if pressing the Tab key inserts a tab character,
362 	 *     %FALSE if pressing the Tab key moves the keyboard focus.
363 	 *
364 	 * Since: 2.4
365 	 */
366 	public bool getAcceptsTab()
367 	{
368 		return gtk_text_view_get_accepts_tab(gtkTextView) != 0;
369 	}
370 
371 	/**
372 	 * Gets the width of the specified border window. See
373 	 * gtk_text_view_set_border_window_size().
374 	 *
375 	 * Params:
376 	 *     type = window to return size from
377 	 *
378 	 * Returns: width of window
379 	 */
380 	public int getBorderWindowSize(GtkTextWindowType type)
381 	{
382 		return gtk_text_view_get_border_window_size(gtkTextView, type);
383 	}
384 
385 	/**
386 	 * Gets the bottom margin for text in the @text_view.
387 	 *
388 	 * Returns: bottom margin in pixels
389 	 *
390 	 * Since: 3.18
391 	 */
392 	public int getBottomMargin()
393 	{
394 		return gtk_text_view_get_bottom_margin(gtkTextView);
395 	}
396 
397 	/**
398 	 * Returns the #GtkTextBuffer being displayed by this text view.
399 	 * The reference count on the buffer is not incremented; the caller
400 	 * of this function won’t own a new reference.
401 	 *
402 	 * Returns: a #GtkTextBuffer
403 	 */
404 	public TextBuffer getBuffer()
405 	{
406 		auto p = gtk_text_view_get_buffer(gtkTextView);
407 
408 		if(p is null)
409 		{
410 			return null;
411 		}
412 
413 		return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p);
414 	}
415 
416 	/**
417 	 * Given an @iter within a text layout, determine the positions of the
418 	 * strong and weak cursors if the insertion point is at that
419 	 * iterator. The position of each cursor is stored as a zero-width
420 	 * rectangle. The strong cursor location is the location where
421 	 * characters of the directionality equal to the base direction of the
422 	 * paragraph are inserted.  The weak cursor location is the location
423 	 * where characters of the directionality opposite to the base
424 	 * direction of the paragraph are inserted.
425 	 *
426 	 * If @iter is %NULL, the actual cursor position is used.
427 	 *
428 	 * Note that if @iter happens to be the actual cursor position, and
429 	 * there is currently an IM preedit sequence being entered, the
430 	 * returned locations will be adjusted to account for the preedit
431 	 * cursor’s offset within the preedit sequence.
432 	 *
433 	 * The rectangle position is in buffer coordinates; use
434 	 * gtk_text_view_buffer_to_window_coords() to convert these
435 	 * coordinates to coordinates for one of the windows in the text view.
436 	 *
437 	 * Params:
438 	 *     iter = a #GtkTextIter
439 	 *     strong = location to store the strong
440 	 *         cursor position (may be %NULL)
441 	 *     weak = location to store the weak
442 	 *         cursor position (may be %NULL)
443 	 *
444 	 * Since: 3.0
445 	 */
446 	public void getCursorLocations(TextIter iter, out GdkRectangle strong, out GdkRectangle weak)
447 	{
448 		gtk_text_view_get_cursor_locations(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &strong, &weak);
449 	}
450 
451 	/**
452 	 * Find out whether the cursor should be displayed.
453 	 *
454 	 * Returns: whether the insertion mark is visible
455 	 */
456 	public bool getCursorVisible()
457 	{
458 		return gtk_text_view_get_cursor_visible(gtkTextView) != 0;
459 	}
460 
461 	/**
462 	 * Obtains a copy of the default text attributes. These are the
463 	 * attributes used for text unless a tag overrides them.
464 	 * You’d typically pass the default attributes in to
465 	 * gtk_text_iter_get_attributes() in order to get the
466 	 * attributes in effect at a given text position.
467 	 *
468 	 * The return value is a copy owned by the caller of this function,
469 	 * and should be freed with gtk_text_attributes_unref().
470 	 *
471 	 * Returns: a new #GtkTextAttributes
472 	 */
473 	public TextAttributes getDefaultAttributes()
474 	{
475 		auto p = gtk_text_view_get_default_attributes(gtkTextView);
476 
477 		if(p is null)
478 		{
479 			return null;
480 		}
481 
482 		return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p, true);
483 	}
484 
485 	/**
486 	 * Returns the default editability of the #GtkTextView. Tags in the
487 	 * buffer may override this setting for some ranges of text.
488 	 *
489 	 * Returns: whether text is editable by default
490 	 */
491 	public bool getEditable()
492 	{
493 		return gtk_text_view_get_editable(gtkTextView) != 0;
494 	}
495 
496 	/**
497 	 * Gets the default indentation of paragraphs in @text_view.
498 	 * Tags in the view’s buffer may override the default.
499 	 * The indentation may be negative.
500 	 *
501 	 * Returns: number of pixels of indentation
502 	 */
503 	public int getIndent()
504 	{
505 		return gtk_text_view_get_indent(gtkTextView);
506 	}
507 
508 	/**
509 	 * Gets the value of the #GtkTextView:input-hints property.
510 	 *
511 	 * Since: 3.6
512 	 */
513 	public GtkInputHints getInputHints()
514 	{
515 		return gtk_text_view_get_input_hints(gtkTextView);
516 	}
517 
518 	/**
519 	 * Gets the value of the #GtkTextView:input-purpose property.
520 	 *
521 	 * Since: 3.6
522 	 */
523 	public GtkInputPurpose getInputPurpose()
524 	{
525 		return gtk_text_view_get_input_purpose(gtkTextView);
526 	}
527 
528 	/**
529 	 * Retrieves the iterator at buffer coordinates @x and @y. Buffer
530 	 * coordinates are coordinates for the entire buffer, not just the
531 	 * currently-displayed portion.  If you have coordinates from an
532 	 * event, you have to convert those to buffer coordinates with
533 	 * gtk_text_view_window_to_buffer_coords().
534 	 *
535 	 * Params:
536 	 *     iter = a #GtkTextIter
537 	 *     x = x position, in buffer coordinates
538 	 *     y = y position, in buffer coordinates
539 	 *
540 	 * Returns: %TRUE if the position is over text
541 	 */
542 	public bool getIterAtLocation(out TextIter iter, int x, int y)
543 	{
544 		GtkTextIter* outiter = gMalloc!GtkTextIter();
545 
546 		auto p = gtk_text_view_get_iter_at_location(gtkTextView, outiter, x, y) != 0;
547 
548 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
549 
550 		return p;
551 	}
552 
553 	/**
554 	 * Retrieves the iterator pointing to the character at buffer
555 	 * coordinates @x and @y. Buffer coordinates are coordinates for
556 	 * the entire buffer, not just the currently-displayed portion.
557 	 * If you have coordinates from an event, you have to convert
558 	 * those to buffer coordinates with
559 	 * gtk_text_view_window_to_buffer_coords().
560 	 *
561 	 * Note that this is different from gtk_text_view_get_iter_at_location(),
562 	 * which returns cursor locations, i.e. positions between
563 	 * characters.
564 	 *
565 	 * Params:
566 	 *     iter = a #GtkTextIter
567 	 *     trailing = if non-%NULL, location to store an integer indicating where
568 	 *         in the grapheme the user clicked. It will either be
569 	 *         zero, or the number of characters in the grapheme.
570 	 *         0 represents the trailing edge of the grapheme.
571 	 *     x = x position, in buffer coordinates
572 	 *     y = y position, in buffer coordinates
573 	 *
574 	 * Returns: %TRUE if the position is over text
575 	 *
576 	 * Since: 2.6
577 	 */
578 	public bool getIterAtPosition(out TextIter iter, out int trailing, int x, int y)
579 	{
580 		GtkTextIter* outiter = gMalloc!GtkTextIter();
581 
582 		auto p = gtk_text_view_get_iter_at_position(gtkTextView, outiter, &trailing, x, y) != 0;
583 
584 		iter = ObjectG.getDObject!(TextIter)(outiter, true);
585 
586 		return p;
587 	}
588 
589 	/**
590 	 * Gets a rectangle which roughly contains the character at @iter.
591 	 * The rectangle position is in buffer coordinates; use
592 	 * gtk_text_view_buffer_to_window_coords() to convert these
593 	 * coordinates to coordinates for one of the windows in the text view.
594 	 *
595 	 * Params:
596 	 *     iter = a #GtkTextIter
597 	 *     location = bounds of the character at @iter
598 	 */
599 	public void getIterLocation(TextIter iter, out GdkRectangle location)
600 	{
601 		gtk_text_view_get_iter_location(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &location);
602 	}
603 
604 	/**
605 	 * Gets the default justification of paragraphs in @text_view.
606 	 * Tags in the buffer may override the default.
607 	 *
608 	 * Returns: default justification
609 	 */
610 	public GtkJustification getJustification()
611 	{
612 		return gtk_text_view_get_justification(gtkTextView);
613 	}
614 
615 	/**
616 	 * Gets the default left margin size of paragraphs in the @text_view.
617 	 * Tags in the buffer may override the default.
618 	 *
619 	 * Returns: left margin in pixels
620 	 */
621 	public int getLeftMargin()
622 	{
623 		return gtk_text_view_get_left_margin(gtkTextView);
624 	}
625 
626 	/**
627 	 * Gets the #GtkTextIter at the start of the line containing
628 	 * the coordinate @y. @y is in buffer coordinates, convert from
629 	 * window coordinates with gtk_text_view_window_to_buffer_coords().
630 	 * If non-%NULL, @line_top will be filled with the coordinate of the top
631 	 * edge of the line.
632 	 *
633 	 * Params:
634 	 *     targetIter = a #GtkTextIter
635 	 *     y = a y coordinate
636 	 *     lineTop = return location for top coordinate of the line
637 	 */
638 	public void getLineAtY(out TextIter targetIter, int y, out int lineTop)
639 	{
640 		GtkTextIter* outtargetIter = gMalloc!GtkTextIter();
641 
642 		gtk_text_view_get_line_at_y(gtkTextView, outtargetIter, y, &lineTop);
643 
644 		targetIter = ObjectG.getDObject!(TextIter)(outtargetIter, true);
645 	}
646 
647 	/**
648 	 * Gets the y coordinate of the top of the line containing @iter,
649 	 * and the height of the line. The coordinate is a buffer coordinate;
650 	 * convert to window coordinates with gtk_text_view_buffer_to_window_coords().
651 	 *
652 	 * Params:
653 	 *     iter = a #GtkTextIter
654 	 *     y = return location for a y coordinate
655 	 *     height = return location for a height
656 	 */
657 	public void getLineYrange(TextIter iter, out int y, out int height)
658 	{
659 		gtk_text_view_get_line_yrange(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &y, &height);
660 	}
661 
662 	/**
663 	 * Gets the value of the #GtkTextView:monospace property.
664 	 *
665 	 * Returns: %TRUE if monospace fonts are desired
666 	 *
667 	 * Since: 3.16
668 	 */
669 	public bool getMonospace()
670 	{
671 		return gtk_text_view_get_monospace(gtkTextView) != 0;
672 	}
673 
674 	/**
675 	 * Returns whether the #GtkTextView is in overwrite mode or not.
676 	 *
677 	 * Returns: whether @text_view is in overwrite mode or not.
678 	 *
679 	 * Since: 2.4
680 	 */
681 	public bool getOverwrite()
682 	{
683 		return gtk_text_view_get_overwrite(gtkTextView) != 0;
684 	}
685 
686 	/**
687 	 * Gets the default number of pixels to put above paragraphs.
688 	 * Adding this function with gtk_text_view_get_pixels_below_lines()
689 	 * is equal to the line space between each paragraph.
690 	 *
691 	 * Returns: default number of pixels above paragraphs
692 	 */
693 	public int getPixelsAboveLines()
694 	{
695 		return gtk_text_view_get_pixels_above_lines(gtkTextView);
696 	}
697 
698 	/**
699 	 * Gets the value set by gtk_text_view_set_pixels_below_lines().
700 	 *
701 	 * The line space is the sum of the value returned by this function and the
702 	 * value returned by gtk_text_view_get_pixels_above_lines().
703 	 *
704 	 * Returns: default number of blank pixels below paragraphs
705 	 */
706 	public int getPixelsBelowLines()
707 	{
708 		return gtk_text_view_get_pixels_below_lines(gtkTextView);
709 	}
710 
711 	/**
712 	 * Gets the value set by gtk_text_view_set_pixels_inside_wrap().
713 	 *
714 	 * Returns: default number of pixels of blank space between wrapped lines
715 	 */
716 	public int getPixelsInsideWrap()
717 	{
718 		return gtk_text_view_get_pixels_inside_wrap(gtkTextView);
719 	}
720 
721 	/**
722 	 * Gets the default right margin for text in @text_view. Tags
723 	 * in the buffer may override the default.
724 	 *
725 	 * Returns: right margin in pixels
726 	 */
727 	public int getRightMargin()
728 	{
729 		return gtk_text_view_get_right_margin(gtkTextView);
730 	}
731 
732 	/**
733 	 * Gets the default tabs for @text_view. Tags in the buffer may
734 	 * override the defaults. The returned array will be %NULL if
735 	 * “standard” (8-space) tabs are used. Free the return value
736 	 * with pango_tab_array_free().
737 	 *
738 	 * Returns: copy of default tab array, or %NULL if
739 	 *     “standard" tabs are used; must be freed with pango_tab_array_free().
740 	 */
741 	public PgTabArray getTabs()
742 	{
743 		auto p = gtk_text_view_get_tabs(gtkTextView);
744 
745 		if(p is null)
746 		{
747 			return null;
748 		}
749 
750 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p, true);
751 	}
752 
753 	/**
754 	 * Gets the top margin for text in the @text_view.
755 	 *
756 	 * Returns: top margin in pixels
757 	 *
758 	 * Since: 3.18
759 	 */
760 	public int getTopMargin()
761 	{
762 		return gtk_text_view_get_top_margin(gtkTextView);
763 	}
764 
765 	/**
766 	 * Fills @visible_rect with the currently-visible
767 	 * region of the buffer, in buffer coordinates. Convert to window coordinates
768 	 * with gtk_text_view_buffer_to_window_coords().
769 	 *
770 	 * Params:
771 	 *     visibleRect = rectangle to fill
772 	 */
773 	public void getVisibleRect(out GdkRectangle visibleRect)
774 	{
775 		gtk_text_view_get_visible_rect(gtkTextView, &visibleRect);
776 	}
777 
778 	/**
779 	 * Retrieves the #GdkWindow corresponding to an area of the text view;
780 	 * possible windows include the overall widget window, child windows
781 	 * on the left, right, top, bottom, and the window that displays the
782 	 * text buffer. Windows are %NULL and nonexistent if their width or
783 	 * height is 0, and are nonexistent before the widget has been
784 	 * realized.
785 	 *
786 	 * Params:
787 	 *     win = window to get
788 	 *
789 	 * Returns: a #GdkWindow, or %NULL
790 	 */
791 	public Window getWindow(GtkTextWindowType win)
792 	{
793 		auto p = gtk_text_view_get_window(gtkTextView, win);
794 
795 		if(p is null)
796 		{
797 			return null;
798 		}
799 
800 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
801 	}
802 
803 	/**
804 	 * Usually used to find out which window an event corresponds to.
805 	 *
806 	 * If you connect to an event signal on @text_view, this function
807 	 * should be called on `event->window` to see which window it was.
808 	 *
809 	 * Params:
810 	 *     window = a window type
811 	 *
812 	 * Returns: the window type.
813 	 */
814 	public GtkTextWindowType getWindowType(Window window)
815 	{
816 		return gtk_text_view_get_window_type(gtkTextView, (window is null) ? null : window.getWindowStruct());
817 	}
818 
819 	/**
820 	 * Gets the line wrapping for the view.
821 	 *
822 	 * Returns: the line wrap setting
823 	 */
824 	public GtkWrapMode getWrapMode()
825 	{
826 		return gtk_text_view_get_wrap_mode(gtkTextView);
827 	}
828 
829 	/**
830 	 * Allow the #GtkTextView input method to internally handle key press
831 	 * and release events. If this function returns %TRUE, then no further
832 	 * processing should be done for this key event. See
833 	 * gtk_im_context_filter_keypress().
834 	 *
835 	 * Note that you are expected to call this function from your handler
836 	 * when overriding key event handling. This is needed in the case when
837 	 * you need to insert your own key handling between the input method
838 	 * and the default key event handling of the #GtkTextView.
839 	 *
840 	 * |[<!-- language="C" -->
841 	 * static gboolean
842 	 * gtk_foo_bar_key_press_event (GtkWidget   *widget,
843 	 * GdkEventKey *event)
844 	 * {
845 	 * if ((key->keyval == GDK_KEY_Return || key->keyval == GDK_KEY_KP_Enter))
846 	 * {
847 	 * if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event))
848 	 * return TRUE;
849 	 * }
850 	 *
851 	 * // Do some stuff
852 	 *
853 	 * return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
854 	 * }
855 	 * ]|
856 	 *
857 	 * Params:
858 	 *     event = the key event
859 	 *
860 	 * Returns: %TRUE if the input method handled the key event.
861 	 *
862 	 * Since: 2.22
863 	 */
864 	public bool imContextFilterKeypress(GdkEventKey* event)
865 	{
866 		return gtk_text_view_im_context_filter_keypress(gtkTextView, event) != 0;
867 	}
868 
869 	/**
870 	 * Updates the position of a child, as for gtk_text_view_add_child_in_window().
871 	 *
872 	 * Params:
873 	 *     child = child widget already added to the text view
874 	 *     xpos = new X position in window coordinates
875 	 *     ypos = new Y position in window coordinates
876 	 */
877 	public void moveChild(Widget child, int xpos, int ypos)
878 	{
879 		gtk_text_view_move_child(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos);
880 	}
881 
882 	/**
883 	 * Moves a mark within the buffer so that it's
884 	 * located within the currently-visible text area.
885 	 *
886 	 * Params:
887 	 *     mark = a #GtkTextMark
888 	 *
889 	 * Returns: %TRUE if the mark moved (wasn’t already onscreen)
890 	 */
891 	public bool moveMarkOnscreen(TextMark mark)
892 	{
893 		return gtk_text_view_move_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()) != 0;
894 	}
895 
896 	/**
897 	 * Move the iterator a given number of characters visually, treating
898 	 * it as the strong cursor position. If @count is positive, then the
899 	 * new strong cursor position will be @count positions to the right of
900 	 * the old cursor position. If @count is negative then the new strong
901 	 * cursor position will be @count positions to the left of the old
902 	 * cursor position.
903 	 *
904 	 * In the presence of bi-directional text, the correspondence
905 	 * between logical and visual order will depend on the direction
906 	 * of the current run, and there may be jumps when the cursor
907 	 * is moved off of the end of a run.
908 	 *
909 	 * Params:
910 	 *     iter = a #GtkTextIter
911 	 *     count = number of characters to move (negative moves left,
912 	 *         positive moves right)
913 	 *
914 	 * Returns: %TRUE if @iter moved and is not on the end iterator
915 	 */
916 	public bool moveVisually(TextIter iter, int count)
917 	{
918 		return gtk_text_view_move_visually(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), count) != 0;
919 	}
920 
921 	/**
922 	 * Moves the cursor to the currently visible region of the
923 	 * buffer, it it isn’t there already.
924 	 *
925 	 * Returns: %TRUE if the cursor had to be moved.
926 	 */
927 	public bool placeCursorOnscreen()
928 	{
929 		return gtk_text_view_place_cursor_onscreen(gtkTextView) != 0;
930 	}
931 
932 	/**
933 	 * Ensures that the cursor is shown (i.e. not in an 'off' blink
934 	 * interval) and resets the time that it will stay blinking (or
935 	 * visible, in case blinking is disabled).
936 	 *
937 	 * This function should be called in response to user input
938 	 * (e.g. from derived classes that override the textview's
939 	 * #GtkWidget::key-press-event handler).
940 	 *
941 	 * Since: 3.20
942 	 */
943 	public void resetCursorBlink()
944 	{
945 		gtk_text_view_reset_cursor_blink(gtkTextView);
946 	}
947 
948 	/**
949 	 * Reset the input method context of the text view if needed.
950 	 *
951 	 * This can be necessary in the case where modifying the buffer
952 	 * would confuse on-going input method behavior.
953 	 *
954 	 * Since: 2.22
955 	 */
956 	public void resetImContext()
957 	{
958 		gtk_text_view_reset_im_context(gtkTextView);
959 	}
960 
961 	/**
962 	 * Scrolls @text_view the minimum distance such that @mark is contained
963 	 * within the visible area of the widget.
964 	 *
965 	 * Params:
966 	 *     mark = a mark in the buffer for @text_view
967 	 */
968 	public void scrollMarkOnscreen(TextMark mark)
969 	{
970 		gtk_text_view_scroll_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct());
971 	}
972 
973 	/**
974 	 * Scrolls @text_view so that @iter is on the screen in the position
975 	 * indicated by @xalign and @yalign. An alignment of 0.0 indicates
976 	 * left or top, 1.0 indicates right or bottom, 0.5 means center.
977 	 * If @use_align is %FALSE, the text scrolls the minimal distance to
978 	 * get the mark onscreen, possibly not scrolling at all. The effective
979 	 * screen for purposes of this function is reduced by a margin of size
980 	 * @within_margin.
981 	 *
982 	 * Note that this function uses the currently-computed height of the
983 	 * lines in the text buffer. Line heights are computed in an idle
984 	 * handler; so this function may not have the desired effect if it’s
985 	 * called before the height computations. To avoid oddness, consider
986 	 * using gtk_text_view_scroll_to_mark() which saves a point to be
987 	 * scrolled to after line validation.
988 	 *
989 	 * Params:
990 	 *     iter = a #GtkTextIter
991 	 *     withinMargin = margin as a [0.0,0.5) fraction of screen size
992 	 *     useAlign = whether to use alignment arguments (if %FALSE,
993 	 *         just get the mark onscreen)
994 	 *     xalign = horizontal alignment of mark within visible area
995 	 *     yalign = vertical alignment of mark within visible area
996 	 *
997 	 * Returns: %TRUE if scrolling occurred
998 	 */
999 	public bool scrollToIter(TextIter iter, double withinMargin, bool useAlign, double xalign, double yalign)
1000 	{
1001 		return gtk_text_view_scroll_to_iter(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), withinMargin, useAlign, xalign, yalign) != 0;
1002 	}
1003 
1004 	/**
1005 	 * Scrolls @text_view so that @mark is on the screen in the position
1006 	 * indicated by @xalign and @yalign. An alignment of 0.0 indicates
1007 	 * left or top, 1.0 indicates right or bottom, 0.5 means center.
1008 	 * If @use_align is %FALSE, the text scrolls the minimal distance to
1009 	 * get the mark onscreen, possibly not scrolling at all. The effective
1010 	 * screen for purposes of this function is reduced by a margin of size
1011 	 * @within_margin.
1012 	 *
1013 	 * Params:
1014 	 *     mark = a #GtkTextMark
1015 	 *     withinMargin = margin as a [0.0,0.5) fraction of screen size
1016 	 *     useAlign = whether to use alignment arguments (if %FALSE, just
1017 	 *         get the mark onscreen)
1018 	 *     xalign = horizontal alignment of mark within visible area
1019 	 *     yalign = vertical alignment of mark within visible area
1020 	 */
1021 	public void scrollToMark(TextMark mark, double withinMargin, bool useAlign, double xalign, double yalign)
1022 	{
1023 		gtk_text_view_scroll_to_mark(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct(), withinMargin, useAlign, xalign, yalign);
1024 	}
1025 
1026 	/**
1027 	 * Sets the behavior of the text widget when the Tab key is pressed.
1028 	 * If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab
1029 	 * is %FALSE the keyboard focus is moved to the next widget in the focus
1030 	 * chain.
1031 	 *
1032 	 * Params:
1033 	 *     acceptsTab = %TRUE if pressing the Tab key should insert a tab
1034 	 *         character, %FALSE, if pressing the Tab key should move the
1035 	 *         keyboard focus.
1036 	 *
1037 	 * Since: 2.4
1038 	 */
1039 	public void setAcceptsTab(bool acceptsTab)
1040 	{
1041 		gtk_text_view_set_accepts_tab(gtkTextView, acceptsTab);
1042 	}
1043 
1044 	/**
1045 	 * Sets the width of %GTK_TEXT_WINDOW_LEFT or %GTK_TEXT_WINDOW_RIGHT,
1046 	 * or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
1047 	 * Automatically destroys the corresponding window if the size is set
1048 	 * to 0, and creates the window if the size is set to non-zero.  This
1049 	 * function can only be used for the “border windows”, and it won’t
1050 	 * work with %GTK_TEXT_WINDOW_WIDGET, %GTK_TEXT_WINDOW_TEXT, or
1051 	 * %GTK_TEXT_WINDOW_PRIVATE.
1052 	 *
1053 	 * Params:
1054 	 *     type = window to affect
1055 	 *     size = width or height of the window
1056 	 */
1057 	public void setBorderWindowSize(GtkTextWindowType type, int size)
1058 	{
1059 		gtk_text_view_set_border_window_size(gtkTextView, type, size);
1060 	}
1061 
1062 	/**
1063 	 * Sets the bottom margin for text in @text_view.
1064 	 *
1065 	 * Note that this function is confusingly named.
1066 	 * In CSS terms, the value set here is padding.
1067 	 *
1068 	 * Params:
1069 	 *     bottomMargin = bottom margin in pixels
1070 	 *
1071 	 * Since: 3.18
1072 	 */
1073 	public void setBottomMargin(int bottomMargin)
1074 	{
1075 		gtk_text_view_set_bottom_margin(gtkTextView, bottomMargin);
1076 	}
1077 
1078 	/**
1079 	 * Sets @buffer as the buffer being displayed by @text_view. The previous
1080 	 * buffer displayed by the text view is unreferenced, and a reference is
1081 	 * added to @buffer. If you owned a reference to @buffer before passing it
1082 	 * to this function, you must remove that reference yourself; #GtkTextView
1083 	 * will not “adopt” it.
1084 	 *
1085 	 * Params:
1086 	 *     buffer = a #GtkTextBuffer
1087 	 */
1088 	public void setBuffer(TextBuffer buffer)
1089 	{
1090 		gtk_text_view_set_buffer(gtkTextView, (buffer is null) ? null : buffer.getTextBufferStruct());
1091 	}
1092 
1093 	/**
1094 	 * Toggles whether the insertion point should be displayed. A buffer with
1095 	 * no editable text probably shouldn’t have a visible cursor, so you may
1096 	 * want to turn the cursor off.
1097 	 *
1098 	 * Note that this property may be overridden by the
1099 	 * #GtkSettings:gtk-keynave-use-caret settings.
1100 	 *
1101 	 * Params:
1102 	 *     setting = whether to show the insertion cursor
1103 	 */
1104 	public void setCursorVisible(bool setting)
1105 	{
1106 		gtk_text_view_set_cursor_visible(gtkTextView, setting);
1107 	}
1108 
1109 	/**
1110 	 * Sets the default editability of the #GtkTextView. You can override
1111 	 * this default setting with tags in the buffer, using the “editable”
1112 	 * attribute of tags.
1113 	 *
1114 	 * Params:
1115 	 *     setting = whether it’s editable
1116 	 */
1117 	public void setEditable(bool setting)
1118 	{
1119 		gtk_text_view_set_editable(gtkTextView, setting);
1120 	}
1121 
1122 	/**
1123 	 * Sets the default indentation for paragraphs in @text_view.
1124 	 * Tags in the buffer may override the default.
1125 	 *
1126 	 * Params:
1127 	 *     indent = indentation in pixels
1128 	 */
1129 	public void setIndent(int indent)
1130 	{
1131 		gtk_text_view_set_indent(gtkTextView, indent);
1132 	}
1133 
1134 	/**
1135 	 * Sets the #GtkTextView:input-hints property, which
1136 	 * allows input methods to fine-tune their behaviour.
1137 	 *
1138 	 * Params:
1139 	 *     hints = the hints
1140 	 *
1141 	 * Since: 3.6
1142 	 */
1143 	public void setInputHints(GtkInputHints hints)
1144 	{
1145 		gtk_text_view_set_input_hints(gtkTextView, hints);
1146 	}
1147 
1148 	/**
1149 	 * Sets the #GtkTextView:input-purpose property which
1150 	 * can be used by on-screen keyboards and other input
1151 	 * methods to adjust their behaviour.
1152 	 *
1153 	 * Params:
1154 	 *     purpose = the purpose
1155 	 *
1156 	 * Since: 3.6
1157 	 */
1158 	public void setInputPurpose(GtkInputPurpose purpose)
1159 	{
1160 		gtk_text_view_set_input_purpose(gtkTextView, purpose);
1161 	}
1162 
1163 	/**
1164 	 * Sets the default justification of text in @text_view.
1165 	 * Tags in the view’s buffer may override the default.
1166 	 *
1167 	 * Params:
1168 	 *     justification = justification
1169 	 */
1170 	public void setJustification(GtkJustification justification)
1171 	{
1172 		gtk_text_view_set_justification(gtkTextView, justification);
1173 	}
1174 
1175 	/**
1176 	 * Sets the default left margin for text in @text_view.
1177 	 * Tags in the buffer may override the default.
1178 	 *
1179 	 * Note that this function is confusingly named.
1180 	 * In CSS terms, the value set here is padding.
1181 	 *
1182 	 * Params:
1183 	 *     leftMargin = left margin in pixels
1184 	 */
1185 	public void setLeftMargin(int leftMargin)
1186 	{
1187 		gtk_text_view_set_left_margin(gtkTextView, leftMargin);
1188 	}
1189 
1190 	/**
1191 	 * Sets the #GtkTextView:monospace property, which
1192 	 * indicates that the text view should use monospace
1193 	 * fonts.
1194 	 *
1195 	 * Params:
1196 	 *     monospace = %TRUE to request monospace styling
1197 	 *
1198 	 * Since: 3.16
1199 	 */
1200 	public void setMonospace(bool monospace)
1201 	{
1202 		gtk_text_view_set_monospace(gtkTextView, monospace);
1203 	}
1204 
1205 	/**
1206 	 * Changes the #GtkTextView overwrite mode.
1207 	 *
1208 	 * Params:
1209 	 *     overwrite = %TRUE to turn on overwrite mode, %FALSE to turn it off
1210 	 *
1211 	 * Since: 2.4
1212 	 */
1213 	public void setOverwrite(bool overwrite)
1214 	{
1215 		gtk_text_view_set_overwrite(gtkTextView, overwrite);
1216 	}
1217 
1218 	/**
1219 	 * Sets the default number of blank pixels above paragraphs in @text_view.
1220 	 * Tags in the buffer for @text_view may override the defaults.
1221 	 *
1222 	 * Params:
1223 	 *     pixelsAboveLines = pixels above paragraphs
1224 	 */
1225 	public void setPixelsAboveLines(int pixelsAboveLines)
1226 	{
1227 		gtk_text_view_set_pixels_above_lines(gtkTextView, pixelsAboveLines);
1228 	}
1229 
1230 	/**
1231 	 * Sets the default number of pixels of blank space
1232 	 * to put below paragraphs in @text_view. May be overridden
1233 	 * by tags applied to @text_view’s buffer.
1234 	 *
1235 	 * Params:
1236 	 *     pixelsBelowLines = pixels below paragraphs
1237 	 */
1238 	public void setPixelsBelowLines(int pixelsBelowLines)
1239 	{
1240 		gtk_text_view_set_pixels_below_lines(gtkTextView, pixelsBelowLines);
1241 	}
1242 
1243 	/**
1244 	 * Sets the default number of pixels of blank space to leave between
1245 	 * display/wrapped lines within a paragraph. May be overridden by
1246 	 * tags in @text_view’s buffer.
1247 	 *
1248 	 * Params:
1249 	 *     pixelsInsideWrap = default number of pixels between wrapped lines
1250 	 */
1251 	public void setPixelsInsideWrap(int pixelsInsideWrap)
1252 	{
1253 		gtk_text_view_set_pixels_inside_wrap(gtkTextView, pixelsInsideWrap);
1254 	}
1255 
1256 	/**
1257 	 * Sets the default right margin for text in the text view.
1258 	 * Tags in the buffer may override the default.
1259 	 *
1260 	 * Note that this function is confusingly named.
1261 	 * In CSS terms, the value set here is padding.
1262 	 *
1263 	 * Params:
1264 	 *     rightMargin = right margin in pixels
1265 	 */
1266 	public void setRightMargin(int rightMargin)
1267 	{
1268 		gtk_text_view_set_right_margin(gtkTextView, rightMargin);
1269 	}
1270 
1271 	/**
1272 	 * Sets the default tab stops for paragraphs in @text_view.
1273 	 * Tags in the buffer may override the default.
1274 	 *
1275 	 * Params:
1276 	 *     tabs = tabs as a #PangoTabArray
1277 	 */
1278 	public void setTabs(PgTabArray tabs)
1279 	{
1280 		gtk_text_view_set_tabs(gtkTextView, (tabs is null) ? null : tabs.getPgTabArrayStruct());
1281 	}
1282 
1283 	/**
1284 	 * Sets the top margin for text in @text_view.
1285 	 *
1286 	 * Note that this function is confusingly named.
1287 	 * In CSS terms, the value set here is padding.
1288 	 *
1289 	 * Params:
1290 	 *     topMargin = top margin in pixels
1291 	 *
1292 	 * Since: 3.18
1293 	 */
1294 	public void setTopMargin(int topMargin)
1295 	{
1296 		gtk_text_view_set_top_margin(gtkTextView, topMargin);
1297 	}
1298 
1299 	/**
1300 	 * Sets the line wrapping for the view.
1301 	 *
1302 	 * Params:
1303 	 *     wrapMode = a #GtkWrapMode
1304 	 */
1305 	public void setWrapMode(GtkWrapMode wrapMode)
1306 	{
1307 		gtk_text_view_set_wrap_mode(gtkTextView, wrapMode);
1308 	}
1309 
1310 	/**
1311 	 * Determines whether @iter is at the start of a display line.
1312 	 * See gtk_text_view_forward_display_line() for an explanation of
1313 	 * display lines vs. paragraphs.
1314 	 *
1315 	 * Params:
1316 	 *     iter = a #GtkTextIter
1317 	 *
1318 	 * Returns: %TRUE if @iter begins a wrapped line
1319 	 */
1320 	public bool startsDisplayLine(TextIter iter)
1321 	{
1322 		return gtk_text_view_starts_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
1323 	}
1324 
1325 	/**
1326 	 * Converts coordinates on the window identified by @win to buffer
1327 	 * coordinates, storing the result in (@buffer_x,@buffer_y).
1328 	 *
1329 	 * Note that you can’t convert coordinates for a nonexisting window (see
1330 	 * gtk_text_view_set_border_window_size()).
1331 	 *
1332 	 * Params:
1333 	 *     win = a #GtkTextWindowType except %GTK_TEXT_WINDOW_PRIVATE
1334 	 *     windowX = window x coordinate
1335 	 *     windowY = window y coordinate
1336 	 *     bufferX = buffer x coordinate return location or %NULL
1337 	 *     bufferY = buffer y coordinate return location or %NULL
1338 	 */
1339 	public void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, out int bufferX, out int bufferY)
1340 	{
1341 		gtk_text_view_window_to_buffer_coords(gtkTextView, win, windowX, windowY, &bufferX, &bufferY);
1342 	}
1343 
1344 	protected class OnBackspaceDelegateWrapper
1345 	{
1346 		void delegate(TextView) dlg;
1347 		gulong handlerId;
1348 
1349 		this(void delegate(TextView) dlg)
1350 		{
1351 			this.dlg = dlg;
1352 			onBackspaceListeners ~= this;
1353 		}
1354 
1355 		void remove(OnBackspaceDelegateWrapper source)
1356 		{
1357 			foreach(index, wrapper; onBackspaceListeners)
1358 			{
1359 				if (wrapper.handlerId == source.handlerId)
1360 				{
1361 					onBackspaceListeners[index] = null;
1362 					onBackspaceListeners = std.algorithm.remove(onBackspaceListeners, index);
1363 					break;
1364 				}
1365 			}
1366 		}
1367 	}
1368 	OnBackspaceDelegateWrapper[] onBackspaceListeners;
1369 
1370 	/**
1371 	 * The ::backspace signal is a
1372 	 * [keybinding signal][GtkBindingSignal]
1373 	 * which gets emitted when the user asks for it.
1374 	 *
1375 	 * The default bindings for this signal are
1376 	 * Backspace and Shift-Backspace.
1377 	 */
1378 	gulong addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1379 	{
1380 		auto wrapper = new OnBackspaceDelegateWrapper(dlg);
1381 		wrapper.handlerId = Signals.connectData(
1382 			this,
1383 			"backspace",
1384 			cast(GCallback)&callBackBackspace,
1385 			cast(void*)wrapper,
1386 			cast(GClosureNotify)&callBackBackspaceDestroy,
1387 			connectFlags);
1388 		return wrapper.handlerId;
1389 	}
1390 
1391 	extern(C) static void callBackBackspace(GtkTextView* textviewStruct, OnBackspaceDelegateWrapper wrapper)
1392 	{
1393 		wrapper.dlg(wrapper.outer);
1394 	}
1395 
1396 	extern(C) static void callBackBackspaceDestroy(OnBackspaceDelegateWrapper wrapper, GClosure* closure)
1397 	{
1398 		wrapper.remove(wrapper);
1399 	}
1400 
1401 	protected class OnCopyClipboardDelegateWrapper
1402 	{
1403 		void delegate(TextView) dlg;
1404 		gulong handlerId;
1405 
1406 		this(void delegate(TextView) dlg)
1407 		{
1408 			this.dlg = dlg;
1409 			onCopyClipboardListeners ~= this;
1410 		}
1411 
1412 		void remove(OnCopyClipboardDelegateWrapper source)
1413 		{
1414 			foreach(index, wrapper; onCopyClipboardListeners)
1415 			{
1416 				if (wrapper.handlerId == source.handlerId)
1417 				{
1418 					onCopyClipboardListeners[index] = null;
1419 					onCopyClipboardListeners = std.algorithm.remove(onCopyClipboardListeners, index);
1420 					break;
1421 				}
1422 			}
1423 		}
1424 	}
1425 	OnCopyClipboardDelegateWrapper[] onCopyClipboardListeners;
1426 
1427 	/**
1428 	 * The ::copy-clipboard signal is a
1429 	 * [keybinding signal][GtkBindingSignal]
1430 	 * which gets emitted to copy the selection to the clipboard.
1431 	 *
1432 	 * The default bindings for this signal are
1433 	 * Ctrl-c and Ctrl-Insert.
1434 	 */
1435 	gulong addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1436 	{
1437 		auto wrapper = new OnCopyClipboardDelegateWrapper(dlg);
1438 		wrapper.handlerId = Signals.connectData(
1439 			this,
1440 			"copy-clipboard",
1441 			cast(GCallback)&callBackCopyClipboard,
1442 			cast(void*)wrapper,
1443 			cast(GClosureNotify)&callBackCopyClipboardDestroy,
1444 			connectFlags);
1445 		return wrapper.handlerId;
1446 	}
1447 
1448 	extern(C) static void callBackCopyClipboard(GtkTextView* textviewStruct, OnCopyClipboardDelegateWrapper wrapper)
1449 	{
1450 		wrapper.dlg(wrapper.outer);
1451 	}
1452 
1453 	extern(C) static void callBackCopyClipboardDestroy(OnCopyClipboardDelegateWrapper wrapper, GClosure* closure)
1454 	{
1455 		wrapper.remove(wrapper);
1456 	}
1457 
1458 	protected class OnCutClipboardDelegateWrapper
1459 	{
1460 		void delegate(TextView) dlg;
1461 		gulong handlerId;
1462 
1463 		this(void delegate(TextView) dlg)
1464 		{
1465 			this.dlg = dlg;
1466 			onCutClipboardListeners ~= this;
1467 		}
1468 
1469 		void remove(OnCutClipboardDelegateWrapper source)
1470 		{
1471 			foreach(index, wrapper; onCutClipboardListeners)
1472 			{
1473 				if (wrapper.handlerId == source.handlerId)
1474 				{
1475 					onCutClipboardListeners[index] = null;
1476 					onCutClipboardListeners = std.algorithm.remove(onCutClipboardListeners, index);
1477 					break;
1478 				}
1479 			}
1480 		}
1481 	}
1482 	OnCutClipboardDelegateWrapper[] onCutClipboardListeners;
1483 
1484 	/**
1485 	 * The ::cut-clipboard signal is a
1486 	 * [keybinding signal][GtkBindingSignal]
1487 	 * which gets emitted to cut the selection to the clipboard.
1488 	 *
1489 	 * The default bindings for this signal are
1490 	 * Ctrl-x and Shift-Delete.
1491 	 */
1492 	gulong addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1493 	{
1494 		auto wrapper = new OnCutClipboardDelegateWrapper(dlg);
1495 		wrapper.handlerId = Signals.connectData(
1496 			this,
1497 			"cut-clipboard",
1498 			cast(GCallback)&callBackCutClipboard,
1499 			cast(void*)wrapper,
1500 			cast(GClosureNotify)&callBackCutClipboardDestroy,
1501 			connectFlags);
1502 		return wrapper.handlerId;
1503 	}
1504 
1505 	extern(C) static void callBackCutClipboard(GtkTextView* textviewStruct, OnCutClipboardDelegateWrapper wrapper)
1506 	{
1507 		wrapper.dlg(wrapper.outer);
1508 	}
1509 
1510 	extern(C) static void callBackCutClipboardDestroy(OnCutClipboardDelegateWrapper wrapper, GClosure* closure)
1511 	{
1512 		wrapper.remove(wrapper);
1513 	}
1514 
1515 	protected class OnDeleteFromCursorDelegateWrapper
1516 	{
1517 		void delegate(GtkDeleteType, int, TextView) dlg;
1518 		gulong handlerId;
1519 
1520 		this(void delegate(GtkDeleteType, int, TextView) dlg)
1521 		{
1522 			this.dlg = dlg;
1523 			onDeleteFromCursorListeners ~= this;
1524 		}
1525 
1526 		void remove(OnDeleteFromCursorDelegateWrapper source)
1527 		{
1528 			foreach(index, wrapper; onDeleteFromCursorListeners)
1529 			{
1530 				if (wrapper.handlerId == source.handlerId)
1531 				{
1532 					onDeleteFromCursorListeners[index] = null;
1533 					onDeleteFromCursorListeners = std.algorithm.remove(onDeleteFromCursorListeners, index);
1534 					break;
1535 				}
1536 			}
1537 		}
1538 	}
1539 	OnDeleteFromCursorDelegateWrapper[] onDeleteFromCursorListeners;
1540 
1541 	/**
1542 	 * The ::delete-from-cursor signal is a
1543 	 * [keybinding signal][GtkBindingSignal]
1544 	 * which gets emitted when the user initiates a text deletion.
1545 	 *
1546 	 * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection
1547 	 * if there is one, otherwise it deletes the requested number
1548 	 * of characters.
1549 	 *
1550 	 * The default bindings for this signal are
1551 	 * Delete for deleting a character, Ctrl-Delete for
1552 	 * deleting a word and Ctrl-Backspace for deleting a word
1553 	 * backwords.
1554 	 *
1555 	 * Params:
1556 	 *     type = the granularity of the deletion, as a #GtkDeleteType
1557 	 *     count = the number of @type units to delete
1558 	 */
1559 	gulong addOnDeleteFromCursor(void delegate(GtkDeleteType, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1560 	{
1561 		auto wrapper = new OnDeleteFromCursorDelegateWrapper(dlg);
1562 		wrapper.handlerId = Signals.connectData(
1563 			this,
1564 			"delete-from-cursor",
1565 			cast(GCallback)&callBackDeleteFromCursor,
1566 			cast(void*)wrapper,
1567 			cast(GClosureNotify)&callBackDeleteFromCursorDestroy,
1568 			connectFlags);
1569 		return wrapper.handlerId;
1570 	}
1571 
1572 	extern(C) static void callBackDeleteFromCursor(GtkTextView* textviewStruct, GtkDeleteType type, int count, OnDeleteFromCursorDelegateWrapper wrapper)
1573 	{
1574 		wrapper.dlg(type, count, wrapper.outer);
1575 	}
1576 
1577 	extern(C) static void callBackDeleteFromCursorDestroy(OnDeleteFromCursorDelegateWrapper wrapper, GClosure* closure)
1578 	{
1579 		wrapper.remove(wrapper);
1580 	}
1581 
1582 	protected class OnExtendSelectionDelegateWrapper
1583 	{
1584 		bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg;
1585 		gulong handlerId;
1586 
1587 		this(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg)
1588 		{
1589 			this.dlg = dlg;
1590 			onExtendSelectionListeners ~= this;
1591 		}
1592 
1593 		void remove(OnExtendSelectionDelegateWrapper source)
1594 		{
1595 			foreach(index, wrapper; onExtendSelectionListeners)
1596 			{
1597 				if (wrapper.handlerId == source.handlerId)
1598 				{
1599 					onExtendSelectionListeners[index] = null;
1600 					onExtendSelectionListeners = std.algorithm.remove(onExtendSelectionListeners, index);
1601 					break;
1602 				}
1603 			}
1604 		}
1605 	}
1606 	OnExtendSelectionDelegateWrapper[] onExtendSelectionListeners;
1607 
1608 	/**
1609 	 * The ::extend-selection signal is emitted when the selection needs to be
1610 	 * extended at @location.
1611 	 *
1612 	 * Params:
1613 	 *     granularity = the granularity type
1614 	 *     location = the location where to extend the selection
1615 	 *     start = where the selection should start
1616 	 *     end = where the selection should end
1617 	 *
1618 	 * Returns: %GDK_EVENT_STOP to stop other handlers from being invoked for the
1619 	 *     event. %GDK_EVENT_PROPAGATE to propagate the event further.
1620 	 *
1621 	 * Since: 3.16
1622 	 */
1623 	gulong addOnExtendSelection(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1624 	{
1625 		auto wrapper = new OnExtendSelectionDelegateWrapper(dlg);
1626 		wrapper.handlerId = Signals.connectData(
1627 			this,
1628 			"extend-selection",
1629 			cast(GCallback)&callBackExtendSelection,
1630 			cast(void*)wrapper,
1631 			cast(GClosureNotify)&callBackExtendSelectionDestroy,
1632 			connectFlags);
1633 		return wrapper.handlerId;
1634 	}
1635 
1636 	extern(C) static int callBackExtendSelection(GtkTextView* textviewStruct, GtkTextExtendSelection granularity, GtkTextIter* location, GtkTextIter* start, GtkTextIter* end, OnExtendSelectionDelegateWrapper wrapper)
1637 	{
1638 		return wrapper.dlg(granularity, ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
1639 	}
1640 
1641 	extern(C) static void callBackExtendSelectionDestroy(OnExtendSelectionDelegateWrapper wrapper, GClosure* closure)
1642 	{
1643 		wrapper.remove(wrapper);
1644 	}
1645 
1646 	protected class OnInsertAtCursorDelegateWrapper
1647 	{
1648 		void delegate(string, TextView) dlg;
1649 		gulong handlerId;
1650 
1651 		this(void delegate(string, TextView) dlg)
1652 		{
1653 			this.dlg = dlg;
1654 			onInsertAtCursorListeners ~= this;
1655 		}
1656 
1657 		void remove(OnInsertAtCursorDelegateWrapper source)
1658 		{
1659 			foreach(index, wrapper; onInsertAtCursorListeners)
1660 			{
1661 				if (wrapper.handlerId == source.handlerId)
1662 				{
1663 					onInsertAtCursorListeners[index] = null;
1664 					onInsertAtCursorListeners = std.algorithm.remove(onInsertAtCursorListeners, index);
1665 					break;
1666 				}
1667 			}
1668 		}
1669 	}
1670 	OnInsertAtCursorDelegateWrapper[] onInsertAtCursorListeners;
1671 
1672 	/**
1673 	 * The ::insert-at-cursor signal is a
1674 	 * [keybinding signal][GtkBindingSignal]
1675 	 * which gets emitted when the user initiates the insertion of a
1676 	 * fixed string at the cursor.
1677 	 *
1678 	 * This signal has no default bindings.
1679 	 *
1680 	 * Params:
1681 	 *     str = the string to insert
1682 	 */
1683 	gulong addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1684 	{
1685 		auto wrapper = new OnInsertAtCursorDelegateWrapper(dlg);
1686 		wrapper.handlerId = Signals.connectData(
1687 			this,
1688 			"insert-at-cursor",
1689 			cast(GCallback)&callBackInsertAtCursor,
1690 			cast(void*)wrapper,
1691 			cast(GClosureNotify)&callBackInsertAtCursorDestroy,
1692 			connectFlags);
1693 		return wrapper.handlerId;
1694 	}
1695 
1696 	extern(C) static void callBackInsertAtCursor(GtkTextView* textviewStruct, char* str, OnInsertAtCursorDelegateWrapper wrapper)
1697 	{
1698 		wrapper.dlg(Str.toString(str), wrapper.outer);
1699 	}
1700 
1701 	extern(C) static void callBackInsertAtCursorDestroy(OnInsertAtCursorDelegateWrapper wrapper, GClosure* closure)
1702 	{
1703 		wrapper.remove(wrapper);
1704 	}
1705 
1706 	protected class OnMoveCursorDelegateWrapper
1707 	{
1708 		void delegate(GtkMovementStep, int, bool, TextView) dlg;
1709 		gulong handlerId;
1710 
1711 		this(void delegate(GtkMovementStep, int, bool, TextView) dlg)
1712 		{
1713 			this.dlg = dlg;
1714 			onMoveCursorListeners ~= this;
1715 		}
1716 
1717 		void remove(OnMoveCursorDelegateWrapper source)
1718 		{
1719 			foreach(index, wrapper; onMoveCursorListeners)
1720 			{
1721 				if (wrapper.handlerId == source.handlerId)
1722 				{
1723 					onMoveCursorListeners[index] = null;
1724 					onMoveCursorListeners = std.algorithm.remove(onMoveCursorListeners, index);
1725 					break;
1726 				}
1727 			}
1728 		}
1729 	}
1730 	OnMoveCursorDelegateWrapper[] onMoveCursorListeners;
1731 
1732 	/**
1733 	 * The ::move-cursor signal is a
1734 	 * [keybinding signal][GtkBindingSignal]
1735 	 * which gets emitted when the user initiates a cursor movement.
1736 	 * If the cursor is not visible in @text_view, this signal causes
1737 	 * the viewport to be moved instead.
1738 	 *
1739 	 * Applications should not connect to it, but may emit it with
1740 	 * g_signal_emit_by_name() if they need to control the cursor
1741 	 * programmatically.
1742 	 *
1743 	 * The default bindings for this signal come in two variants,
1744 	 * the variant with the Shift modifier extends the selection,
1745 	 * the variant without the Shift modifer does not.
1746 	 * There are too many key combinations to list them all here.
1747 	 * - Arrow keys move by individual characters/lines
1748 	 * - Ctrl-arrow key combinations move by words/paragraphs
1749 	 * - Home/End keys move to the ends of the buffer
1750 	 * - PageUp/PageDown keys move vertically by pages
1751 	 * - Ctrl-PageUp/PageDown keys move horizontally by pages
1752 	 *
1753 	 * Params:
1754 	 *     step = the granularity of the move, as a #GtkMovementStep
1755 	 *     count = the number of @step units to move
1756 	 *     extendSelection = %TRUE if the move should extend the selection
1757 	 */
1758 	gulong addOnMoveCursor(void delegate(GtkMovementStep, int, bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1759 	{
1760 		auto wrapper = new OnMoveCursorDelegateWrapper(dlg);
1761 		wrapper.handlerId = Signals.connectData(
1762 			this,
1763 			"move-cursor",
1764 			cast(GCallback)&callBackMoveCursor,
1765 			cast(void*)wrapper,
1766 			cast(GClosureNotify)&callBackMoveCursorDestroy,
1767 			connectFlags);
1768 		return wrapper.handlerId;
1769 	}
1770 
1771 	extern(C) static void callBackMoveCursor(GtkTextView* textviewStruct, GtkMovementStep step, int count, bool extendSelection, OnMoveCursorDelegateWrapper wrapper)
1772 	{
1773 		wrapper.dlg(step, count, extendSelection, wrapper.outer);
1774 	}
1775 
1776 	extern(C) static void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure)
1777 	{
1778 		wrapper.remove(wrapper);
1779 	}
1780 
1781 	protected class OnMoveViewportDelegateWrapper
1782 	{
1783 		void delegate(GtkScrollStep, int, TextView) dlg;
1784 		gulong handlerId;
1785 
1786 		this(void delegate(GtkScrollStep, int, TextView) dlg)
1787 		{
1788 			this.dlg = dlg;
1789 			onMoveViewportListeners ~= this;
1790 		}
1791 
1792 		void remove(OnMoveViewportDelegateWrapper source)
1793 		{
1794 			foreach(index, wrapper; onMoveViewportListeners)
1795 			{
1796 				if (wrapper.handlerId == source.handlerId)
1797 				{
1798 					onMoveViewportListeners[index] = null;
1799 					onMoveViewportListeners = std.algorithm.remove(onMoveViewportListeners, index);
1800 					break;
1801 				}
1802 			}
1803 		}
1804 	}
1805 	OnMoveViewportDelegateWrapper[] onMoveViewportListeners;
1806 
1807 	/**
1808 	 * The ::move-viewport signal is a
1809 	 * [keybinding signal][GtkBindingSignal]
1810 	 * which can be bound to key combinations to allow the user
1811 	 * to move the viewport, i.e. change what part of the text view
1812 	 * is visible in a containing scrolled window.
1813 	 *
1814 	 * There are no default bindings for this signal.
1815 	 *
1816 	 * Params:
1817 	 *     step = the granularity of the movement, as a #GtkScrollStep
1818 	 *     count = the number of @step units to move
1819 	 */
1820 	gulong addOnMoveViewport(void delegate(GtkScrollStep, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1821 	{
1822 		auto wrapper = new OnMoveViewportDelegateWrapper(dlg);
1823 		wrapper.handlerId = Signals.connectData(
1824 			this,
1825 			"move-viewport",
1826 			cast(GCallback)&callBackMoveViewport,
1827 			cast(void*)wrapper,
1828 			cast(GClosureNotify)&callBackMoveViewportDestroy,
1829 			connectFlags);
1830 		return wrapper.handlerId;
1831 	}
1832 
1833 	extern(C) static void callBackMoveViewport(GtkTextView* textviewStruct, GtkScrollStep step, int count, OnMoveViewportDelegateWrapper wrapper)
1834 	{
1835 		wrapper.dlg(step, count, wrapper.outer);
1836 	}
1837 
1838 	extern(C) static void callBackMoveViewportDestroy(OnMoveViewportDelegateWrapper wrapper, GClosure* closure)
1839 	{
1840 		wrapper.remove(wrapper);
1841 	}
1842 
1843 	protected class OnPasteClipboardDelegateWrapper
1844 	{
1845 		void delegate(TextView) dlg;
1846 		gulong handlerId;
1847 
1848 		this(void delegate(TextView) dlg)
1849 		{
1850 			this.dlg = dlg;
1851 			onPasteClipboardListeners ~= this;
1852 		}
1853 
1854 		void remove(OnPasteClipboardDelegateWrapper source)
1855 		{
1856 			foreach(index, wrapper; onPasteClipboardListeners)
1857 			{
1858 				if (wrapper.handlerId == source.handlerId)
1859 				{
1860 					onPasteClipboardListeners[index] = null;
1861 					onPasteClipboardListeners = std.algorithm.remove(onPasteClipboardListeners, index);
1862 					break;
1863 				}
1864 			}
1865 		}
1866 	}
1867 	OnPasteClipboardDelegateWrapper[] onPasteClipboardListeners;
1868 
1869 	/**
1870 	 * The ::paste-clipboard signal is a
1871 	 * [keybinding signal][GtkBindingSignal]
1872 	 * which gets emitted to paste the contents of the clipboard
1873 	 * into the text view.
1874 	 *
1875 	 * The default bindings for this signal are
1876 	 * Ctrl-v and Shift-Insert.
1877 	 */
1878 	gulong addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1879 	{
1880 		auto wrapper = new OnPasteClipboardDelegateWrapper(dlg);
1881 		wrapper.handlerId = Signals.connectData(
1882 			this,
1883 			"paste-clipboard",
1884 			cast(GCallback)&callBackPasteClipboard,
1885 			cast(void*)wrapper,
1886 			cast(GClosureNotify)&callBackPasteClipboardDestroy,
1887 			connectFlags);
1888 		return wrapper.handlerId;
1889 	}
1890 
1891 	extern(C) static void callBackPasteClipboard(GtkTextView* textviewStruct, OnPasteClipboardDelegateWrapper wrapper)
1892 	{
1893 		wrapper.dlg(wrapper.outer);
1894 	}
1895 
1896 	extern(C) static void callBackPasteClipboardDestroy(OnPasteClipboardDelegateWrapper wrapper, GClosure* closure)
1897 	{
1898 		wrapper.remove(wrapper);
1899 	}
1900 
1901 	protected class OnPopulatePopupDelegateWrapper
1902 	{
1903 		void delegate(Widget, TextView) dlg;
1904 		gulong handlerId;
1905 
1906 		this(void delegate(Widget, TextView) dlg)
1907 		{
1908 			this.dlg = dlg;
1909 			onPopulatePopupListeners ~= this;
1910 		}
1911 
1912 		void remove(OnPopulatePopupDelegateWrapper source)
1913 		{
1914 			foreach(index, wrapper; onPopulatePopupListeners)
1915 			{
1916 				if (wrapper.handlerId == source.handlerId)
1917 				{
1918 					onPopulatePopupListeners[index] = null;
1919 					onPopulatePopupListeners = std.algorithm.remove(onPopulatePopupListeners, index);
1920 					break;
1921 				}
1922 			}
1923 		}
1924 	}
1925 	OnPopulatePopupDelegateWrapper[] onPopulatePopupListeners;
1926 
1927 	/**
1928 	 * The ::populate-popup signal gets emitted before showing the
1929 	 * context menu of the text view.
1930 	 *
1931 	 * If you need to add items to the context menu, connect
1932 	 * to this signal and append your items to the @popup, which
1933 	 * will be a #GtkMenu in this case.
1934 	 *
1935 	 * If #GtkTextView:populate-all is %TRUE, this signal will
1936 	 * also be emitted to populate touch popups. In this case,
1937 	 * @popup will be a different container, e.g. a #GtkToolbar.
1938 	 *
1939 	 * The signal handler should not make assumptions about the
1940 	 * type of @widget, but check whether @popup is a #GtkMenu
1941 	 * or #GtkToolbar or another kind of container.
1942 	 *
1943 	 * Params:
1944 	 *     popup = the container that is being populated
1945 	 */
1946 	gulong addOnPopulatePopup(void delegate(Widget, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1947 	{
1948 		auto wrapper = new OnPopulatePopupDelegateWrapper(dlg);
1949 		wrapper.handlerId = Signals.connectData(
1950 			this,
1951 			"populate-popup",
1952 			cast(GCallback)&callBackPopulatePopup,
1953 			cast(void*)wrapper,
1954 			cast(GClosureNotify)&callBackPopulatePopupDestroy,
1955 			connectFlags);
1956 		return wrapper.handlerId;
1957 	}
1958 
1959 	extern(C) static void callBackPopulatePopup(GtkTextView* textviewStruct, GtkWidget* popup, OnPopulatePopupDelegateWrapper wrapper)
1960 	{
1961 		wrapper.dlg(ObjectG.getDObject!(Widget)(popup), wrapper.outer);
1962 	}
1963 
1964 	extern(C) static void callBackPopulatePopupDestroy(OnPopulatePopupDelegateWrapper wrapper, GClosure* closure)
1965 	{
1966 		wrapper.remove(wrapper);
1967 	}
1968 
1969 	protected class OnPreeditChangedDelegateWrapper
1970 	{
1971 		void delegate(string, TextView) dlg;
1972 		gulong handlerId;
1973 
1974 		this(void delegate(string, TextView) dlg)
1975 		{
1976 			this.dlg = dlg;
1977 			onPreeditChangedListeners ~= this;
1978 		}
1979 
1980 		void remove(OnPreeditChangedDelegateWrapper source)
1981 		{
1982 			foreach(index, wrapper; onPreeditChangedListeners)
1983 			{
1984 				if (wrapper.handlerId == source.handlerId)
1985 				{
1986 					onPreeditChangedListeners[index] = null;
1987 					onPreeditChangedListeners = std.algorithm.remove(onPreeditChangedListeners, index);
1988 					break;
1989 				}
1990 			}
1991 		}
1992 	}
1993 	OnPreeditChangedDelegateWrapper[] onPreeditChangedListeners;
1994 
1995 	/**
1996 	 * If an input method is used, the typed text will not immediately
1997 	 * be committed to the buffer. So if you are interested in the text,
1998 	 * connect to this signal.
1999 	 *
2000 	 * This signal is only emitted if the text at the given position
2001 	 * is actually editable.
2002 	 *
2003 	 * Params:
2004 	 *     preedit = the current preedit string
2005 	 *
2006 	 * Since: 2.20
2007 	 */
2008 	gulong addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2009 	{
2010 		auto wrapper = new OnPreeditChangedDelegateWrapper(dlg);
2011 		wrapper.handlerId = Signals.connectData(
2012 			this,
2013 			"preedit-changed",
2014 			cast(GCallback)&callBackPreeditChanged,
2015 			cast(void*)wrapper,
2016 			cast(GClosureNotify)&callBackPreeditChangedDestroy,
2017 			connectFlags);
2018 		return wrapper.handlerId;
2019 	}
2020 
2021 	extern(C) static void callBackPreeditChanged(GtkTextView* textviewStruct, char* preedit, OnPreeditChangedDelegateWrapper wrapper)
2022 	{
2023 		wrapper.dlg(Str.toString(preedit), wrapper.outer);
2024 	}
2025 
2026 	extern(C) static void callBackPreeditChangedDestroy(OnPreeditChangedDelegateWrapper wrapper, GClosure* closure)
2027 	{
2028 		wrapper.remove(wrapper);
2029 	}
2030 
2031 	protected class OnSelectAllDelegateWrapper
2032 	{
2033 		void delegate(bool, TextView) dlg;
2034 		gulong handlerId;
2035 
2036 		this(void delegate(bool, TextView) dlg)
2037 		{
2038 			this.dlg = dlg;
2039 			onSelectAllListeners ~= this;
2040 		}
2041 
2042 		void remove(OnSelectAllDelegateWrapper source)
2043 		{
2044 			foreach(index, wrapper; onSelectAllListeners)
2045 			{
2046 				if (wrapper.handlerId == source.handlerId)
2047 				{
2048 					onSelectAllListeners[index] = null;
2049 					onSelectAllListeners = std.algorithm.remove(onSelectAllListeners, index);
2050 					break;
2051 				}
2052 			}
2053 		}
2054 	}
2055 	OnSelectAllDelegateWrapper[] onSelectAllListeners;
2056 
2057 	/**
2058 	 * The ::select-all signal is a
2059 	 * [keybinding signal][GtkBindingSignal]
2060 	 * which gets emitted to select or unselect the complete
2061 	 * contents of the text view.
2062 	 *
2063 	 * The default bindings for this signal are Ctrl-a and Ctrl-/
2064 	 * for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
2065 	 *
2066 	 * Params:
2067 	 *     select = %TRUE to select, %FALSE to unselect
2068 	 */
2069 	gulong addOnSelectAll(void delegate(bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2070 	{
2071 		auto wrapper = new OnSelectAllDelegateWrapper(dlg);
2072 		wrapper.handlerId = Signals.connectData(
2073 			this,
2074 			"select-all",
2075 			cast(GCallback)&callBackSelectAll,
2076 			cast(void*)wrapper,
2077 			cast(GClosureNotify)&callBackSelectAllDestroy,
2078 			connectFlags);
2079 		return wrapper.handlerId;
2080 	}
2081 
2082 	extern(C) static void callBackSelectAll(GtkTextView* textviewStruct, bool select, OnSelectAllDelegateWrapper wrapper)
2083 	{
2084 		wrapper.dlg(select, wrapper.outer);
2085 	}
2086 
2087 	extern(C) static void callBackSelectAllDestroy(OnSelectAllDelegateWrapper wrapper, GClosure* closure)
2088 	{
2089 		wrapper.remove(wrapper);
2090 	}
2091 
2092 	protected class OnSetAnchorDelegateWrapper
2093 	{
2094 		void delegate(TextView) dlg;
2095 		gulong handlerId;
2096 
2097 		this(void delegate(TextView) dlg)
2098 		{
2099 			this.dlg = dlg;
2100 			onSetAnchorListeners ~= this;
2101 		}
2102 
2103 		void remove(OnSetAnchorDelegateWrapper source)
2104 		{
2105 			foreach(index, wrapper; onSetAnchorListeners)
2106 			{
2107 				if (wrapper.handlerId == source.handlerId)
2108 				{
2109 					onSetAnchorListeners[index] = null;
2110 					onSetAnchorListeners = std.algorithm.remove(onSetAnchorListeners, index);
2111 					break;
2112 				}
2113 			}
2114 		}
2115 	}
2116 	OnSetAnchorDelegateWrapper[] onSetAnchorListeners;
2117 
2118 	/**
2119 	 * The ::set-anchor signal is a
2120 	 * [keybinding signal][GtkBindingSignal]
2121 	 * which gets emitted when the user initiates setting the "anchor"
2122 	 * mark. The "anchor" mark gets placed at the same position as the
2123 	 * "insert" mark.
2124 	 *
2125 	 * This signal has no default bindings.
2126 	 */
2127 	gulong addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2128 	{
2129 		auto wrapper = new OnSetAnchorDelegateWrapper(dlg);
2130 		wrapper.handlerId = Signals.connectData(
2131 			this,
2132 			"set-anchor",
2133 			cast(GCallback)&callBackSetAnchor,
2134 			cast(void*)wrapper,
2135 			cast(GClosureNotify)&callBackSetAnchorDestroy,
2136 			connectFlags);
2137 		return wrapper.handlerId;
2138 	}
2139 
2140 	extern(C) static void callBackSetAnchor(GtkTextView* textviewStruct, OnSetAnchorDelegateWrapper wrapper)
2141 	{
2142 		wrapper.dlg(wrapper.outer);
2143 	}
2144 
2145 	extern(C) static void callBackSetAnchorDestroy(OnSetAnchorDelegateWrapper wrapper, GClosure* closure)
2146 	{
2147 		wrapper.remove(wrapper);
2148 	}
2149 
2150 	protected class OnToggleCursorVisibleDelegateWrapper
2151 	{
2152 		void delegate(TextView) dlg;
2153 		gulong handlerId;
2154 
2155 		this(void delegate(TextView) dlg)
2156 		{
2157 			this.dlg = dlg;
2158 			onToggleCursorVisibleListeners ~= this;
2159 		}
2160 
2161 		void remove(OnToggleCursorVisibleDelegateWrapper source)
2162 		{
2163 			foreach(index, wrapper; onToggleCursorVisibleListeners)
2164 			{
2165 				if (wrapper.handlerId == source.handlerId)
2166 				{
2167 					onToggleCursorVisibleListeners[index] = null;
2168 					onToggleCursorVisibleListeners = std.algorithm.remove(onToggleCursorVisibleListeners, index);
2169 					break;
2170 				}
2171 			}
2172 		}
2173 	}
2174 	OnToggleCursorVisibleDelegateWrapper[] onToggleCursorVisibleListeners;
2175 
2176 	/**
2177 	 * The ::toggle-cursor-visible signal is a
2178 	 * [keybinding signal][GtkBindingSignal]
2179 	 * which gets emitted to toggle the #GtkTextView:cursor-visible
2180 	 * property.
2181 	 *
2182 	 * The default binding for this signal is F7.
2183 	 */
2184 	gulong addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2185 	{
2186 		auto wrapper = new OnToggleCursorVisibleDelegateWrapper(dlg);
2187 		wrapper.handlerId = Signals.connectData(
2188 			this,
2189 			"toggle-cursor-visible",
2190 			cast(GCallback)&callBackToggleCursorVisible,
2191 			cast(void*)wrapper,
2192 			cast(GClosureNotify)&callBackToggleCursorVisibleDestroy,
2193 			connectFlags);
2194 		return wrapper.handlerId;
2195 	}
2196 
2197 	extern(C) static void callBackToggleCursorVisible(GtkTextView* textviewStruct, OnToggleCursorVisibleDelegateWrapper wrapper)
2198 	{
2199 		wrapper.dlg(wrapper.outer);
2200 	}
2201 
2202 	extern(C) static void callBackToggleCursorVisibleDestroy(OnToggleCursorVisibleDelegateWrapper wrapper, GClosure* closure)
2203 	{
2204 		wrapper.remove(wrapper);
2205 	}
2206 
2207 	protected class OnToggleOverwriteDelegateWrapper
2208 	{
2209 		void delegate(TextView) dlg;
2210 		gulong handlerId;
2211 
2212 		this(void delegate(TextView) dlg)
2213 		{
2214 			this.dlg = dlg;
2215 			onToggleOverwriteListeners ~= this;
2216 		}
2217 
2218 		void remove(OnToggleOverwriteDelegateWrapper source)
2219 		{
2220 			foreach(index, wrapper; onToggleOverwriteListeners)
2221 			{
2222 				if (wrapper.handlerId == source.handlerId)
2223 				{
2224 					onToggleOverwriteListeners[index] = null;
2225 					onToggleOverwriteListeners = std.algorithm.remove(onToggleOverwriteListeners, index);
2226 					break;
2227 				}
2228 			}
2229 		}
2230 	}
2231 	OnToggleOverwriteDelegateWrapper[] onToggleOverwriteListeners;
2232 
2233 	/**
2234 	 * The ::toggle-overwrite signal is a
2235 	 * [keybinding signal][GtkBindingSignal]
2236 	 * which gets emitted to toggle the overwrite mode of the text view.
2237 	 *
2238 	 * The default bindings for this signal is Insert.
2239 	 */
2240 	gulong addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2241 	{
2242 		auto wrapper = new OnToggleOverwriteDelegateWrapper(dlg);
2243 		wrapper.handlerId = Signals.connectData(
2244 			this,
2245 			"toggle-overwrite",
2246 			cast(GCallback)&callBackToggleOverwrite,
2247 			cast(void*)wrapper,
2248 			cast(GClosureNotify)&callBackToggleOverwriteDestroy,
2249 			connectFlags);
2250 		return wrapper.handlerId;
2251 	}
2252 
2253 	extern(C) static void callBackToggleOverwrite(GtkTextView* textviewStruct, OnToggleOverwriteDelegateWrapper wrapper)
2254 	{
2255 		wrapper.dlg(wrapper.outer);
2256 	}
2257 
2258 	extern(C) static void callBackToggleOverwriteDestroy(OnToggleOverwriteDelegateWrapper wrapper, GClosure* closure)
2259 	{
2260 		wrapper.remove(wrapper);
2261 	}
2262 }