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