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 gsv.SourceView;
26 
27 private import gdk.Event;
28 private import glib.ConstructionException;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gsv.SourceBuffer;
33 private import gsv.SourceCompletion;
34 private import gsv.SourceGutter;
35 private import gsv.SourceMarkAttributes;
36 private import gsvc.gsv;
37 public  import gsvc.gsvtypes;
38 private import gtk.BuildableIF;
39 private import gtk.BuildableT;
40 private import gtk.ScrollableIF;
41 private import gtk.ScrollableT;
42 private import gtk.TextIter;
43 private import gtk.TextView;
44 private import gtk.Widget;
45 public  import gtkc.gdktypes;
46 
47 
48 public class SourceView : TextView
49 {
50 	/** the main Gtk struct */
51 	protected GtkSourceView* gtkSourceView;
52 
53 	/** Get the main Gtk struct */
54 	public GtkSourceView* getSourceViewStruct()
55 	{
56 		return gtkSourceView;
57 	}
58 
59 	/** the main Gtk struct as a void* */
60 	protected override void* getStruct()
61 	{
62 		return cast(void*)gtkSourceView;
63 	}
64 
65 	protected override void setStruct(GObject* obj)
66 	{
67 		gtkSourceView = cast(GtkSourceView*)obj;
68 		super.setStruct(obj);
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GtkSourceView* gtkSourceView, bool ownedRef = false)
75 	{
76 		this.gtkSourceView = gtkSourceView;
77 		super(cast(GtkTextView*)gtkSourceView, ownedRef);
78 	}
79 
80 	/**
81 	 * Returns the GtkSourceBuffer being displayed by this source view.
82 	 * The reference count on the buffer is not incremented; the caller
83 	 * of this function won't own a new reference.
84 	 *
85 	 * Returns:
86 	 *  a GtkSourceBuffer
87 	 */
88 	public override SourceBuffer getBuffer()
89 	{
90 		auto p = gtk_text_view_get_buffer(cast(GtkTextView*)gtkSourceView);
91 		
92 		return ObjectG.getDObject!(SourceBuffer)(cast(GtkSourceBuffer*) p);
93 	}
94 
95 	/**
96 	 */
97 
98 	public static GType getType()
99 	{
100 		return gtk_source_view_get_type();
101 	}
102 
103 	/**
104 	 * Creates a new #GtkSourceView. An empty default buffer will be
105 	 * created for you. If you want to specify your own buffer, consider
106 	 * gtk_source_view_new_with_buffer().
107 	 *
108 	 * Return: a new #GtkSourceView.
109 	 *
110 	 * Throws: ConstructionException GTK+ fails to create the object.
111 	 */
112 	public this()
113 	{
114 		auto p = gtk_source_view_new();
115 		
116 		if(p is null)
117 		{
118 			throw new ConstructionException("null returned by new");
119 		}
120 		
121 		this(cast(GtkSourceView*) p);
122 	}
123 
124 	/**
125 	 * Creates a new #GtkSourceView widget displaying the buffer
126 	 * @buffer. One buffer can be shared among many widgets.
127 	 *
128 	 * Params:
129 	 *     buffer = a #GtkSourceBuffer.
130 	 *
131 	 * Return: a new #GtkSourceView.
132 	 *
133 	 * Throws: ConstructionException GTK+ fails to create the object.
134 	 */
135 	public this(SourceBuffer buffer)
136 	{
137 		auto p = gtk_source_view_new_with_buffer((buffer is null) ? null : buffer.getSourceBufferStruct());
138 		
139 		if(p is null)
140 		{
141 			throw new ConstructionException("null returned by new_with_buffer");
142 		}
143 		
144 		this(cast(GtkSourceView*) p);
145 	}
146 
147 	/**
148 	 * Returns whether auto indentation of text is enabled.
149 	 *
150 	 * Return: %TRUE if auto indentation is enabled.
151 	 */
152 	public bool getAutoIndent()
153 	{
154 		return gtk_source_view_get_auto_indent(gtkSourceView) != 0;
155 	}
156 
157 	/**
158 	 * Gets the #GtkSourceCompletion associated with @view.
159 	 *
160 	 * Return: the #GtkSourceCompletion associated with @view.
161 	 */
162 	public SourceCompletion getCompletion()
163 	{
164 		auto p = gtk_source_view_get_completion(gtkSourceView);
165 		
166 		if(p is null)
167 		{
168 			return null;
169 		}
170 		
171 		return ObjectG.getDObject!(SourceCompletion)(cast(GtkSourceCompletion*) p);
172 	}
173 
174 	/**
175 	 * Returns the #GtkSourceDrawSpacesFlags specifying if and how spaces
176 	 * should be displayed for this @view.
177 	 *
178 	 * Return: the #GtkSourceDrawSpacesFlags, 0 if no spaces should be drawn.
179 	 */
180 	public GtkSourceDrawSpacesFlags getDrawSpaces()
181 	{
182 		return gtk_source_view_get_draw_spaces(gtkSourceView);
183 	}
184 
185 	/**
186 	 * Returns the #GtkSourceGutter object associated with @window_type for @view.
187 	 * Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported,
188 	 * respectively corresponding to the left and right gutter. The line numbers
189 	 * and mark category icons are rendered in the left gutter.
190 	 *
191 	 * Params:
192 	 *     windowType = the gutter window type.
193 	 *
194 	 * Return: the #GtkSourceGutter.
195 	 *
196 	 * Since: 2.8
197 	 */
198 	public SourceGutter getGutter(GtkTextWindowType windowType)
199 	{
200 		auto p = gtk_source_view_get_gutter(gtkSourceView, windowType);
201 		
202 		if(p is null)
203 		{
204 			return null;
205 		}
206 		
207 		return ObjectG.getDObject!(SourceGutter)(cast(GtkSourceGutter*) p);
208 	}
209 
210 	/**
211 	 * Returns whether the current line is highlighted.
212 	 *
213 	 * Return: %TRUE if the current line is highlighted.
214 	 */
215 	public bool getHighlightCurrentLine()
216 	{
217 		return gtk_source_view_get_highlight_current_line(gtkSourceView) != 0;
218 	}
219 
220 	/**
221 	 * Returns whether when the tab key is pressed the current selection
222 	 * should get indented instead of replaced with the \t character.
223 	 *
224 	 * Return: %TRUE if the selection is indented when tab is pressed.
225 	 *
226 	 * Since: 1.8
227 	 */
228 	public bool getIndentOnTab()
229 	{
230 		return gtk_source_view_get_indent_on_tab(gtkSourceView) != 0;
231 	}
232 
233 	/**
234 	 * Returns the number of spaces to use for each step of indent.
235 	 * See gtk_source_view_set_indent_width() for details.
236 	 *
237 	 * Return: indent width.
238 	 */
239 	public int getIndentWidth()
240 	{
241 		return gtk_source_view_get_indent_width(gtkSourceView);
242 	}
243 
244 	/**
245 	 * Returns whether when inserting a tabulator character it should
246 	 * be replaced by a group of space characters.
247 	 *
248 	 * Return: %TRUE if spaces are inserted instead of tabs.
249 	 */
250 	public bool getInsertSpacesInsteadOfTabs()
251 	{
252 		return gtk_source_view_get_insert_spaces_instead_of_tabs(gtkSourceView) != 0;
253 	}
254 
255 	/**
256 	 * Gets attributes and priority for the @category.
257 	 *
258 	 * Params:
259 	 *     category = the category.
260 	 *     priority = place where priority of the category will be stored.
261 	 *
262 	 * Return: #GtkSourceMarkAttributes for the @category.
263 	 *     The object belongs to @view, so it must not be unreffed.
264 	 */
265 	public SourceMarkAttributes getMarkAttributes(string category, int* priority)
266 	{
267 		auto p = gtk_source_view_get_mark_attributes(gtkSourceView, Str.toStringz(category), priority);
268 		
269 		if(p is null)
270 		{
271 			return null;
272 		}
273 		
274 		return ObjectG.getDObject!(SourceMarkAttributes)(cast(GtkSourceMarkAttributes*) p);
275 	}
276 
277 	/**
278 	 * Gets the position of the right margin in the given @view.
279 	 *
280 	 * Return: the position of the right margin.
281 	 */
282 	public uint getRightMarginPosition()
283 	{
284 		return gtk_source_view_get_right_margin_position(gtkSourceView);
285 	}
286 
287 	/**
288 	 * Returns whether line marks are displayed beside the text.
289 	 *
290 	 * Return: %TRUE if the line marks are displayed.
291 	 *
292 	 * Since: 2.2
293 	 */
294 	public bool getShowLineMarks()
295 	{
296 		return gtk_source_view_get_show_line_marks(gtkSourceView) != 0;
297 	}
298 
299 	/**
300 	 * Returns whether line numbers are displayed beside the text.
301 	 *
302 	 * Return: %TRUE if the line numbers are displayed.
303 	 */
304 	public bool getShowLineNumbers()
305 	{
306 		return gtk_source_view_get_show_line_numbers(gtkSourceView) != 0;
307 	}
308 
309 	/**
310 	 * Returns whether a right margin is displayed.
311 	 *
312 	 * Return: %TRUE if the right margin is shown.
313 	 */
314 	public bool getShowRightMargin()
315 	{
316 		return gtk_source_view_get_show_right_margin(gtkSourceView) != 0;
317 	}
318 
319 	/**
320 	 * Returns a #GtkSourceSmartHomeEndType end value specifying
321 	 * how the cursor will move when HOME and END keys are pressed.
322 	 *
323 	 * Return: a #GtkSourceSmartHomeEndType value.
324 	 */
325 	public GtkSourceSmartHomeEndType getSmartHomeEnd()
326 	{
327 		return gtk_source_view_get_smart_home_end(gtkSourceView);
328 	}
329 
330 	/**
331 	 * Returns the width of tabulation in characters.
332 	 *
333 	 * Return: width of tab.
334 	 */
335 	public uint getTabWidth()
336 	{
337 		return gtk_source_view_get_tab_width(gtkSourceView);
338 	}
339 
340 	/**
341 	 * Determines the visual column at @iter taking into
342 	 * consideration the indent width of @view.
343 	 *
344 	 * Params:
345 	 *     iter = a position in @view.
346 	 *
347 	 * Return: the visual column at @iter.
348 	 */
349 	public uint getVisualColumn(TextIter iter)
350 	{
351 		return gtk_source_view_get_visual_column(gtkSourceView, (iter is null) ? null : iter.getTextIterStruct());
352 	}
353 
354 	/**
355 	 * If %TRUE auto indentation of text is enabled.
356 	 *
357 	 * Params:
358 	 *     enable = whether to enable auto indentation.
359 	 */
360 	public void setAutoIndent(bool enable)
361 	{
362 		gtk_source_view_set_auto_indent(gtkSourceView, enable);
363 	}
364 
365 	/**
366 	 * Set if and how the spaces should be visualized. Specifying @flags as 0 will
367 	 * disable display of spaces.
368 	 *
369 	 * Params:
370 	 *     flags = #GtkSourceDrawSpacesFlags specifing how white spaces should
371 	 *         be displayed
372 	 */
373 	public void setDrawSpaces(GtkSourceDrawSpacesFlags flags)
374 	{
375 		gtk_source_view_set_draw_spaces(gtkSourceView, flags);
376 	}
377 
378 	/**
379 	 * If @hl is %TRUE the current line is highlighted.
380 	 *
381 	 * Params:
382 	 *     hl = whether to highlight the current line.
383 	 */
384 	public void setHighlightCurrentLine(bool hl)
385 	{
386 		gtk_source_view_set_highlight_current_line(gtkSourceView, hl);
387 	}
388 
389 	/**
390 	 * If %TRUE, when the tab key is pressed and there is a selection, the
391 	 * selected text is indented of one level instead of being replaced with
392 	 * the \t characters. Shift+Tab unindents the selection.
393 	 *
394 	 * Params:
395 	 *     enable = whether to indent a block when tab is pressed.
396 	 *
397 	 * Since: 1.8
398 	 */
399 	public void setIndentOnTab(bool enable)
400 	{
401 		gtk_source_view_set_indent_on_tab(gtkSourceView, enable);
402 	}
403 
404 	/**
405 	 * Sets the number of spaces to use for each step of indent.
406 	 * If @width is -1, the value of the #GtkSourceView:tab-width property
407 	 * will be used.
408 	 *
409 	 * Params:
410 	 *     width = indent width in characters.
411 	 */
412 	public void setIndentWidth(int width)
413 	{
414 		gtk_source_view_set_indent_width(gtkSourceView, width);
415 	}
416 
417 	/**
418 	 * If %TRUE any tabulator character inserted is replaced by a group
419 	 * of space characters.
420 	 *
421 	 * Params:
422 	 *     enable = whether to insert spaces instead of tabs.
423 	 */
424 	public void setInsertSpacesInsteadOfTabs(bool enable)
425 	{
426 		gtk_source_view_set_insert_spaces_instead_of_tabs(gtkSourceView, enable);
427 	}
428 
429 	/**
430 	 * Sets attributes and priority for the @category.
431 	 *
432 	 * Params:
433 	 *     category = the category.
434 	 *     attributes = mark attributes.
435 	 *     priority = priority of the category.
436 	 */
437 	public void setMarkAttributes(string category, SourceMarkAttributes attributes, int priority)
438 	{
439 		gtk_source_view_set_mark_attributes(gtkSourceView, Str.toStringz(category), (attributes is null) ? null : attributes.getSourceMarkAttributesStruct(), priority);
440 	}
441 
442 	/**
443 	 * Sets the position of the right margin in the given @view.
444 	 *
445 	 * Params:
446 	 *     pos = the width in characters where to position the right margin.
447 	 */
448 	public void setRightMarginPosition(uint pos)
449 	{
450 		gtk_source_view_set_right_margin_position(gtkSourceView, pos);
451 	}
452 
453 	/**
454 	 * If %TRUE line marks will be displayed beside the text.
455 	 *
456 	 * Params:
457 	 *     show = whether line marks should be displayed.
458 	 *
459 	 * Since: 2.2
460 	 */
461 	public void setShowLineMarks(bool show)
462 	{
463 		gtk_source_view_set_show_line_marks(gtkSourceView, show);
464 	}
465 
466 	/**
467 	 * If %TRUE line numbers will be displayed beside the text.
468 	 *
469 	 * Params:
470 	 *     show = whether line numbers should be displayed.
471 	 */
472 	public void setShowLineNumbers(bool show)
473 	{
474 		gtk_source_view_set_show_line_numbers(gtkSourceView, show);
475 	}
476 
477 	/**
478 	 * If %TRUE a right margin is displayed.
479 	 *
480 	 * Params:
481 	 *     show = whether to show a right margin.
482 	 */
483 	public void setShowRightMargin(bool show)
484 	{
485 		gtk_source_view_set_show_right_margin(gtkSourceView, show);
486 	}
487 
488 	/**
489 	 * Set the desired movement of the cursor when HOME and END keys
490 	 * are pressed.
491 	 *
492 	 * Params:
493 	 *     smartHe = the desired behavior among #GtkSourceSmartHomeEndType.
494 	 */
495 	public void setSmartHomeEnd(GtkSourceSmartHomeEndType smartHe)
496 	{
497 		gtk_source_view_set_smart_home_end(gtkSourceView, smartHe);
498 	}
499 
500 	/**
501 	 * Sets the width of tabulation in characters.
502 	 *
503 	 * Params:
504 	 *     width = width of tab in characters.
505 	 */
506 	public void setTabWidth(uint width)
507 	{
508 		gtk_source_view_set_tab_width(gtkSourceView, width);
509 	}
510 
511 	int[string] connectedSignals;
512 
513 	void delegate(TextIter, Event, SourceView)[] onLineMarkActivatedListeners;
514 	/**
515 	 * Emitted when a line mark has been activated (for instance when there
516 	 * was a button press in the line marks gutter). You can use @iter to
517 	 * determine on which line the activation took place.
518 	 *
519 	 * Params:
520 	 *     iter = a #GtkTextIter
521 	 *     event = the #GdkEvent that activated the event
522 	 */
523 	void addOnLineMarkActivated(void delegate(TextIter, Event, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
524 	{
525 		if ( "line-mark-activated" !in connectedSignals )
526 		{
527 			Signals.connectData(
528 				this,
529 				"line-mark-activated",
530 				cast(GCallback)&callBackLineMarkActivated,
531 				cast(void*)this,
532 				null,
533 				connectFlags);
534 			connectedSignals["line-mark-activated"] = 1;
535 		}
536 		onLineMarkActivatedListeners ~= dlg;
537 	}
538 	extern(C) static void callBackLineMarkActivated(GtkSourceView* sourceviewStruct, GtkTextIter* iter, GdkEvent* event, SourceView _sourceview)
539 	{
540 		foreach ( void delegate(TextIter, Event, SourceView) dlg; _sourceview.onLineMarkActivatedListeners )
541 		{
542 			dlg(ObjectG.getDObject!(TextIter)(iter), ObjectG.getDObject!(Event)(event), _sourceview);
543 		}
544 	}
545 
546 	void delegate(bool, int, SourceView)[] onMoveLinesListeners;
547 	/**
548 	 * The ::move-lines signal is a keybinding which gets emitted
549 	 * when the user initiates moving a line. The default binding key
550 	 * is Alt+Up/Down arrow. And moves the currently selected lines,
551 	 * or the current line by @count. For the moment, only
552 	 * @count of -1 or 1 is valid.
553 	 *
554 	 * Params:
555 	 *     copy = %TRUE if the line should be copied,
556 	 *         %FALSE if it should be moved
557 	 *     count = the number of lines to move over.
558 	 *
559 	 * Since: 2.10
560 	 */
561 	void addOnMoveLines(void delegate(bool, int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
562 	{
563 		if ( "move-lines" !in connectedSignals )
564 		{
565 			Signals.connectData(
566 				this,
567 				"move-lines",
568 				cast(GCallback)&callBackMoveLines,
569 				cast(void*)this,
570 				null,
571 				connectFlags);
572 			connectedSignals["move-lines"] = 1;
573 		}
574 		onMoveLinesListeners ~= dlg;
575 	}
576 	extern(C) static void callBackMoveLines(GtkSourceView* sourceviewStruct, bool copy, int count, SourceView _sourceview)
577 	{
578 		foreach ( void delegate(bool, int, SourceView) dlg; _sourceview.onMoveLinesListeners )
579 		{
580 			dlg(copy, count, _sourceview);
581 		}
582 	}
583 
584 	void delegate(int, SourceView)[] onMoveWordsListeners;
585 	/**
586 	 * The ::move-words signal is a keybinding which gets emitted
587 	 * when the user initiates moving a word. The default binding key
588 	 * is Alt+Left/Right Arrow and moves the current selection, or the current
589 	 * word by one word.
590 	 *
591 	 * Params:
592 	 *     count = the number of words to move over
593 	 *
594 	 * Since: 3.0
595 	 */
596 	void addOnMoveWords(void delegate(int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
597 	{
598 		if ( "move-words" !in connectedSignals )
599 		{
600 			Signals.connectData(
601 				this,
602 				"move-words",
603 				cast(GCallback)&callBackMoveWords,
604 				cast(void*)this,
605 				null,
606 				connectFlags);
607 			connectedSignals["move-words"] = 1;
608 		}
609 		onMoveWordsListeners ~= dlg;
610 	}
611 	extern(C) static void callBackMoveWords(GtkSourceView* sourceviewStruct, int count, SourceView _sourceview)
612 	{
613 		foreach ( void delegate(int, SourceView) dlg; _sourceview.onMoveWordsListeners )
614 		{
615 			dlg(count, _sourceview);
616 		}
617 	}
618 
619 	void delegate(SourceView)[] onRedoListeners;
620 	void addOnRedo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
621 	{
622 		if ( "redo" !in connectedSignals )
623 		{
624 			Signals.connectData(
625 				this,
626 				"redo",
627 				cast(GCallback)&callBackRedo,
628 				cast(void*)this,
629 				null,
630 				connectFlags);
631 			connectedSignals["redo"] = 1;
632 		}
633 		onRedoListeners ~= dlg;
634 	}
635 	extern(C) static void callBackRedo(GtkSourceView* sourceviewStruct, SourceView _sourceview)
636 	{
637 		foreach ( void delegate(SourceView) dlg; _sourceview.onRedoListeners )
638 		{
639 			dlg(_sourceview);
640 		}
641 	}
642 
643 	void delegate(SourceView)[] onShowCompletionListeners;
644 	/**
645 	 * The ::show-completion signal is a key binding signal which gets
646 	 * emitted when the user requests a completion, by pressing
647 	 * <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>.
648 	 *
649 	 * This will create a #GtkSourceCompletionContext with the activation
650 	 * type as %GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED.
651 	 *
652 	 * Applications should not connect to it, but may emit it with
653 	 * g_signal_emit_by_name() if they need to activate the completion by
654 	 * another means, for example with another key binding or a menu entry.
655 	 */
656 	void addOnShowCompletion(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
657 	{
658 		if ( "show-completion" !in connectedSignals )
659 		{
660 			Signals.connectData(
661 				this,
662 				"show-completion",
663 				cast(GCallback)&callBackShowCompletion,
664 				cast(void*)this,
665 				null,
666 				connectFlags);
667 			connectedSignals["show-completion"] = 1;
668 		}
669 		onShowCompletionListeners ~= dlg;
670 	}
671 	extern(C) static void callBackShowCompletion(GtkSourceView* sourceviewStruct, SourceView _sourceview)
672 	{
673 		foreach ( void delegate(SourceView) dlg; _sourceview.onShowCompletionListeners )
674 		{
675 			dlg(_sourceview);
676 		}
677 	}
678 
679 	void delegate(TextIter, int, SourceView)[] onSmartHomeEndListeners;
680 	/**
681 	 * Emitted when a the cursor was moved according to the smart home
682 	 * end setting. The signal is emitted after the cursor is moved, but
683 	 * during the GtkTextView::move-cursor action. This can be used to find
684 	 * out whether the cursor was moved by a normal home/end or by a smart
685 	 * home/end.
686 	 *
687 	 * Params:
688 	 *     iter = a #GtkTextIter
689 	 *     count = the count
690 	 *
691 	 * Since: 3.0
692 	 */
693 	void addOnSmartHomeEnd(void delegate(TextIter, int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
694 	{
695 		if ( "smart-home-end" !in connectedSignals )
696 		{
697 			Signals.connectData(
698 				this,
699 				"smart-home-end",
700 				cast(GCallback)&callBackSmartHomeEnd,
701 				cast(void*)this,
702 				null,
703 				connectFlags);
704 			connectedSignals["smart-home-end"] = 1;
705 		}
706 		onSmartHomeEndListeners ~= dlg;
707 	}
708 	extern(C) static void callBackSmartHomeEnd(GtkSourceView* sourceviewStruct, GtkTextIter* iter, int count, SourceView _sourceview)
709 	{
710 		foreach ( void delegate(TextIter, int, SourceView) dlg; _sourceview.onSmartHomeEndListeners )
711 		{
712 			dlg(ObjectG.getDObject!(TextIter)(iter), count, _sourceview);
713 		}
714 	}
715 
716 	void delegate(SourceView)[] onUndoListeners;
717 	void addOnUndo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
718 	{
719 		if ( "undo" !in connectedSignals )
720 		{
721 			Signals.connectData(
722 				this,
723 				"undo",
724 				cast(GCallback)&callBackUndo,
725 				cast(void*)this,
726 				null,
727 				connectFlags);
728 			connectedSignals["undo"] = 1;
729 		}
730 		onUndoListeners ~= dlg;
731 	}
732 	extern(C) static void callBackUndo(GtkSourceView* sourceviewStruct, SourceView _sourceview)
733 	{
734 		foreach ( void delegate(SourceView) dlg; _sourceview.onUndoListeners )
735 		{
736 			dlg(_sourceview);
737 		}
738 	}
739 }