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 should be 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 	 * Adding this function with gtk_text_view_get_pixels_below_lines()
686 	 * is equal to the line space between each paragraph.
687 	 *
688 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	int[string] connectedSignals;
1342 
1343 	void delegate(TextView)[] onBackspaceListeners;
1344 	/**
1345 	 * The ::backspace signal is a
1346 	 * [keybinding signal][GtkBindingSignal]
1347 	 * which gets emitted when the user asks for it.
1348 	 *
1349 	 * The default bindings for this signal are
1350 	 * Backspace and Shift-Backspace.
1351 	 */
1352 	void addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1353 	{
1354 		if ( "backspace" !in connectedSignals )
1355 		{
1356 			Signals.connectData(
1357 				this,
1358 				"backspace",
1359 				cast(GCallback)&callBackBackspace,
1360 				cast(void*)this,
1361 				null,
1362 				connectFlags);
1363 			connectedSignals["backspace"] = 1;
1364 		}
1365 		onBackspaceListeners ~= dlg;
1366 	}
1367 	extern(C) static void callBackBackspace(GtkTextView* textviewStruct, TextView _textview)
1368 	{
1369 		foreach ( void delegate(TextView) dlg; _textview.onBackspaceListeners )
1370 		{
1371 			dlg(_textview);
1372 		}
1373 	}
1374 
1375 	void delegate(TextView)[] onCopyClipboardListeners;
1376 	/**
1377 	 * The ::copy-clipboard signal is a
1378 	 * [keybinding signal][GtkBindingSignal]
1379 	 * which gets emitted to copy the selection to the clipboard.
1380 	 *
1381 	 * The default bindings for this signal are
1382 	 * Ctrl-c and Ctrl-Insert.
1383 	 */
1384 	void addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1385 	{
1386 		if ( "copy-clipboard" !in connectedSignals )
1387 		{
1388 			Signals.connectData(
1389 				this,
1390 				"copy-clipboard",
1391 				cast(GCallback)&callBackCopyClipboard,
1392 				cast(void*)this,
1393 				null,
1394 				connectFlags);
1395 			connectedSignals["copy-clipboard"] = 1;
1396 		}
1397 		onCopyClipboardListeners ~= dlg;
1398 	}
1399 	extern(C) static void callBackCopyClipboard(GtkTextView* textviewStruct, TextView _textview)
1400 	{
1401 		foreach ( void delegate(TextView) dlg; _textview.onCopyClipboardListeners )
1402 		{
1403 			dlg(_textview);
1404 		}
1405 	}
1406 
1407 	void delegate(TextView)[] onCutClipboardListeners;
1408 	/**
1409 	 * The ::cut-clipboard signal is a
1410 	 * [keybinding signal][GtkBindingSignal]
1411 	 * which gets emitted to cut the selection to the clipboard.
1412 	 *
1413 	 * The default bindings for this signal are
1414 	 * Ctrl-x and Shift-Delete.
1415 	 */
1416 	void addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1417 	{
1418 		if ( "cut-clipboard" !in connectedSignals )
1419 		{
1420 			Signals.connectData(
1421 				this,
1422 				"cut-clipboard",
1423 				cast(GCallback)&callBackCutClipboard,
1424 				cast(void*)this,
1425 				null,
1426 				connectFlags);
1427 			connectedSignals["cut-clipboard"] = 1;
1428 		}
1429 		onCutClipboardListeners ~= dlg;
1430 	}
1431 	extern(C) static void callBackCutClipboard(GtkTextView* textviewStruct, TextView _textview)
1432 	{
1433 		foreach ( void delegate(TextView) dlg; _textview.onCutClipboardListeners )
1434 		{
1435 			dlg(_textview);
1436 		}
1437 	}
1438 
1439 	void delegate(GtkDeleteType, int, TextView)[] onDeleteFromCursorListeners;
1440 	/**
1441 	 * The ::delete-from-cursor signal is a
1442 	 * [keybinding signal][GtkBindingSignal]
1443 	 * which gets emitted when the user initiates a text deletion.
1444 	 *
1445 	 * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection
1446 	 * if there is one, otherwise it deletes the requested number
1447 	 * of characters.
1448 	 *
1449 	 * The default bindings for this signal are
1450 	 * Delete for deleting a character, Ctrl-Delete for
1451 	 * deleting a word and Ctrl-Backspace for deleting a word
1452 	 * backwords.
1453 	 *
1454 	 * Params:
1455 	 *     type = the granularity of the deletion, as a #GtkDeleteType
1456 	 *     count = the number of @type units to delete
1457 	 */
1458 	void addOnDeleteFromCursor(void delegate(GtkDeleteType, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1459 	{
1460 		if ( "delete-from-cursor" !in connectedSignals )
1461 		{
1462 			Signals.connectData(
1463 				this,
1464 				"delete-from-cursor",
1465 				cast(GCallback)&callBackDeleteFromCursor,
1466 				cast(void*)this,
1467 				null,
1468 				connectFlags);
1469 			connectedSignals["delete-from-cursor"] = 1;
1470 		}
1471 		onDeleteFromCursorListeners ~= dlg;
1472 	}
1473 	extern(C) static void callBackDeleteFromCursor(GtkTextView* textviewStruct, GtkDeleteType type, int count, TextView _textview)
1474 	{
1475 		foreach ( void delegate(GtkDeleteType, int, TextView) dlg; _textview.onDeleteFromCursorListeners )
1476 		{
1477 			dlg(type, count, _textview);
1478 		}
1479 	}
1480 
1481 	bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView)[] onExtendSelectionListeners;
1482 	/**
1483 	 * The ::extend-selection signal is emitted when the selection needs to be
1484 	 * extended at @location.
1485 	 *
1486 	 * Params:
1487 	 *     granularity = the granularity type
1488 	 *     location = the location where to extend the selection
1489 	 *     start = where the selection should start
1490 	 *     end = where the selection should end
1491 	 *
1492 	 * Return: %GDK_EVENT_STOP to stop other handlers from being invoked for the
1493 	 *     event. %GDK_EVENT_PROPAGATE to propagate the event further.
1494 	 *
1495 	 * Since: 3.16
1496 	 */
1497 	void addOnExtendSelection(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1498 	{
1499 		if ( "extend-selection" !in connectedSignals )
1500 		{
1501 			Signals.connectData(
1502 				this,
1503 				"extend-selection",
1504 				cast(GCallback)&callBackExtendSelection,
1505 				cast(void*)this,
1506 				null,
1507 				connectFlags);
1508 			connectedSignals["extend-selection"] = 1;
1509 		}
1510 		onExtendSelectionListeners ~= dlg;
1511 	}
1512 	extern(C) static int callBackExtendSelection(GtkTextView* textviewStruct, GtkTextExtendSelection granularity, GtkTextIter* location, GtkTextIter* start, GtkTextIter* end, TextView _textview)
1513 	{
1514 		foreach ( bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg; _textview.onExtendSelectionListeners )
1515 		{
1516 			if ( dlg(granularity, ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), _textview) )
1517 			{
1518 				return 1;
1519 			}
1520 		}
1521 		
1522 		return 0;
1523 	}
1524 
1525 	void delegate(string, TextView)[] onInsertAtCursorListeners;
1526 	/**
1527 	 * The ::insert-at-cursor signal is a
1528 	 * [keybinding signal][GtkBindingSignal]
1529 	 * which gets emitted when the user initiates the insertion of a
1530 	 * fixed string at the cursor.
1531 	 *
1532 	 * This signal has no default bindings.
1533 	 *
1534 	 * Params:
1535 	 *     str = the string to insert
1536 	 */
1537 	void addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1538 	{
1539 		if ( "insert-at-cursor" !in connectedSignals )
1540 		{
1541 			Signals.connectData(
1542 				this,
1543 				"insert-at-cursor",
1544 				cast(GCallback)&callBackInsertAtCursor,
1545 				cast(void*)this,
1546 				null,
1547 				connectFlags);
1548 			connectedSignals["insert-at-cursor"] = 1;
1549 		}
1550 		onInsertAtCursorListeners ~= dlg;
1551 	}
1552 	extern(C) static void callBackInsertAtCursor(GtkTextView* textviewStruct, char* str, TextView _textview)
1553 	{
1554 		foreach ( void delegate(string, TextView) dlg; _textview.onInsertAtCursorListeners )
1555 		{
1556 			dlg(Str.toString(str), _textview);
1557 		}
1558 	}
1559 
1560 	void delegate(GtkMovementStep, int, bool, TextView)[] onMoveCursorListeners;
1561 	/**
1562 	 * The ::move-cursor signal is a
1563 	 * [keybinding signal][GtkBindingSignal]
1564 	 * which gets emitted when the user initiates a cursor movement.
1565 	 * If the cursor is not visible in @text_view, this signal causes
1566 	 * the viewport to be moved instead.
1567 	 *
1568 	 * Applications should not connect to it, but may emit it with
1569 	 * g_signal_emit_by_name() if they need to control the cursor
1570 	 * programmatically.
1571 	 *
1572 	 * The default bindings for this signal come in two variants,
1573 	 * the variant with the Shift modifier extends the selection,
1574 	 * the variant without the Shift modifer does not.
1575 	 * There are too many key combinations to list them all here.
1576 	 * - Arrow keys move by individual characters/lines
1577 	 * - Ctrl-arrow key combinations move by words/paragraphs
1578 	 * - Home/End keys move to the ends of the buffer
1579 	 * - PageUp/PageDown keys move vertically by pages
1580 	 * - Ctrl-PageUp/PageDown keys move horizontally by pages
1581 	 *
1582 	 * Params:
1583 	 *     step = the granularity of the move, as a #GtkMovementStep
1584 	 *     count = the number of @step units to move
1585 	 *     extendSelection = %TRUE if the move should extend the selection
1586 	 */
1587 	void addOnMoveCursor(void delegate(GtkMovementStep, int, bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1588 	{
1589 		if ( "move-cursor" !in connectedSignals )
1590 		{
1591 			Signals.connectData(
1592 				this,
1593 				"move-cursor",
1594 				cast(GCallback)&callBackMoveCursor,
1595 				cast(void*)this,
1596 				null,
1597 				connectFlags);
1598 			connectedSignals["move-cursor"] = 1;
1599 		}
1600 		onMoveCursorListeners ~= dlg;
1601 	}
1602 	extern(C) static void callBackMoveCursor(GtkTextView* textviewStruct, GtkMovementStep step, int count, bool extendSelection, TextView _textview)
1603 	{
1604 		foreach ( void delegate(GtkMovementStep, int, bool, TextView) dlg; _textview.onMoveCursorListeners )
1605 		{
1606 			dlg(step, count, extendSelection, _textview);
1607 		}
1608 	}
1609 
1610 	void delegate(GtkScrollStep, int, TextView)[] onMoveViewportListeners;
1611 	/**
1612 	 * The ::move-viewport signal is a
1613 	 * [keybinding signal][GtkBindingSignal]
1614 	 * which can be bound to key combinations to allow the user
1615 	 * to move the viewport, i.e. change what part of the text view
1616 	 * is visible in a containing scrolled window.
1617 	 *
1618 	 * There are no default bindings for this signal.
1619 	 *
1620 	 * Params:
1621 	 *     step = the granularity of the movement, as a #GtkScrollStep
1622 	 *     count = the number of @step units to move
1623 	 */
1624 	void addOnMoveViewport(void delegate(GtkScrollStep, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1625 	{
1626 		if ( "move-viewport" !in connectedSignals )
1627 		{
1628 			Signals.connectData(
1629 				this,
1630 				"move-viewport",
1631 				cast(GCallback)&callBackMoveViewport,
1632 				cast(void*)this,
1633 				null,
1634 				connectFlags);
1635 			connectedSignals["move-viewport"] = 1;
1636 		}
1637 		onMoveViewportListeners ~= dlg;
1638 	}
1639 	extern(C) static void callBackMoveViewport(GtkTextView* textviewStruct, GtkScrollStep step, int count, TextView _textview)
1640 	{
1641 		foreach ( void delegate(GtkScrollStep, int, TextView) dlg; _textview.onMoveViewportListeners )
1642 		{
1643 			dlg(step, count, _textview);
1644 		}
1645 	}
1646 
1647 	void delegate(TextView)[] onPasteClipboardListeners;
1648 	/**
1649 	 * The ::paste-clipboard signal is a
1650 	 * [keybinding signal][GtkBindingSignal]
1651 	 * which gets emitted to paste the contents of the clipboard
1652 	 * into the text view.
1653 	 *
1654 	 * The default bindings for this signal are
1655 	 * Ctrl-v and Shift-Insert.
1656 	 */
1657 	void addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1658 	{
1659 		if ( "paste-clipboard" !in connectedSignals )
1660 		{
1661 			Signals.connectData(
1662 				this,
1663 				"paste-clipboard",
1664 				cast(GCallback)&callBackPasteClipboard,
1665 				cast(void*)this,
1666 				null,
1667 				connectFlags);
1668 			connectedSignals["paste-clipboard"] = 1;
1669 		}
1670 		onPasteClipboardListeners ~= dlg;
1671 	}
1672 	extern(C) static void callBackPasteClipboard(GtkTextView* textviewStruct, TextView _textview)
1673 	{
1674 		foreach ( void delegate(TextView) dlg; _textview.onPasteClipboardListeners )
1675 		{
1676 			dlg(_textview);
1677 		}
1678 	}
1679 
1680 	void delegate(Widget, TextView)[] onPopulatePopupListeners;
1681 	/**
1682 	 * The ::populate-popup signal gets emitted before showing the
1683 	 * context menu of the text view.
1684 	 *
1685 	 * If you need to add items to the context menu, connect
1686 	 * to this signal and append your items to the @popup, which
1687 	 * will be a #GtkMenu in this case.
1688 	 *
1689 	 * If #GtkTextView:populate-all is %TRUE, this signal will
1690 	 * also be emitted to populate touch popups. In this case,
1691 	 * @popup will be a different container, e.g. a #GtkToolbar.
1692 	 *
1693 	 * The signal handler should not make assumptions about the
1694 	 * type of @widget, but check whether @popup is a #GtkMenu
1695 	 * or #GtkToolbar or another kind of container.
1696 	 *
1697 	 * Params:
1698 	 *     popup = the container that is being populated
1699 	 */
1700 	void addOnPopulatePopup(void delegate(Widget, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1701 	{
1702 		if ( "populate-popup" !in connectedSignals )
1703 		{
1704 			Signals.connectData(
1705 				this,
1706 				"populate-popup",
1707 				cast(GCallback)&callBackPopulatePopup,
1708 				cast(void*)this,
1709 				null,
1710 				connectFlags);
1711 			connectedSignals["populate-popup"] = 1;
1712 		}
1713 		onPopulatePopupListeners ~= dlg;
1714 	}
1715 	extern(C) static void callBackPopulatePopup(GtkTextView* textviewStruct, GtkWidget* popup, TextView _textview)
1716 	{
1717 		foreach ( void delegate(Widget, TextView) dlg; _textview.onPopulatePopupListeners )
1718 		{
1719 			dlg(ObjectG.getDObject!(Widget)(popup), _textview);
1720 		}
1721 	}
1722 
1723 	void delegate(string, TextView)[] onPreeditChangedListeners;
1724 	/**
1725 	 * If an input method is used, the typed text will not immediately
1726 	 * be committed to the buffer. So if you are interested in the text,
1727 	 * connect to this signal.
1728 	 *
1729 	 * This signal is only emitted if the text at the given position
1730 	 * is actually editable.
1731 	 *
1732 	 * Params:
1733 	 *     preedit = the current preedit string
1734 	 *
1735 	 * Since: 2.20
1736 	 */
1737 	void addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1738 	{
1739 		if ( "preedit-changed" !in connectedSignals )
1740 		{
1741 			Signals.connectData(
1742 				this,
1743 				"preedit-changed",
1744 				cast(GCallback)&callBackPreeditChanged,
1745 				cast(void*)this,
1746 				null,
1747 				connectFlags);
1748 			connectedSignals["preedit-changed"] = 1;
1749 		}
1750 		onPreeditChangedListeners ~= dlg;
1751 	}
1752 	extern(C) static void callBackPreeditChanged(GtkTextView* textviewStruct, char* preedit, TextView _textview)
1753 	{
1754 		foreach ( void delegate(string, TextView) dlg; _textview.onPreeditChangedListeners )
1755 		{
1756 			dlg(Str.toString(preedit), _textview);
1757 		}
1758 	}
1759 
1760 	void delegate(bool, TextView)[] onSelectAllListeners;
1761 	/**
1762 	 * The ::select-all signal is a
1763 	 * [keybinding signal][GtkBindingSignal]
1764 	 * which gets emitted to select or unselect the complete
1765 	 * contents of the text view.
1766 	 *
1767 	 * The default bindings for this signal are Ctrl-a and Ctrl-/
1768 	 * for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
1769 	 *
1770 	 * Params:
1771 	 *     select = %TRUE to select, %FALSE to unselect
1772 	 */
1773 	void addOnSelectAll(void delegate(bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1774 	{
1775 		if ( "select-all" !in connectedSignals )
1776 		{
1777 			Signals.connectData(
1778 				this,
1779 				"select-all",
1780 				cast(GCallback)&callBackSelectAll,
1781 				cast(void*)this,
1782 				null,
1783 				connectFlags);
1784 			connectedSignals["select-all"] = 1;
1785 		}
1786 		onSelectAllListeners ~= dlg;
1787 	}
1788 	extern(C) static void callBackSelectAll(GtkTextView* textviewStruct, bool select, TextView _textview)
1789 	{
1790 		foreach ( void delegate(bool, TextView) dlg; _textview.onSelectAllListeners )
1791 		{
1792 			dlg(select, _textview);
1793 		}
1794 	}
1795 
1796 	void delegate(TextView)[] onSetAnchorListeners;
1797 	/**
1798 	 * The ::set-anchor signal is a
1799 	 * [keybinding signal][GtkBindingSignal]
1800 	 * which gets emitted when the user initiates setting the "anchor"
1801 	 * mark. The "anchor" mark gets placed at the same position as the
1802 	 * "insert" mark.
1803 	 *
1804 	 * This signal has no default bindings.
1805 	 */
1806 	void addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1807 	{
1808 		if ( "set-anchor" !in connectedSignals )
1809 		{
1810 			Signals.connectData(
1811 				this,
1812 				"set-anchor",
1813 				cast(GCallback)&callBackSetAnchor,
1814 				cast(void*)this,
1815 				null,
1816 				connectFlags);
1817 			connectedSignals["set-anchor"] = 1;
1818 		}
1819 		onSetAnchorListeners ~= dlg;
1820 	}
1821 	extern(C) static void callBackSetAnchor(GtkTextView* textviewStruct, TextView _textview)
1822 	{
1823 		foreach ( void delegate(TextView) dlg; _textview.onSetAnchorListeners )
1824 		{
1825 			dlg(_textview);
1826 		}
1827 	}
1828 
1829 	void delegate(TextView)[] onToggleCursorVisibleListeners;
1830 	/**
1831 	 * The ::toggle-cursor-visible signal is a
1832 	 * [keybinding signal][GtkBindingSignal]
1833 	 * which gets emitted to toggle the #GtkTextView:cursor-visible
1834 	 * property.
1835 	 *
1836 	 * The default binding for this signal is F7.
1837 	 */
1838 	void addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1839 	{
1840 		if ( "toggle-cursor-visible" !in connectedSignals )
1841 		{
1842 			Signals.connectData(
1843 				this,
1844 				"toggle-cursor-visible",
1845 				cast(GCallback)&callBackToggleCursorVisible,
1846 				cast(void*)this,
1847 				null,
1848 				connectFlags);
1849 			connectedSignals["toggle-cursor-visible"] = 1;
1850 		}
1851 		onToggleCursorVisibleListeners ~= dlg;
1852 	}
1853 	extern(C) static void callBackToggleCursorVisible(GtkTextView* textviewStruct, TextView _textview)
1854 	{
1855 		foreach ( void delegate(TextView) dlg; _textview.onToggleCursorVisibleListeners )
1856 		{
1857 			dlg(_textview);
1858 		}
1859 	}
1860 
1861 	void delegate(TextView)[] onToggleOverwriteListeners;
1862 	/**
1863 	 * The ::toggle-overwrite signal is a
1864 	 * [keybinding signal][GtkBindingSignal]
1865 	 * which gets emitted to toggle the overwrite mode of the text view.
1866 	 *
1867 	 * The default bindings for this signal is Insert.
1868 	 */
1869 	void addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1870 	{
1871 		if ( "toggle-overwrite" !in connectedSignals )
1872 		{
1873 			Signals.connectData(
1874 				this,
1875 				"toggle-overwrite",
1876 				cast(GCallback)&callBackToggleOverwrite,
1877 				cast(void*)this,
1878 				null,
1879 				connectFlags);
1880 			connectedSignals["toggle-overwrite"] = 1;
1881 		}
1882 		onToggleOverwriteListeners ~= dlg;
1883 	}
1884 	extern(C) static void callBackToggleOverwrite(GtkTextView* textviewStruct, TextView _textview)
1885 	{
1886 		foreach ( void delegate(TextView) dlg; _textview.onToggleOverwriteListeners )
1887 		{
1888 			dlg(_textview);
1889 		}
1890 	}
1891 }