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