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