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 public  import gtkc.gdktypes;
42 private import gtkc.gtk;
43 public  import gtkc.gtktypes;
44 private import pango.PgTabArray;
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 	 * Return: 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 	 * Return: 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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: 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 	 * Return: 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 	 * Return: 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 is being displayed.
450 	 *
451 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: %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 	 * Return: %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 	 * Return: 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 	 * Return: 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 	 * Return: %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 	 * Return: 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 	 *
686 	 * Return: default number of pixels above paragraphs
687 	 */
688 	public int getPixelsAboveLines()
689 	{
690 		return gtk_text_view_get_pixels_above_lines(gtkTextView);
691 	}
692 
693 	/**
694 	 * Gets the value set by gtk_text_view_set_pixels_below_lines().
695 	 *
696 	 * Return: default number of blank pixels below paragraphs
697 	 */
698 	public int getPixelsBelowLines()
699 	{
700 		return gtk_text_view_get_pixels_below_lines(gtkTextView);
701 	}
702 
703 	/**
704 	 * Gets the value set by gtk_text_view_set_pixels_inside_wrap().
705 	 *
706 	 * Return: default number of pixels of blank space between wrapped lines
707 	 */
708 	public int getPixelsInsideWrap()
709 	{
710 		return gtk_text_view_get_pixels_inside_wrap(gtkTextView);
711 	}
712 
713 	/**
714 	 * Gets the default right margin for text in @text_view. Tags
715 	 * in the buffer may override the default.
716 	 *
717 	 * Return: right margin in pixels
718 	 */
719 	public int getRightMargin()
720 	{
721 		return gtk_text_view_get_right_margin(gtkTextView);
722 	}
723 
724 	/**
725 	 * Gets the default tabs for @text_view. Tags in the buffer may
726 	 * override the defaults. The returned array will be %NULL if
727 	 * “standard” (8-space) tabs are used. Free the return value
728 	 * with pango_tab_array_free().
729 	 *
730 	 * Return: copy of default tab array, or %NULL if
731 	 *     “standard" tabs are used; must be freed with pango_tab_array_free().
732 	 */
733 	public PgTabArray getTabs()
734 	{
735 		auto p = gtk_text_view_get_tabs(gtkTextView);
736 		
737 		if(p is null)
738 		{
739 			return null;
740 		}
741 		
742 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p, true);
743 	}
744 
745 	/**
746 	 * Gets the top margin for text in the @text_view.
747 	 *
748 	 * Return: top margin in pixels
749 	 *
750 	 * Since: 3.18
751 	 */
752 	public int getTopMargin()
753 	{
754 		return gtk_text_view_get_top_margin(gtkTextView);
755 	}
756 
757 	/**
758 	 * Fills @visible_rect with the currently-visible
759 	 * region of the buffer, in buffer coordinates. Convert to window coordinates
760 	 * with gtk_text_view_buffer_to_window_coords().
761 	 *
762 	 * Params:
763 	 *     visibleRect = rectangle to fill
764 	 */
765 	public void getVisibleRect(out GdkRectangle visibleRect)
766 	{
767 		gtk_text_view_get_visible_rect(gtkTextView, &visibleRect);
768 	}
769 
770 	/**
771 	 * Retrieves the #GdkWindow corresponding to an area of the text view;
772 	 * possible windows include the overall widget window, child windows
773 	 * on the left, right, top, bottom, and the window that displays the
774 	 * text buffer. Windows are %NULL and nonexistent if their width or
775 	 * height is 0, and are nonexistent before the widget has been
776 	 * realized.
777 	 *
778 	 * Params:
779 	 *     win = window to get
780 	 *
781 	 * Return: a #GdkWindow, or %NULL
782 	 */
783 	public Window getWindow(GtkTextWindowType win)
784 	{
785 		auto p = gtk_text_view_get_window(gtkTextView, win);
786 		
787 		if(p is null)
788 		{
789 			return null;
790 		}
791 		
792 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
793 	}
794 
795 	/**
796 	 * Usually used to find out which window an event corresponds to.
797 	 * If you connect to an event signal on @text_view, this function
798 	 * should be called on `event->window` to
799 	 * see which window it was.
800 	 *
801 	 * Params:
802 	 *     window = a window type
803 	 *
804 	 * Return: the window type.
805 	 */
806 	public GtkTextWindowType getWindowType(Window window)
807 	{
808 		return gtk_text_view_get_window_type(gtkTextView, (window is null) ? null : window.getWindowStruct());
809 	}
810 
811 	/**
812 	 * Gets the line wrapping for the view.
813 	 *
814 	 * Return: the line wrap setting
815 	 */
816 	public GtkWrapMode getWrapMode()
817 	{
818 		return gtk_text_view_get_wrap_mode(gtkTextView);
819 	}
820 
821 	/**
822 	 * Allow the #GtkTextView input method to internally handle key press
823 	 * and release events. If this function returns %TRUE, then no further
824 	 * processing should be done for this key event. See
825 	 * gtk_im_context_filter_keypress().
826 	 *
827 	 * Note that you are expected to call this function from your handler
828 	 * when overriding key event handling. This is needed in the case when
829 	 * you need to insert your own key handling between the input method
830 	 * and the default key event handling of the #GtkTextView.
831 	 *
832 	 * |[<!-- language="C" -->
833 	 * static gboolean
834 	 * gtk_foo_bar_key_press_event (GtkWidget   *widget,
835 	 * GdkEventKey *event)
836 	 * {
837 	 * if ((key->keyval == GDK_KEY_Return || key->keyval == GDK_KEY_KP_Enter))
838 	 * {
839 	 * if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event))
840 	 * return TRUE;
841 	 * }
842 	 *
843 	 * // Do some stuff
844 	 *
845 	 * return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
846 	 * }
847 	 * ]|
848 	 *
849 	 * Params:
850 	 *     event = the key event
851 	 *
852 	 * Return: %TRUE if the input method handled the key event.
853 	 *
854 	 * Since: 2.22
855 	 */
856 	public bool imContextFilterKeypress(GdkEventKey* event)
857 	{
858 		return gtk_text_view_im_context_filter_keypress(gtkTextView, event) != 0;
859 	}
860 
861 	/**
862 	 * Updates the position of a child, as for gtk_text_view_add_child_in_window().
863 	 *
864 	 * Params:
865 	 *     child = child widget already added to the text view
866 	 *     xpos = new X position in window coordinates
867 	 *     ypos = new Y position in window coordinates
868 	 */
869 	public void moveChild(Widget child, int xpos, int ypos)
870 	{
871 		gtk_text_view_move_child(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos);
872 	}
873 
874 	/**
875 	 * Moves a mark within the buffer so that it's
876 	 * located within the currently-visible text area.
877 	 *
878 	 * Params:
879 	 *     mark = a #GtkTextMark
880 	 *
881 	 * Return: %TRUE if the mark moved (wasn’t already onscreen)
882 	 */
883 	public bool moveMarkOnscreen(TextMark mark)
884 	{
885 		return gtk_text_view_move_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()) != 0;
886 	}
887 
888 	/**
889 	 * Move the iterator a given number of characters visually, treating
890 	 * it as the strong cursor position. If @count is positive, then the
891 	 * new strong cursor position will be @count positions to the right of
892 	 * the old cursor position. If @count is negative then the new strong
893 	 * cursor position will be @count positions to the left of the old
894 	 * cursor position.
895 	 *
896 	 * In the presence of bi-directional text, the correspondence
897 	 * between logical and visual order will depend on the direction
898 	 * of the current run, and there may be jumps when the cursor
899 	 * is moved off of the end of a run.
900 	 *
901 	 * Params:
902 	 *     iter = a #GtkTextIter
903 	 *     count = number of characters to move (negative moves left,
904 	 *         positive moves right)
905 	 *
906 	 * Return: %TRUE if @iter moved and is not on the end iterator
907 	 */
908 	public bool moveVisually(TextIter iter, int count)
909 	{
910 		return gtk_text_view_move_visually(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), count) != 0;
911 	}
912 
913 	/**
914 	 * Moves the cursor to the currently visible region of the
915 	 * buffer, it it isn’t there already.
916 	 *
917 	 * Return: %TRUE if the cursor had to be moved.
918 	 */
919 	public bool placeCursorOnscreen()
920 	{
921 		return gtk_text_view_place_cursor_onscreen(gtkTextView) != 0;
922 	}
923 
924 	/**
925 	 * Ensures that the cursor is shown (i.e. not in an 'off' blink
926 	 * interval) and resets the time that it will stay blinking (or
927 	 * visible, in case blinking is disabled).
928 	 *
929 	 * This function should be called in response to user input
930 	 * (e.g. from derived classes that override the textview's
931 	 * #GtkWidget::key-press-event handler).
932 	 *
933 	 * Since: 3.20
934 	 */
935 	public void resetCursorBlink()
936 	{
937 		gtk_text_view_reset_cursor_blink(gtkTextView);
938 	}
939 
940 	/**
941 	 * Reset the input method context of the text view if needed.
942 	 *
943 	 * This can be necessary in the case where modifying the buffer
944 	 * would confuse on-going input method behavior.
945 	 *
946 	 * Since: 2.22
947 	 */
948 	public void resetImContext()
949 	{
950 		gtk_text_view_reset_im_context(gtkTextView);
951 	}
952 
953 	/**
954 	 * Scrolls @text_view the minimum distance such that @mark is contained
955 	 * within the visible area of the widget.
956 	 *
957 	 * Params:
958 	 *     mark = a mark in the buffer for @text_view
959 	 */
960 	public void scrollMarkOnscreen(TextMark mark)
961 	{
962 		gtk_text_view_scroll_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct());
963 	}
964 
965 	/**
966 	 * Scrolls @text_view so that @iter is on the screen in the position
967 	 * indicated by @xalign and @yalign. An alignment of 0.0 indicates
968 	 * left or top, 1.0 indicates right or bottom, 0.5 means center.
969 	 * If @use_align is %FALSE, the text scrolls the minimal distance to
970 	 * get the mark onscreen, possibly not scrolling at all. The effective
971 	 * screen for purposes of this function is reduced by a margin of size
972 	 * @within_margin.
973 	 *
974 	 * Note that this function uses the currently-computed height of the
975 	 * lines in the text buffer. Line heights are computed in an idle
976 	 * handler; so this function may not have the desired effect if it’s
977 	 * called before the height computations. To avoid oddness, consider
978 	 * using gtk_text_view_scroll_to_mark() which saves a point to be
979 	 * scrolled to after line validation.
980 	 *
981 	 * Params:
982 	 *     iter = a #GtkTextIter
983 	 *     withinMargin = margin as a [0.0,0.5) fraction of screen size
984 	 *     useAlign = whether to use alignment arguments (if %FALSE,
985 	 *         just get the mark onscreen)
986 	 *     xalign = horizontal alignment of mark within visible area
987 	 *     yalign = vertical alignment of mark within visible area
988 	 *
989 	 * Return: %TRUE if scrolling occurred
990 	 */
991 	public bool scrollToIter(TextIter iter, double withinMargin, bool useAlign, double xalign, double yalign)
992 	{
993 		return gtk_text_view_scroll_to_iter(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), withinMargin, useAlign, xalign, yalign) != 0;
994 	}
995 
996 	/**
997 	 * Scrolls @text_view so that @mark is on the screen in the position
998 	 * indicated by @xalign and @yalign. An alignment of 0.0 indicates
999 	 * left or top, 1.0 indicates right or bottom, 0.5 means center.
1000 	 * If @use_align is %FALSE, the text scrolls the minimal distance to
1001 	 * get the mark onscreen, possibly not scrolling at all. The effective
1002 	 * screen for purposes of this function is reduced by a margin of size
1003 	 * @within_margin.
1004 	 *
1005 	 * Params:
1006 	 *     mark = a #GtkTextMark
1007 	 *     withinMargin = margin as a [0.0,0.5) fraction of screen size
1008 	 *     useAlign = whether to use alignment arguments (if %FALSE, just
1009 	 *         get the mark onscreen)
1010 	 *     xalign = horizontal alignment of mark within visible area
1011 	 *     yalign = vertical alignment of mark within visible area
1012 	 */
1013 	public void scrollToMark(TextMark mark, double withinMargin, bool useAlign, double xalign, double yalign)
1014 	{
1015 		gtk_text_view_scroll_to_mark(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct(), withinMargin, useAlign, xalign, yalign);
1016 	}
1017 
1018 	/**
1019 	 * Sets the behavior of the text widget when the Tab key is pressed.
1020 	 * If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab
1021 	 * is %FALSE the keyboard focus is moved to the next widget in the focus
1022 	 * chain.
1023 	 *
1024 	 * Params:
1025 	 *     acceptsTab = %TRUE if pressing the Tab key should insert a tab
1026 	 *         character, %FALSE, if pressing the Tab key should move the
1027 	 *         keyboard focus.
1028 	 *
1029 	 * Since: 2.4
1030 	 */
1031 	public void setAcceptsTab(bool acceptsTab)
1032 	{
1033 		gtk_text_view_set_accepts_tab(gtkTextView, acceptsTab);
1034 	}
1035 
1036 	/**
1037 	 * Sets the width of %GTK_TEXT_WINDOW_LEFT or %GTK_TEXT_WINDOW_RIGHT,
1038 	 * or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
1039 	 * Automatically destroys the corresponding window if the size is set
1040 	 * to 0, and creates the window if the size is set to non-zero.  This
1041 	 * function can only be used for the “border windows,” it doesn’t work
1042 	 * with #GTK_TEXT_WINDOW_WIDGET, #GTK_TEXT_WINDOW_TEXT, or
1043 	 * #GTK_TEXT_WINDOW_PRIVATE.
1044 	 *
1045 	 * Params:
1046 	 *     type = window to affect
1047 	 *     size = width or height of the window
1048 	 */
1049 	public void setBorderWindowSize(GtkTextWindowType type, int size)
1050 	{
1051 		gtk_text_view_set_border_window_size(gtkTextView, type, size);
1052 	}
1053 
1054 	/**
1055 	 * Sets the bottom margin for text in @text_view.
1056 	 *
1057 	 * Note that this function is confusingly named.
1058 	 * In CSS terms, the value set here is padding.
1059 	 *
1060 	 * Params:
1061 	 *     bottomMargin = bottom margin in pixels
1062 	 *
1063 	 * Since: 3.18
1064 	 */
1065 	public void setBottomMargin(int bottomMargin)
1066 	{
1067 		gtk_text_view_set_bottom_margin(gtkTextView, bottomMargin);
1068 	}
1069 
1070 	/**
1071 	 * Sets @buffer as the buffer being displayed by @text_view. The previous
1072 	 * buffer displayed by the text view is unreferenced, and a reference is
1073 	 * added to @buffer. If you owned a reference to @buffer before passing it
1074 	 * to this function, you must remove that reference yourself; #GtkTextView
1075 	 * will not “adopt” it.
1076 	 *
1077 	 * Params:
1078 	 *     buffer = a #GtkTextBuffer
1079 	 */
1080 	public void setBuffer(TextBuffer buffer)
1081 	{
1082 		gtk_text_view_set_buffer(gtkTextView, (buffer is null) ? null : buffer.getTextBufferStruct());
1083 	}
1084 
1085 	/**
1086 	 * Toggles whether the insertion point is displayed. A buffer with no editable
1087 	 * text probably shouldn’t have a visible cursor, so you may want to turn
1088 	 * the cursor off.
1089 	 *
1090 	 * Params:
1091 	 *     setting = whether to show the insertion cursor
1092 	 */
1093 	public void setCursorVisible(bool setting)
1094 	{
1095 		gtk_text_view_set_cursor_visible(gtkTextView, setting);
1096 	}
1097 
1098 	/**
1099 	 * Sets the default editability of the #GtkTextView. You can override
1100 	 * this default setting with tags in the buffer, using the “editable”
1101 	 * attribute of tags.
1102 	 *
1103 	 * Params:
1104 	 *     setting = whether it’s editable
1105 	 */
1106 	public void setEditable(bool setting)
1107 	{
1108 		gtk_text_view_set_editable(gtkTextView, setting);
1109 	}
1110 
1111 	/**
1112 	 * Sets the default indentation for paragraphs in @text_view.
1113 	 * Tags in the buffer may override the default.
1114 	 *
1115 	 * Params:
1116 	 *     indent = indentation in pixels
1117 	 */
1118 	public void setIndent(int indent)
1119 	{
1120 		gtk_text_view_set_indent(gtkTextView, indent);
1121 	}
1122 
1123 	/**
1124 	 * Sets the #GtkTextView:input-hints property, which
1125 	 * allows input methods to fine-tune their behaviour.
1126 	 *
1127 	 * Params:
1128 	 *     hints = the hints
1129 	 *
1130 	 * Since: 3.6
1131 	 */
1132 	public void setInputHints(GtkInputHints hints)
1133 	{
1134 		gtk_text_view_set_input_hints(gtkTextView, hints);
1135 	}
1136 
1137 	/**
1138 	 * Sets the #GtkTextView:input-purpose property which
1139 	 * can be used by on-screen keyboards and other input
1140 	 * methods to adjust their behaviour.
1141 	 *
1142 	 * Params:
1143 	 *     purpose = the purpose
1144 	 *
1145 	 * Since: 3.6
1146 	 */
1147 	public void setInputPurpose(GtkInputPurpose purpose)
1148 	{
1149 		gtk_text_view_set_input_purpose(gtkTextView, purpose);
1150 	}
1151 
1152 	/**
1153 	 * Sets the default justification of text in @text_view.
1154 	 * Tags in the view’s buffer may override the default.
1155 	 *
1156 	 * Params:
1157 	 *     justification = justification
1158 	 */
1159 	public void setJustification(GtkJustification justification)
1160 	{
1161 		gtk_text_view_set_justification(gtkTextView, justification);
1162 	}
1163 
1164 	/**
1165 	 * Sets the default left margin for text in @text_view.
1166 	 * Tags in the buffer may override the default.
1167 	 *
1168 	 * Note that this function is confusingly named.
1169 	 * In CSS terms, the value set here is padding.
1170 	 *
1171 	 * Params:
1172 	 *     leftMargin = left margin in pixels
1173 	 */
1174 	public void setLeftMargin(int leftMargin)
1175 	{
1176 		gtk_text_view_set_left_margin(gtkTextView, leftMargin);
1177 	}
1178 
1179 	/**
1180 	 * Sets the #GtkTextView:monospace property, which
1181 	 * indicates that the text view should use monospace
1182 	 * fonts.
1183 	 *
1184 	 * Params:
1185 	 *     monospace = %TRUE to request monospace styling
1186 	 *
1187 	 * Since: 3.16
1188 	 */
1189 	public void setMonospace(bool monospace)
1190 	{
1191 		gtk_text_view_set_monospace(gtkTextView, monospace);
1192 	}
1193 
1194 	/**
1195 	 * Changes the #GtkTextView overwrite mode.
1196 	 *
1197 	 * Params:
1198 	 *     overwrite = %TRUE to turn on overwrite mode, %FALSE to turn it off
1199 	 *
1200 	 * Since: 2.4
1201 	 */
1202 	public void setOverwrite(bool overwrite)
1203 	{
1204 		gtk_text_view_set_overwrite(gtkTextView, overwrite);
1205 	}
1206 
1207 	/**
1208 	 * Sets the default number of blank pixels above paragraphs in @text_view.
1209 	 * Tags in the buffer for @text_view may override the defaults.
1210 	 *
1211 	 * Params:
1212 	 *     pixelsAboveLines = pixels above paragraphs
1213 	 */
1214 	public void setPixelsAboveLines(int pixelsAboveLines)
1215 	{
1216 		gtk_text_view_set_pixels_above_lines(gtkTextView, pixelsAboveLines);
1217 	}
1218 
1219 	/**
1220 	 * Sets the default number of pixels of blank space
1221 	 * to put below paragraphs in @text_view. May be overridden
1222 	 * by tags applied to @text_view’s buffer.
1223 	 *
1224 	 * Params:
1225 	 *     pixelsBelowLines = pixels below paragraphs
1226 	 */
1227 	public void setPixelsBelowLines(int pixelsBelowLines)
1228 	{
1229 		gtk_text_view_set_pixels_below_lines(gtkTextView, pixelsBelowLines);
1230 	}
1231 
1232 	/**
1233 	 * Sets the default number of pixels of blank space to leave between
1234 	 * display/wrapped lines within a paragraph. May be overridden by
1235 	 * tags in @text_view’s buffer.
1236 	 *
1237 	 * Params:
1238 	 *     pixelsInsideWrap = default number of pixels between wrapped lines
1239 	 */
1240 	public void setPixelsInsideWrap(int pixelsInsideWrap)
1241 	{
1242 		gtk_text_view_set_pixels_inside_wrap(gtkTextView, pixelsInsideWrap);
1243 	}
1244 
1245 	/**
1246 	 * Sets the default right margin for text in the text view.
1247 	 * Tags in the buffer may override the default.
1248 	 *
1249 	 * Note that this function is confusingly named.
1250 	 * In CSS terms, the value set here is padding.
1251 	 *
1252 	 * Params:
1253 	 *     rightMargin = right margin in pixels
1254 	 */
1255 	public void setRightMargin(int rightMargin)
1256 	{
1257 		gtk_text_view_set_right_margin(gtkTextView, rightMargin);
1258 	}
1259 
1260 	/**
1261 	 * Sets the default tab stops for paragraphs in @text_view.
1262 	 * Tags in the buffer may override the default.
1263 	 *
1264 	 * Params:
1265 	 *     tabs = tabs as a #PangoTabArray
1266 	 */
1267 	public void setTabs(PgTabArray tabs)
1268 	{
1269 		gtk_text_view_set_tabs(gtkTextView, (tabs is null) ? null : tabs.getPgTabArrayStruct());
1270 	}
1271 
1272 	/**
1273 	 * Sets the top margin for text in @text_view.
1274 	 *
1275 	 * Note that this function is confusingly named.
1276 	 * In CSS terms, the value set here is padding.
1277 	 *
1278 	 * Params:
1279 	 *     topMargin = top margin in pixels
1280 	 *
1281 	 * Since: 3.18
1282 	 */
1283 	public void setTopMargin(int topMargin)
1284 	{
1285 		gtk_text_view_set_top_margin(gtkTextView, topMargin);
1286 	}
1287 
1288 	/**
1289 	 * Sets the line wrapping for the view.
1290 	 *
1291 	 * Params:
1292 	 *     wrapMode = a #GtkWrapMode
1293 	 */
1294 	public void setWrapMode(GtkWrapMode wrapMode)
1295 	{
1296 		gtk_text_view_set_wrap_mode(gtkTextView, wrapMode);
1297 	}
1298 
1299 	/**
1300 	 * Determines whether @iter is at the start of a display line.
1301 	 * See gtk_text_view_forward_display_line() for an explanation of
1302 	 * display lines vs. paragraphs.
1303 	 *
1304 	 * Params:
1305 	 *     iter = a #GtkTextIter
1306 	 *
1307 	 * Return: %TRUE if @iter begins a wrapped line
1308 	 */
1309 	public bool startsDisplayLine(TextIter iter)
1310 	{
1311 		return gtk_text_view_starts_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
1312 	}
1313 
1314 	/**
1315 	 * Converts coordinates on the window identified by @win to buffer
1316 	 * coordinates, storing the result in (@buffer_x,@buffer_y).
1317 	 *
1318 	 * Note that you can’t convert coordinates for a nonexisting window (see
1319 	 * gtk_text_view_set_border_window_size()).
1320 	 *
1321 	 * Params:
1322 	 *     win = a #GtkTextWindowType except #GTK_TEXT_WINDOW_PRIVATE
1323 	 *     windowX = window x coordinate
1324 	 *     windowY = window y coordinate
1325 	 *     bufferX = buffer x coordinate return location or %NULL
1326 	 *     bufferY = buffer y coordinate return location or %NULL
1327 	 */
1328 	public void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, out int bufferX, out int bufferY)
1329 	{
1330 		gtk_text_view_window_to_buffer_coords(gtkTextView, win, windowX, windowY, &bufferX, &bufferY);
1331 	}
1332 
1333 	int[string] connectedSignals;
1334 
1335 	void delegate(TextView)[] onBackspaceListeners;
1336 	/**
1337 	 * The ::backspace signal is a
1338 	 * [keybinding signal][GtkBindingSignal]
1339 	 * which gets emitted when the user asks for it.
1340 	 *
1341 	 * The default bindings for this signal are
1342 	 * Backspace and Shift-Backspace.
1343 	 */
1344 	void addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1345 	{
1346 		if ( "backspace" !in connectedSignals )
1347 		{
1348 			Signals.connectData(
1349 				this,
1350 				"backspace",
1351 				cast(GCallback)&callBackBackspace,
1352 				cast(void*)this,
1353 				null,
1354 				connectFlags);
1355 			connectedSignals["backspace"] = 1;
1356 		}
1357 		onBackspaceListeners ~= dlg;
1358 	}
1359 	extern(C) static void callBackBackspace(GtkTextView* textviewStruct, TextView _textview)
1360 	{
1361 		foreach ( void delegate(TextView) dlg; _textview.onBackspaceListeners )
1362 		{
1363 			dlg(_textview);
1364 		}
1365 	}
1366 
1367 	void delegate(TextView)[] onCopyClipboardListeners;
1368 	/**
1369 	 * The ::copy-clipboard signal is a
1370 	 * [keybinding signal][GtkBindingSignal]
1371 	 * which gets emitted to copy the selection to the clipboard.
1372 	 *
1373 	 * The default bindings for this signal are
1374 	 * Ctrl-c and Ctrl-Insert.
1375 	 */
1376 	void addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1377 	{
1378 		if ( "copy-clipboard" !in connectedSignals )
1379 		{
1380 			Signals.connectData(
1381 				this,
1382 				"copy-clipboard",
1383 				cast(GCallback)&callBackCopyClipboard,
1384 				cast(void*)this,
1385 				null,
1386 				connectFlags);
1387 			connectedSignals["copy-clipboard"] = 1;
1388 		}
1389 		onCopyClipboardListeners ~= dlg;
1390 	}
1391 	extern(C) static void callBackCopyClipboard(GtkTextView* textviewStruct, TextView _textview)
1392 	{
1393 		foreach ( void delegate(TextView) dlg; _textview.onCopyClipboardListeners )
1394 		{
1395 			dlg(_textview);
1396 		}
1397 	}
1398 
1399 	void delegate(TextView)[] onCutClipboardListeners;
1400 	/**
1401 	 * The ::cut-clipboard signal is a
1402 	 * [keybinding signal][GtkBindingSignal]
1403 	 * which gets emitted to cut the selection to the clipboard.
1404 	 *
1405 	 * The default bindings for this signal are
1406 	 * Ctrl-x and Shift-Delete.
1407 	 */
1408 	void addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1409 	{
1410 		if ( "cut-clipboard" !in connectedSignals )
1411 		{
1412 			Signals.connectData(
1413 				this,
1414 				"cut-clipboard",
1415 				cast(GCallback)&callBackCutClipboard,
1416 				cast(void*)this,
1417 				null,
1418 				connectFlags);
1419 			connectedSignals["cut-clipboard"] = 1;
1420 		}
1421 		onCutClipboardListeners ~= dlg;
1422 	}
1423 	extern(C) static void callBackCutClipboard(GtkTextView* textviewStruct, TextView _textview)
1424 	{
1425 		foreach ( void delegate(TextView) dlg; _textview.onCutClipboardListeners )
1426 		{
1427 			dlg(_textview);
1428 		}
1429 	}
1430 
1431 	void delegate(GtkDeleteType, int, TextView)[] onDeleteFromCursorListeners;
1432 	/**
1433 	 * The ::delete-from-cursor signal is a
1434 	 * [keybinding signal][GtkBindingSignal]
1435 	 * which gets emitted when the user initiates a text deletion.
1436 	 *
1437 	 * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection
1438 	 * if there is one, otherwise it deletes the requested number
1439 	 * of characters.
1440 	 *
1441 	 * The default bindings for this signal are
1442 	 * Delete for deleting a character, Ctrl-Delete for
1443 	 * deleting a word and Ctrl-Backspace for deleting a word
1444 	 * backwords.
1445 	 *
1446 	 * Params:
1447 	 *     type = the granularity of the deletion, as a #GtkDeleteType
1448 	 *     count = the number of @type units to delete
1449 	 */
1450 	void addOnDeleteFromCursor(void delegate(GtkDeleteType, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1451 	{
1452 		if ( "delete-from-cursor" !in connectedSignals )
1453 		{
1454 			Signals.connectData(
1455 				this,
1456 				"delete-from-cursor",
1457 				cast(GCallback)&callBackDeleteFromCursor,
1458 				cast(void*)this,
1459 				null,
1460 				connectFlags);
1461 			connectedSignals["delete-from-cursor"] = 1;
1462 		}
1463 		onDeleteFromCursorListeners ~= dlg;
1464 	}
1465 	extern(C) static void callBackDeleteFromCursor(GtkTextView* textviewStruct, GtkDeleteType type, int count, TextView _textview)
1466 	{
1467 		foreach ( void delegate(GtkDeleteType, int, TextView) dlg; _textview.onDeleteFromCursorListeners )
1468 		{
1469 			dlg(type, count, _textview);
1470 		}
1471 	}
1472 
1473 	bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView)[] onExtendSelectionListeners;
1474 	/**
1475 	 * The ::extend-selection signal is emitted when the selection needs to be
1476 	 * extended at @location.
1477 	 *
1478 	 * Params:
1479 	 *     granularity = the granularity type
1480 	 *     location = the location where to extend the selection
1481 	 *     start = where the selection should start
1482 	 *     end = where the selection should end
1483 	 *
1484 	 * Return: %GDK_EVENT_STOP to stop other handlers from being invoked for the
1485 	 *     event. %GDK_EVENT_PROPAGATE to propagate the event further.
1486 	 *
1487 	 * Since: 3.16
1488 	 */
1489 	void addOnExtendSelection(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1490 	{
1491 		if ( "extend-selection" !in connectedSignals )
1492 		{
1493 			Signals.connectData(
1494 				this,
1495 				"extend-selection",
1496 				cast(GCallback)&callBackExtendSelection,
1497 				cast(void*)this,
1498 				null,
1499 				connectFlags);
1500 			connectedSignals["extend-selection"] = 1;
1501 		}
1502 		onExtendSelectionListeners ~= dlg;
1503 	}
1504 	extern(C) static int callBackExtendSelection(GtkTextView* textviewStruct, GtkTextExtendSelection granularity, GtkTextIter* location, GtkTextIter* start, GtkTextIter* end, TextView _textview)
1505 	{
1506 		foreach ( bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg; _textview.onExtendSelectionListeners )
1507 		{
1508 			if ( dlg(granularity, ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), _textview) )
1509 			{
1510 				return 1;
1511 			}
1512 		}
1513 		
1514 		return 0;
1515 	}
1516 
1517 	void delegate(string, TextView)[] onInsertAtCursorListeners;
1518 	/**
1519 	 * The ::insert-at-cursor signal is a
1520 	 * [keybinding signal][GtkBindingSignal]
1521 	 * which gets emitted when the user initiates the insertion of a
1522 	 * fixed string at the cursor.
1523 	 *
1524 	 * This signal has no default bindings.
1525 	 *
1526 	 * Params:
1527 	 *     str = the string to insert
1528 	 */
1529 	void addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1530 	{
1531 		if ( "insert-at-cursor" !in connectedSignals )
1532 		{
1533 			Signals.connectData(
1534 				this,
1535 				"insert-at-cursor",
1536 				cast(GCallback)&callBackInsertAtCursor,
1537 				cast(void*)this,
1538 				null,
1539 				connectFlags);
1540 			connectedSignals["insert-at-cursor"] = 1;
1541 		}
1542 		onInsertAtCursorListeners ~= dlg;
1543 	}
1544 	extern(C) static void callBackInsertAtCursor(GtkTextView* textviewStruct, char* str, TextView _textview)
1545 	{
1546 		foreach ( void delegate(string, TextView) dlg; _textview.onInsertAtCursorListeners )
1547 		{
1548 			dlg(Str.toString(str), _textview);
1549 		}
1550 	}
1551 
1552 	void delegate(GtkMovementStep, int, bool, TextView)[] onMoveCursorListeners;
1553 	/**
1554 	 * The ::move-cursor signal is a
1555 	 * [keybinding signal][GtkBindingSignal]
1556 	 * which gets emitted when the user initiates a cursor movement.
1557 	 * If the cursor is not visible in @text_view, this signal causes
1558 	 * the viewport to be moved instead.
1559 	 *
1560 	 * Applications should not connect to it, but may emit it with
1561 	 * g_signal_emit_by_name() if they need to control the cursor
1562 	 * programmatically.
1563 	 *
1564 	 * The default bindings for this signal come in two variants,
1565 	 * the variant with the Shift modifier extends the selection,
1566 	 * the variant without the Shift modifer does not.
1567 	 * There are too many key combinations to list them all here.
1568 	 * - Arrow keys move by individual characters/lines
1569 	 * - Ctrl-arrow key combinations move by words/paragraphs
1570 	 * - Home/End keys move to the ends of the buffer
1571 	 * - PageUp/PageDown keys move vertically by pages
1572 	 * - Ctrl-PageUp/PageDown keys move horizontally by pages
1573 	 *
1574 	 * Params:
1575 	 *     step = the granularity of the move, as a #GtkMovementStep
1576 	 *     count = the number of @step units to move
1577 	 *     extendSelection = %TRUE if the move should extend the selection
1578 	 */
1579 	void addOnMoveCursor(void delegate(GtkMovementStep, int, bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1580 	{
1581 		if ( "move-cursor" !in connectedSignals )
1582 		{
1583 			Signals.connectData(
1584 				this,
1585 				"move-cursor",
1586 				cast(GCallback)&callBackMoveCursor,
1587 				cast(void*)this,
1588 				null,
1589 				connectFlags);
1590 			connectedSignals["move-cursor"] = 1;
1591 		}
1592 		onMoveCursorListeners ~= dlg;
1593 	}
1594 	extern(C) static void callBackMoveCursor(GtkTextView* textviewStruct, GtkMovementStep step, int count, bool extendSelection, TextView _textview)
1595 	{
1596 		foreach ( void delegate(GtkMovementStep, int, bool, TextView) dlg; _textview.onMoveCursorListeners )
1597 		{
1598 			dlg(step, count, extendSelection, _textview);
1599 		}
1600 	}
1601 
1602 	void delegate(GtkScrollStep, int, TextView)[] onMoveViewportListeners;
1603 	/**
1604 	 * The ::move-viewport signal is a
1605 	 * [keybinding signal][GtkBindingSignal]
1606 	 * which can be bound to key combinations to allow the user
1607 	 * to move the viewport, i.e. change what part of the text view
1608 	 * is visible in a containing scrolled window.
1609 	 *
1610 	 * There are no default bindings for this signal.
1611 	 *
1612 	 * Params:
1613 	 *     step = the granularity of the move, as a #GtkMovementStep
1614 	 *     count = the number of @step units to move
1615 	 */
1616 	void addOnMoveViewport(void delegate(GtkScrollStep, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1617 	{
1618 		if ( "move-viewport" !in connectedSignals )
1619 		{
1620 			Signals.connectData(
1621 				this,
1622 				"move-viewport",
1623 				cast(GCallback)&callBackMoveViewport,
1624 				cast(void*)this,
1625 				null,
1626 				connectFlags);
1627 			connectedSignals["move-viewport"] = 1;
1628 		}
1629 		onMoveViewportListeners ~= dlg;
1630 	}
1631 	extern(C) static void callBackMoveViewport(GtkTextView* textviewStruct, GtkScrollStep step, int count, TextView _textview)
1632 	{
1633 		foreach ( void delegate(GtkScrollStep, int, TextView) dlg; _textview.onMoveViewportListeners )
1634 		{
1635 			dlg(step, count, _textview);
1636 		}
1637 	}
1638 
1639 	void delegate(TextView)[] onPasteClipboardListeners;
1640 	/**
1641 	 * The ::paste-clipboard signal is a
1642 	 * [keybinding signal][GtkBindingSignal]
1643 	 * which gets emitted to paste the contents of the clipboard
1644 	 * into the text view.
1645 	 *
1646 	 * The default bindings for this signal are
1647 	 * Ctrl-v and Shift-Insert.
1648 	 */
1649 	void addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1650 	{
1651 		if ( "paste-clipboard" !in connectedSignals )
1652 		{
1653 			Signals.connectData(
1654 				this,
1655 				"paste-clipboard",
1656 				cast(GCallback)&callBackPasteClipboard,
1657 				cast(void*)this,
1658 				null,
1659 				connectFlags);
1660 			connectedSignals["paste-clipboard"] = 1;
1661 		}
1662 		onPasteClipboardListeners ~= dlg;
1663 	}
1664 	extern(C) static void callBackPasteClipboard(GtkTextView* textviewStruct, TextView _textview)
1665 	{
1666 		foreach ( void delegate(TextView) dlg; _textview.onPasteClipboardListeners )
1667 		{
1668 			dlg(_textview);
1669 		}
1670 	}
1671 
1672 	void delegate(Widget, TextView)[] onPopulatePopupListeners;
1673 	/**
1674 	 * The ::populate-popup signal gets emitted before showing the
1675 	 * context menu of the text view.
1676 	 *
1677 	 * If you need to add items to the context menu, connect
1678 	 * to this signal and append your items to the @popup, which
1679 	 * will be a #GtkMenu in this case.
1680 	 *
1681 	 * If #GtkTextView:populate-all is %TRUE, this signal will
1682 	 * also be emitted to populate touch popups. In this case,
1683 	 * @popup will be a different container, e.g. a #GtkToolbar.
1684 	 *
1685 	 * The signal handler should not make assumptions about the
1686 	 * type of @widget, but check whether @popup is a #GtkMenu
1687 	 * or #GtkToolbar or another kind of container.
1688 	 *
1689 	 * Params:
1690 	 *     popup = the container that is being populated
1691 	 */
1692 	void addOnPopulatePopup(void delegate(Widget, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1693 	{
1694 		if ( "populate-popup" !in connectedSignals )
1695 		{
1696 			Signals.connectData(
1697 				this,
1698 				"populate-popup",
1699 				cast(GCallback)&callBackPopulatePopup,
1700 				cast(void*)this,
1701 				null,
1702 				connectFlags);
1703 			connectedSignals["populate-popup"] = 1;
1704 		}
1705 		onPopulatePopupListeners ~= dlg;
1706 	}
1707 	extern(C) static void callBackPopulatePopup(GtkTextView* textviewStruct, GtkWidget* popup, TextView _textview)
1708 	{
1709 		foreach ( void delegate(Widget, TextView) dlg; _textview.onPopulatePopupListeners )
1710 		{
1711 			dlg(ObjectG.getDObject!(Widget)(popup), _textview);
1712 		}
1713 	}
1714 
1715 	void delegate(string, TextView)[] onPreeditChangedListeners;
1716 	/**
1717 	 * If an input method is used, the typed text will not immediately
1718 	 * be committed to the buffer. So if you are interested in the text,
1719 	 * connect to this signal.
1720 	 *
1721 	 * This signal is only emitted if the text at the given position
1722 	 * is actually editable.
1723 	 *
1724 	 * Params:
1725 	 *     preedit = the current preedit string
1726 	 *
1727 	 * Since: 2.20
1728 	 */
1729 	void addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1730 	{
1731 		if ( "preedit-changed" !in connectedSignals )
1732 		{
1733 			Signals.connectData(
1734 				this,
1735 				"preedit-changed",
1736 				cast(GCallback)&callBackPreeditChanged,
1737 				cast(void*)this,
1738 				null,
1739 				connectFlags);
1740 			connectedSignals["preedit-changed"] = 1;
1741 		}
1742 		onPreeditChangedListeners ~= dlg;
1743 	}
1744 	extern(C) static void callBackPreeditChanged(GtkTextView* textviewStruct, char* preedit, TextView _textview)
1745 	{
1746 		foreach ( void delegate(string, TextView) dlg; _textview.onPreeditChangedListeners )
1747 		{
1748 			dlg(Str.toString(preedit), _textview);
1749 		}
1750 	}
1751 
1752 	void delegate(bool, TextView)[] onSelectAllListeners;
1753 	/**
1754 	 * The ::select-all signal is a
1755 	 * [keybinding signal][GtkBindingSignal]
1756 	 * which gets emitted to select or unselect the complete
1757 	 * contents of the text view.
1758 	 *
1759 	 * The default bindings for this signal are Ctrl-a and Ctrl-/
1760 	 * for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
1761 	 *
1762 	 * Params:
1763 	 *     select = %TRUE to select, %FALSE to unselect
1764 	 */
1765 	void addOnSelectAll(void delegate(bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1766 	{
1767 		if ( "select-all" !in connectedSignals )
1768 		{
1769 			Signals.connectData(
1770 				this,
1771 				"select-all",
1772 				cast(GCallback)&callBackSelectAll,
1773 				cast(void*)this,
1774 				null,
1775 				connectFlags);
1776 			connectedSignals["select-all"] = 1;
1777 		}
1778 		onSelectAllListeners ~= dlg;
1779 	}
1780 	extern(C) static void callBackSelectAll(GtkTextView* textviewStruct, bool select, TextView _textview)
1781 	{
1782 		foreach ( void delegate(bool, TextView) dlg; _textview.onSelectAllListeners )
1783 		{
1784 			dlg(select, _textview);
1785 		}
1786 	}
1787 
1788 	void delegate(TextView)[] onSetAnchorListeners;
1789 	/**
1790 	 * The ::set-anchor signal is a
1791 	 * [keybinding signal][GtkBindingSignal]
1792 	 * which gets emitted when the user initiates setting the "anchor"
1793 	 * mark. The "anchor" mark gets placed at the same position as the
1794 	 * "insert" mark.
1795 	 *
1796 	 * This signal has no default bindings.
1797 	 */
1798 	void addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1799 	{
1800 		if ( "set-anchor" !in connectedSignals )
1801 		{
1802 			Signals.connectData(
1803 				this,
1804 				"set-anchor",
1805 				cast(GCallback)&callBackSetAnchor,
1806 				cast(void*)this,
1807 				null,
1808 				connectFlags);
1809 			connectedSignals["set-anchor"] = 1;
1810 		}
1811 		onSetAnchorListeners ~= dlg;
1812 	}
1813 	extern(C) static void callBackSetAnchor(GtkTextView* textviewStruct, TextView _textview)
1814 	{
1815 		foreach ( void delegate(TextView) dlg; _textview.onSetAnchorListeners )
1816 		{
1817 			dlg(_textview);
1818 		}
1819 	}
1820 
1821 	void delegate(TextView)[] onToggleCursorVisibleListeners;
1822 	/**
1823 	 * The ::toggle-cursor-visible signal is a
1824 	 * [keybinding signal][GtkBindingSignal]
1825 	 * which gets emitted to toggle the visibility of the cursor.
1826 	 *
1827 	 * The default binding for this signal is F7.
1828 	 */
1829 	void addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1830 	{
1831 		if ( "toggle-cursor-visible" !in connectedSignals )
1832 		{
1833 			Signals.connectData(
1834 				this,
1835 				"toggle-cursor-visible",
1836 				cast(GCallback)&callBackToggleCursorVisible,
1837 				cast(void*)this,
1838 				null,
1839 				connectFlags);
1840 			connectedSignals["toggle-cursor-visible"] = 1;
1841 		}
1842 		onToggleCursorVisibleListeners ~= dlg;
1843 	}
1844 	extern(C) static void callBackToggleCursorVisible(GtkTextView* textviewStruct, TextView _textview)
1845 	{
1846 		foreach ( void delegate(TextView) dlg; _textview.onToggleCursorVisibleListeners )
1847 		{
1848 			dlg(_textview);
1849 		}
1850 	}
1851 
1852 	void delegate(TextView)[] onToggleOverwriteListeners;
1853 	/**
1854 	 * The ::toggle-overwrite signal is a
1855 	 * [keybinding signal][GtkBindingSignal]
1856 	 * which gets emitted to toggle the overwrite mode of the text view.
1857 	 *
1858 	 * The default bindings for this signal is Insert.
1859 	 */
1860 	void addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1861 	{
1862 		if ( "toggle-overwrite" !in connectedSignals )
1863 		{
1864 			Signals.connectData(
1865 				this,
1866 				"toggle-overwrite",
1867 				cast(GCallback)&callBackToggleOverwrite,
1868 				cast(void*)this,
1869 				null,
1870 				connectFlags);
1871 			connectedSignals["toggle-overwrite"] = 1;
1872 		}
1873 		onToggleOverwriteListeners ~= dlg;
1874 	}
1875 	extern(C) static void callBackToggleOverwrite(GtkTextView* textviewStruct, TextView _textview)
1876 	{
1877 		foreach ( void delegate(TextView) dlg; _textview.onToggleOverwriteListeners )
1878 		{
1879 			dlg(_textview);
1880 		}
1881 	}
1882 }