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