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