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