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