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