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.SourceBuffer;
26 
27 private import glib.ConstructionException;
28 private import glib.ListSG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gsv.SourceLanguage;
33 private import gsv.SourceMark;
34 private import gsv.SourceStyleScheme;
35 private import gsv.SourceUndoManager;
36 private import gsv.SourceUndoManagerIF;
37 private import gsvc.gsv;
38 public  import gsvc.gsvtypes;
39 private import gtk.TextBuffer;
40 private import gtk.TextIter;
41 private import gtk.TextMark;
42 private import gtk.TextTag;
43 private import gtk.TextTagTable;
44 public  import gtkc.gdktypes;
45 
46 
47 /** */
48 public class SourceBuffer : TextBuffer
49 {
50 	/** the main Gtk struct */
51 	protected GtkSourceBuffer* gtkSourceBuffer;
52 
53 	/** Get the main Gtk struct */
54 	public GtkSourceBuffer* getSourceBufferStruct()
55 	{
56 		return gtkSourceBuffer;
57 	}
58 
59 	/** the main Gtk struct as a void* */
60 	protected override void* getStruct()
61 	{
62 		return cast(void*)gtkSourceBuffer;
63 	}
64 
65 	protected override void setStruct(GObject* obj)
66 	{
67 		gtkSourceBuffer = cast(GtkSourceBuffer*)obj;
68 		super.setStruct(obj);
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GtkSourceBuffer* gtkSourceBuffer, bool ownedRef = false)
75 	{
76 		this.gtkSourceBuffer = gtkSourceBuffer;
77 		super(cast(GtkTextBuffer*)gtkSourceBuffer, ownedRef);
78 	}
79 
80 
81 	/** */
82 	public static GType getType()
83 	{
84 		return gtk_source_buffer_get_type();
85 	}
86 
87 	/**
88 	 * Creates a new source buffer.
89 	 *
90 	 * Params:
91 	 *     table = a #GtkTextTagTable, or %NULL to create a new one.
92 	 *
93 	 * Return: a new source buffer.
94 	 *
95 	 * Throws: ConstructionException GTK+ fails to create the object.
96 	 */
97 	public this(TextTagTable table)
98 	{
99 		auto p = gtk_source_buffer_new((table is null) ? null : table.getTextTagTableStruct());
100 		
101 		if(p is null)
102 		{
103 			throw new ConstructionException("null returned by new");
104 		}
105 		
106 		this(cast(GtkSourceBuffer*) p, true);
107 	}
108 
109 	/**
110 	 * Creates a new source buffer using the highlighting patterns in
111 	 * @language.  This is equivalent to creating a new source buffer with
112 	 * a new tag table and then calling gtk_source_buffer_set_language().
113 	 *
114 	 * Params:
115 	 *     language = a #GtkSourceLanguage.
116 	 *
117 	 * Return: a new source buffer which will highlight text
118 	 *     according to the highlighting patterns in @language.
119 	 *
120 	 * Throws: ConstructionException GTK+ fails to create the object.
121 	 */
122 	public this(SourceLanguage language)
123 	{
124 		auto p = gtk_source_buffer_new_with_language((language is null) ? null : language.getSourceLanguageStruct());
125 		
126 		if(p is null)
127 		{
128 			throw new ConstructionException("null returned by new_with_language");
129 		}
130 		
131 		this(cast(GtkSourceBuffer*) p, true);
132 	}
133 
134 	/**
135 	 * Moves @iter to the position of the previous #GtkSourceMark of the given
136 	 * category. Returns %TRUE if @iter was moved. If @category is NULL, the
137 	 * previous source mark can be of any category.
138 	 *
139 	 * Params:
140 	 *     iter = an iterator.
141 	 *     category = category to search for, or %NULL
142 	 *
143 	 * Return: whether @iter was moved.
144 	 *
145 	 * Since: 2.2
146 	 */
147 	public bool backwardIterToSourceMark(TextIter iter, string category)
148 	{
149 		return gtk_source_buffer_backward_iter_to_source_mark(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(category)) != 0;
150 	}
151 
152 	/**
153 	 * Marks the beginning of a not undoable action on the buffer,
154 	 * disabling the undo manager.  Typically you would call this function
155 	 * before initially setting the contents of the buffer (e.g. when
156 	 * loading a file in a text editor).
157 	 *
158 	 * You may nest gtk_source_buffer_begin_not_undoable_action() /
159 	 * gtk_source_buffer_end_not_undoable_action() blocks.
160 	 */
161 	public void beginNotUndoableAction()
162 	{
163 		gtk_source_buffer_begin_not_undoable_action(gtkSourceBuffer);
164 	}
165 
166 	/**
167 	 * Determines whether a source buffer can redo the last action
168 	 * (i.e. if the last operation was an undo).
169 	 *
170 	 * Return: %TRUE if a redo is possible.
171 	 */
172 	public bool canRedo()
173 	{
174 		return gtk_source_buffer_can_redo(gtkSourceBuffer) != 0;
175 	}
176 
177 	/**
178 	 * Determines whether a source buffer can undo the last action.
179 	 *
180 	 * Return: %TRUE if it's possible to undo the last action.
181 	 */
182 	public bool canUndo()
183 	{
184 		return gtk_source_buffer_can_undo(gtkSourceBuffer) != 0;
185 	}
186 
187 	/**
188 	 * Changes the case of the text between the specified iterators.
189 	 *
190 	 * Params:
191 	 *     caseType = how to change the case.
192 	 *     start = a #GtkTextIter.
193 	 *     end = a #GtkTextIter.
194 	 *
195 	 * Since: 3.12
196 	 */
197 	public void changeCase(GtkSourceChangeCaseType caseType, TextIter start, TextIter end)
198 	{
199 		gtk_source_buffer_change_case(gtkSourceBuffer, caseType, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
200 	}
201 
202 	/**
203 	 * Creates a source mark in the @buffer of category @category.  A source mark is
204 	 * a #GtkTextMark but organised into categories. Depending on the category
205 	 * a pixbuf can be specified that will be displayed along the line of the mark.
206 	 *
207 	 * Like a #GtkTextMark, a #GtkSourceMark can be anonymous if the
208 	 * passed @name is %NULL.  Also, the buffer owns the marks so you
209 	 * shouldn't unreference it.
210 	 *
211 	 * Marks always have left gravity and are moved to the beginning of
212 	 * the line when the user deletes the line they were in.
213 	 *
214 	 * Typical uses for a source mark are bookmarks, breakpoints, current
215 	 * executing instruction indication in a source file, etc..
216 	 *
217 	 * Params:
218 	 *     name = the name of the mark, or %NULL.
219 	 *     category = a string defining the mark category.
220 	 *     where = location to place the mark.
221 	 *
222 	 * Return: a new #GtkSourceMark, owned by the buffer.
223 	 *
224 	 * Since: 2.2
225 	 */
226 	public SourceMark createSourceMark(string name, string category, TextIter where)
227 	{
228 		auto p = gtk_source_buffer_create_source_mark(gtkSourceBuffer, Str.toStringz(name), Str.toStringz(category), (where is null) ? null : where.getTextIterStruct());
229 		
230 		if(p is null)
231 		{
232 			return null;
233 		}
234 		
235 		return ObjectG.getDObject!(SourceMark)(cast(GtkSourceMark*) p);
236 	}
237 
238 	/**
239 	 * Marks the end of a not undoable action on the buffer.  When the
240 	 * last not undoable block is closed through the call to this
241 	 * function, the list of undo actions is cleared and the undo manager
242 	 * is re-enabled.
243 	 */
244 	public void endNotUndoableAction()
245 	{
246 		gtk_source_buffer_end_not_undoable_action(gtkSourceBuffer);
247 	}
248 
249 	/**
250 	 * Forces buffer to analyze and highlight the given area synchronously.
251 	 *
252 	 * <note>
253 	 * <para>
254 	 * This is a potentially slow operation and should be used only
255 	 * when you need to make sure that some text not currently
256 	 * visible is highlighted, for instance before printing.
257 	 * </para>
258 	 * </note>
259 	 *
260 	 * Params:
261 	 *     start = start of the area to highlight.
262 	 *     end = end of the area to highlight.
263 	 */
264 	public void ensureHighlight(TextIter start, TextIter end)
265 	{
266 		gtk_source_buffer_ensure_highlight(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
267 	}
268 
269 	/**
270 	 * Moves @iter to the position of the next #GtkSourceMark of the given
271 	 * @category. Returns %TRUE if @iter was moved. If @category is NULL, the
272 	 * next source mark can be of any category.
273 	 *
274 	 * Params:
275 	 *     iter = an iterator.
276 	 *     category = category to search for, or %NULL
277 	 *
278 	 * Return: whether @iter was moved.
279 	 *
280 	 * Since: 2.2
281 	 */
282 	public bool forwardIterToSourceMark(TextIter iter, string category)
283 	{
284 		return gtk_source_buffer_forward_iter_to_source_mark(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(category)) != 0;
285 	}
286 
287 	/**
288 	 * Get all defined context classes at @iter.
289 	 *
290 	 * See the #GtkSourceBuffer description for the list of default context classes.
291 	 *
292 	 * Params:
293 	 *     iter = a #GtkTextIter.
294 	 *
295 	 * Return: a new %NULL
296 	 *     terminated array of context class names.
297 	 *     Use g_strfreev() to free the array if it is no longer needed.
298 	 *
299 	 * Since: 2.10
300 	 */
301 	public string[] getContextClassesAtIter(TextIter iter)
302 	{
303 		auto retStr = gtk_source_buffer_get_context_classes_at_iter(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct());
304 		
305 		scope(exit) Str.freeStringArray(retStr);
306 		return Str.toStringArray(retStr);
307 	}
308 
309 	/**
310 	 * Determines whether bracket match highlighting is activated for the
311 	 * source buffer.
312 	 *
313 	 * Return: %TRUE if the source buffer will highlight matching
314 	 *     brackets.
315 	 */
316 	public bool getHighlightMatchingBrackets()
317 	{
318 		return gtk_source_buffer_get_highlight_matching_brackets(gtkSourceBuffer) != 0;
319 	}
320 
321 	/**
322 	 * Determines whether syntax highlighting is activated in the source
323 	 * buffer.
324 	 *
325 	 * Return: %TRUE if syntax highlighting is enabled, %FALSE otherwise.
326 	 */
327 	public bool getHighlightSyntax()
328 	{
329 		return gtk_source_buffer_get_highlight_syntax(gtkSourceBuffer) != 0;
330 	}
331 
332 	/**
333 	 * Return: whether the @buffer has an implicit trailing newline.
334 	 *
335 	 * Since: 3.14
336 	 */
337 	public bool getImplicitTrailingNewline()
338 	{
339 		return gtk_source_buffer_get_implicit_trailing_newline(gtkSourceBuffer) != 0;
340 	}
341 
342 	/**
343 	 * Returns the #GtkSourceLanguage associated with the buffer,
344 	 * see gtk_source_buffer_set_language().  The returned object should not be
345 	 * unreferenced by the user.
346 	 *
347 	 * Return: the #GtkSourceLanguage associated
348 	 *     with the buffer, or %NULL.
349 	 */
350 	public SourceLanguage getLanguage()
351 	{
352 		auto p = gtk_source_buffer_get_language(gtkSourceBuffer);
353 		
354 		if(p is null)
355 		{
356 			return null;
357 		}
358 		
359 		return ObjectG.getDObject!(SourceLanguage)(cast(GtkSourceLanguage*) p);
360 	}
361 
362 	/**
363 	 * Determines the number of undo levels the buffer will track for buffer edits.
364 	 *
365 	 * Return: the maximum number of possible undo levels or -1 if no limit is set.
366 	 */
367 	public int getMaxUndoLevels()
368 	{
369 		return gtk_source_buffer_get_max_undo_levels(gtkSourceBuffer);
370 	}
371 
372 	/**
373 	 * Returns the list of marks of the given category at @iter. If @category
374 	 * is %NULL it returns all marks at @iter.
375 	 *
376 	 * Params:
377 	 *     iter = an iterator.
378 	 *     category = category to search for, or %NULL
379 	 *
380 	 * Return: a newly allocated #GSList.
381 	 *
382 	 * Since: 2.2
383 	 */
384 	public ListSG getSourceMarksAtIter(TextIter iter, string category)
385 	{
386 		auto p = gtk_source_buffer_get_source_marks_at_iter(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(category));
387 		
388 		if(p is null)
389 		{
390 			return null;
391 		}
392 		
393 		return new ListSG(cast(GSList*) p);
394 	}
395 
396 	/**
397 	 * Returns the list of marks of the given category at @line.
398 	 * If @category is %NULL, all marks at @line are returned.
399 	 *
400 	 * Params:
401 	 *     line = a line number.
402 	 *     category = category to search for, or %NULL
403 	 *
404 	 * Return: a newly allocated #GSList.
405 	 *
406 	 * Since: 2.2
407 	 */
408 	public ListSG getSourceMarksAtLine(int line, string category)
409 	{
410 		auto p = gtk_source_buffer_get_source_marks_at_line(gtkSourceBuffer, line, Str.toStringz(category));
411 		
412 		if(p is null)
413 		{
414 			return null;
415 		}
416 		
417 		return new ListSG(cast(GSList*) p);
418 	}
419 
420 	/**
421 	 * Returns the #GtkSourceStyleScheme associated with the buffer,
422 	 * see gtk_source_buffer_set_style_scheme().
423 	 * The returned object should not be unreferenced by the user.
424 	 *
425 	 * Return: the #GtkSourceStyleScheme
426 	 *     associated with the buffer, or %NULL.
427 	 */
428 	public SourceStyleScheme getStyleScheme()
429 	{
430 		auto p = gtk_source_buffer_get_style_scheme(gtkSourceBuffer);
431 		
432 		if(p is null)
433 		{
434 			return null;
435 		}
436 		
437 		return ObjectG.getDObject!(SourceStyleScheme)(cast(GtkSourceStyleScheme*) p);
438 	}
439 
440 	/**
441 	 * Returns the #GtkSourceUndoManager associated with the buffer,
442 	 * see gtk_source_buffer_set_undo_manager().  The returned object should not be
443 	 * unreferenced by the user.
444 	 *
445 	 * Return: the #GtkSourceUndoManager associated
446 	 *     with the buffer, or %NULL.
447 	 */
448 	public SourceUndoManagerIF getUndoManager()
449 	{
450 		auto p = gtk_source_buffer_get_undo_manager(gtkSourceBuffer);
451 		
452 		if(p is null)
453 		{
454 			return null;
455 		}
456 		
457 		return ObjectG.getDObject!(SourceUndoManager, SourceUndoManagerIF)(cast(GtkSourceUndoManager*) p);
458 	}
459 
460 	/**
461 	 * Moves backward to the next toggle (on or off) of the context class. If no
462 	 * matching context class toggles are found, returns %FALSE, otherwise %TRUE.
463 	 * Does not return toggles located at @iter, only toggles after @iter. Sets
464 	 * @iter to the location of the toggle, or to the end of the buffer if no
465 	 * toggle is found.
466 	 *
467 	 * See the #GtkSourceBuffer description for the list of default context classes.
468 	 *
469 	 * Params:
470 	 *     iter = a #GtkTextIter.
471 	 *     contextClass = the context class.
472 	 *
473 	 * Return: whether we found a context class toggle before @iter
474 	 *
475 	 * Since: 2.10
476 	 */
477 	public bool iterBackwardToContextClassToggle(ref TextIter iter, string contextClass)
478 	{
479 		return gtk_source_buffer_iter_backward_to_context_class_toggle(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(contextClass)) != 0;
480 	}
481 
482 	/**
483 	 * Moves forward to the next toggle (on or off) of the context class. If no
484 	 * matching context class toggles are found, returns %FALSE, otherwise %TRUE.
485 	 * Does not return toggles located at @iter, only toggles after @iter. Sets
486 	 * @iter to the location of the toggle, or to the end of the buffer if no
487 	 * toggle is found.
488 	 *
489 	 * See the #GtkSourceBuffer description for the list of default context classes.
490 	 *
491 	 * Params:
492 	 *     iter = a #GtkTextIter.
493 	 *     contextClass = the context class.
494 	 *
495 	 * Return: whether we found a context class toggle after @iter
496 	 *
497 	 * Since: 2.10
498 	 */
499 	public bool iterForwardToContextClassToggle(ref TextIter iter, string contextClass)
500 	{
501 		return gtk_source_buffer_iter_forward_to_context_class_toggle(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(contextClass)) != 0;
502 	}
503 
504 	/**
505 	 * Check if the class @context_class is set on @iter.
506 	 *
507 	 * See the #GtkSourceBuffer description for the list of default context classes.
508 	 *
509 	 * Params:
510 	 *     iter = a #GtkTextIter.
511 	 *     contextClass = class to search for.
512 	 *
513 	 * Return: whether @iter has the context class.
514 	 *
515 	 * Since: 2.10
516 	 */
517 	public bool iterHasContextClass(TextIter iter, string contextClass)
518 	{
519 		return gtk_source_buffer_iter_has_context_class(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(contextClass)) != 0;
520 	}
521 
522 	/**
523 	 * Joins the lines of text between the specified iterators.
524 	 *
525 	 * Params:
526 	 *     start = a #GtkTextIter.
527 	 *     end = a #GtkTextIter.
528 	 *
529 	 * Since: 3.16
530 	 */
531 	public void joinLines(TextIter start, TextIter end)
532 	{
533 		gtk_source_buffer_join_lines(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
534 	}
535 
536 	/**
537 	 * Redoes the last undo operation.  Use gtk_source_buffer_can_redo()
538 	 * to check whether a call to this function will have any effect.
539 	 *
540 	 * This function emits the #GtkSourceBuffer::redo signal.
541 	 */
542 	public void redo()
543 	{
544 		gtk_source_buffer_redo(gtkSourceBuffer);
545 	}
546 
547 	/**
548 	 * Remove all marks of @category between @start and @end from the buffer.
549 	 * If @category is NULL, all marks in the range will be removed.
550 	 *
551 	 * Params:
552 	 *     start = a #GtkTextIter.
553 	 *     end = a #GtkTextIter.
554 	 *     category = category to search for, or %NULL.
555 	 *
556 	 * Since: 2.2
557 	 */
558 	public void removeSourceMarks(TextIter start, TextIter end, string category)
559 	{
560 		gtk_source_buffer_remove_source_marks(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), Str.toStringz(category));
561 	}
562 
563 	/**
564 	 * Controls the bracket match highlighting function in the buffer.  If
565 	 * activated, when you position your cursor over a bracket character
566 	 * (a parenthesis, a square bracket, etc.) the matching opening or
567 	 * closing bracket character will be highlighted.
568 	 *
569 	 * Params:
570 	 *     highlight = %TRUE if you want matching brackets highlighted.
571 	 */
572 	public void setHighlightMatchingBrackets(bool highlight)
573 	{
574 		gtk_source_buffer_set_highlight_matching_brackets(gtkSourceBuffer, highlight);
575 	}
576 
577 	/**
578 	 * Controls whether syntax is highlighted in the buffer. If @highlight
579 	 * is %TRUE, the text will be highlighted according to the syntax
580 	 * patterns specified in the language set with
581 	 * gtk_source_buffer_set_language(). If @highlight is %FALSE, syntax highlighting
582 	 * is disabled and all the GtkTextTag objects that have been added by the
583 	 * syntax highlighting engine are removed from the buffer.
584 	 *
585 	 * Params:
586 	 *     highlight = %TRUE to enable syntax highlighting, %FALSE to disable it.
587 	 */
588 	public void setHighlightSyntax(bool highlight)
589 	{
590 		gtk_source_buffer_set_highlight_syntax(gtkSourceBuffer, highlight);
591 	}
592 
593 	/**
594 	 * Sets whether the @buffer has an implicit trailing newline.
595 	 *
596 	 * If an explicit trailing newline is present in a #GtkTextBuffer, #GtkTextView
597 	 * shows it as an empty line. This is generally not what the user expects.
598 	 *
599 	 * If @implicit_trailing_newline is %TRUE (the default value):
600 	 * - when a #GtkSourceFileLoader loads the content of a file into the @buffer,
601 	 * the trailing newline (if present in the file) is not inserted into the
602 	 * @buffer.
603 	 * - when a #GtkSourceFileSaver saves the content of the @buffer into a file, a
604 	 * trailing newline is added to the file.
605 	 *
606 	 * On the other hand, if @implicit_trailing_newline is %FALSE, the file's
607 	 * content is not modified when loaded into the @buffer, and the @buffer's
608 	 * content is not modified when saved into a file.
609 	 *
610 	 * Params:
611 	 *     implicitTrailingNewline = the new value.
612 	 *
613 	 * Since: 3.14
614 	 */
615 	public void setImplicitTrailingNewline(bool implicitTrailingNewline)
616 	{
617 		gtk_source_buffer_set_implicit_trailing_newline(gtkSourceBuffer, implicitTrailingNewline);
618 	}
619 
620 	/**
621 	 * Associate a #GtkSourceLanguage with the buffer. If @language is
622 	 * not-%NULL and syntax highlighting is enabled (see gtk_source_buffer_set_highlight_syntax()),
623 	 * the syntax patterns defined in @language will be used to highlight the text
624 	 * contained in the buffer. If @language is %NULL, the text contained in the
625 	 * buffer is not highlighted.
626 	 *
627 	 * The buffer holds a reference to @language.
628 	 *
629 	 * Params:
630 	 *     language = a #GtkSourceLanguage to set, or %NULL.
631 	 */
632 	public void setLanguage(SourceLanguage language)
633 	{
634 		gtk_source_buffer_set_language(gtkSourceBuffer, (language is null) ? null : language.getSourceLanguageStruct());
635 	}
636 
637 	/**
638 	 * Sets the number of undo levels for user actions the buffer will
639 	 * track.  If the number of user actions exceeds the limit set by this
640 	 * function, older actions will be discarded.
641 	 *
642 	 * If @max_undo_levels is -1, the undo/redo is unlimited.
643 	 *
644 	 * If @max_undo_levels is 0, the undo/redo is disabled.
645 	 *
646 	 * Params:
647 	 *     maxUndoLevels = the desired maximum number of undo levels.
648 	 */
649 	public void setMaxUndoLevels(int maxUndoLevels)
650 	{
651 		gtk_source_buffer_set_max_undo_levels(gtkSourceBuffer, maxUndoLevels);
652 	}
653 
654 	/**
655 	 * Sets style scheme used by the buffer. If @scheme is %NULL no
656 	 * style scheme is used.
657 	 *
658 	 * Params:
659 	 *     scheme = a #GtkSourceStyleScheme or %NULL.
660 	 */
661 	public void setStyleScheme(SourceStyleScheme scheme)
662 	{
663 		gtk_source_buffer_set_style_scheme(gtkSourceBuffer, (scheme is null) ? null : scheme.getSourceStyleSchemeStruct());
664 	}
665 
666 	/**
667 	 * Set the buffer undo manager. If @manager is %NULL the default undo manager
668 	 * will be set.
669 	 *
670 	 * Params:
671 	 *     manager = A #GtkSourceUndoManager or %NULL.
672 	 */
673 	public void setUndoManager(SourceUndoManagerIF manager)
674 	{
675 		gtk_source_buffer_set_undo_manager(gtkSourceBuffer, (manager is null) ? null : manager.getSourceUndoManagerStruct());
676 	}
677 
678 	/**
679 	 * Sort the lines of text between the specified iterators.
680 	 *
681 	 * Params:
682 	 *     start = a #GtkTextIter.
683 	 *     end = a #GtkTextIter.
684 	 *     flags = #GtkSourceSortFlags specifying how the sort should behave
685 	 *     column = sort considering the text starting at the given column
686 	 *
687 	 * Since: 3.18
688 	 */
689 	public void sortLines(TextIter start, TextIter end, GtkSourceSortFlags flags, int column)
690 	{
691 		gtk_source_buffer_sort_lines(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), flags, column);
692 	}
693 
694 	/**
695 	 * Undoes the last user action which modified the buffer.  Use
696 	 * gtk_source_buffer_can_undo() to check whether a call to this
697 	 * function will have any effect.
698 	 *
699 	 * This function emits the #GtkSourceBuffer::undo signal.
700 	 */
701 	public void undo()
702 	{
703 		gtk_source_buffer_undo(gtkSourceBuffer);
704 	}
705 
706 	int[string] connectedSignals;
707 
708 	void delegate(TextIter, GtkSourceBracketMatchType, SourceBuffer)[] onBracketMatchedListeners;
709 	/**
710 	 * @iter is set to a valid iterator pointing to the matching bracket
711 	 * if @state is %GTK_SOURCE_BRACKET_MATCH_FOUND. Otherwise @iter is
712 	 * meaningless.
713 	 *
714 	 * The signal is emitted only when the @state changes, typically when
715 	 * the cursor moves.
716 	 *
717 	 * A use-case for this signal is to show messages in a #GtkStatusbar.
718 	 *
719 	 * Params:
720 	 *     iter = if found, the location of the matching bracket.
721 	 *     state = state of bracket matching.
722 	 *
723 	 * Since: 2.12
724 	 */
725 	void addOnBracketMatched(void delegate(TextIter, GtkSourceBracketMatchType, SourceBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
726 	{
727 		if ( "bracket-matched" !in connectedSignals )
728 		{
729 			Signals.connectData(
730 				this,
731 				"bracket-matched",
732 				cast(GCallback)&callBackBracketMatched,
733 				cast(void*)this,
734 				null,
735 				connectFlags);
736 			connectedSignals["bracket-matched"] = 1;
737 		}
738 		onBracketMatchedListeners ~= dlg;
739 	}
740 	extern(C) static void callBackBracketMatched(GtkSourceBuffer* sourcebufferStruct, GtkTextIter* iter, GtkSourceBracketMatchType state, SourceBuffer _sourcebuffer)
741 	{
742 		foreach ( void delegate(TextIter, GtkSourceBracketMatchType, SourceBuffer) dlg; _sourcebuffer.onBracketMatchedListeners )
743 		{
744 			dlg(ObjectG.getDObject!(TextIter)(iter), state, _sourcebuffer);
745 		}
746 	}
747 
748 	void delegate(TextIter, TextIter, SourceBuffer)[] onHighlightUpdatedListeners;
749 	/**
750 	 * The ::highlight-updated signal is emitted when the syntax
751 	 * highlighting is updated in a certain region of the @buffer. This
752 	 * signal is useful to be notified when a context class region is
753 	 * updated (e.g. the no-spell-check context class).
754 	 *
755 	 * Params:
756 	 *     start = the start of the updated region
757 	 *     end = the end of the updated region
758 	 */
759 	void addOnHighlightUpdated(void delegate(TextIter, TextIter, SourceBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
760 	{
761 		if ( "highlight-updated" !in connectedSignals )
762 		{
763 			Signals.connectData(
764 				this,
765 				"highlight-updated",
766 				cast(GCallback)&callBackHighlightUpdated,
767 				cast(void*)this,
768 				null,
769 				connectFlags);
770 			connectedSignals["highlight-updated"] = 1;
771 		}
772 		onHighlightUpdatedListeners ~= dlg;
773 	}
774 	extern(C) static void callBackHighlightUpdated(GtkSourceBuffer* sourcebufferStruct, GtkTextIter* start, GtkTextIter* end, SourceBuffer _sourcebuffer)
775 	{
776 		foreach ( void delegate(TextIter, TextIter, SourceBuffer) dlg; _sourcebuffer.onHighlightUpdatedListeners )
777 		{
778 			dlg(ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), _sourcebuffer);
779 		}
780 	}
781 
782 	void delegate(SourceBuffer)[] onRedoListeners;
783 	/**
784 	 * The ::redo signal is emitted to redo the last undo operation.
785 	 */
786 	void addOnRedo(void delegate(SourceBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
787 	{
788 		if ( "redo" !in connectedSignals )
789 		{
790 			Signals.connectData(
791 				this,
792 				"redo",
793 				cast(GCallback)&callBackRedo,
794 				cast(void*)this,
795 				null,
796 				connectFlags);
797 			connectedSignals["redo"] = 1;
798 		}
799 		onRedoListeners ~= dlg;
800 	}
801 	extern(C) static void callBackRedo(GtkSourceBuffer* sourcebufferStruct, SourceBuffer _sourcebuffer)
802 	{
803 		foreach ( void delegate(SourceBuffer) dlg; _sourcebuffer.onRedoListeners )
804 		{
805 			dlg(_sourcebuffer);
806 		}
807 	}
808 
809 	void delegate(TextMark, SourceBuffer)[] onSourceMarkUpdatedListeners;
810 	/**
811 	 * The ::source_mark_updated signal is emitted each time
812 	 * a mark is added to, moved or removed from the @buffer.
813 	 *
814 	 * Params:
815 	 *     mark = the #GtkSourceMark
816 	 */
817 	void addOnSourceMarkUpdated(void delegate(TextMark, SourceBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
818 	{
819 		if ( "source-mark-updated" !in connectedSignals )
820 		{
821 			Signals.connectData(
822 				this,
823 				"source-mark-updated",
824 				cast(GCallback)&callBackSourceMarkUpdated,
825 				cast(void*)this,
826 				null,
827 				connectFlags);
828 			connectedSignals["source-mark-updated"] = 1;
829 		}
830 		onSourceMarkUpdatedListeners ~= dlg;
831 	}
832 	extern(C) static void callBackSourceMarkUpdated(GtkSourceBuffer* sourcebufferStruct, GtkTextMark* mark, SourceBuffer _sourcebuffer)
833 	{
834 		foreach ( void delegate(TextMark, SourceBuffer) dlg; _sourcebuffer.onSourceMarkUpdatedListeners )
835 		{
836 			dlg(ObjectG.getDObject!(TextMark)(mark), _sourcebuffer);
837 		}
838 	}
839 
840 	void delegate(SourceBuffer)[] onUndoListeners;
841 	/**
842 	 * The ::undo signal is emitted to undo the last user action which
843 	 * modified the buffer.
844 	 */
845 	void addOnUndo(void delegate(SourceBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
846 	{
847 		if ( "undo" !in connectedSignals )
848 		{
849 			Signals.connectData(
850 				this,
851 				"undo",
852 				cast(GCallback)&callBackUndo,
853 				cast(void*)this,
854 				null,
855 				connectFlags);
856 			connectedSignals["undo"] = 1;
857 		}
858 		onUndoListeners ~= dlg;
859 	}
860 	extern(C) static void callBackUndo(GtkSourceBuffer* sourcebufferStruct, SourceBuffer _sourcebuffer)
861 	{
862 		foreach ( void delegate(SourceBuffer) dlg; _sourcebuffer.onUndoListeners )
863 		{
864 			dlg(_sourcebuffer);
865 		}
866 	}
867 }