alternative to assert
[gtkD.git] / gtkD / src / gtk / TextBuffer.d
blob8841b8d4837f346f9a9b7bdb84c8500b945fa92e
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkTextBuffer.html
26 * outPack = gtk
27 * outFile = TextBuffer
28 * strct = GtkTextBuffer
29 * realStrct=
30 * ctorStrct=
31 * clss = TextBuffer
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_text_buffer_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_text_buffer_set_text
45 * - gtk_text_buffer_insert_with_tags
46 * - gtk_text_buffer_insert_with_tags_by_name
47 * - gtk_text_buffer_create_tag
48 * imports:
49 * - glib.Str
50 * - gtk.TextBuffer
51 * - gdk.Rectangle
52 * - gtk.Widget
53 * - pango.PgTabArray
54 * - gtk.TextAttributes
55 * - gtk.TextTagTable
56 * - gtk.TextIter
57 * - gtk.TextTag
58 * - gdk.Pixbuf
59 * - gtk.TextChildAnchor
60 * - gtk.TextMark
61 * - gtk.Clipboard
62 * - gdk.Bitmap
63 * - std.stdarg
64 * structWrap:
65 * - GdkBitmap* -> Bitmap
66 * - GdkPixbuf* -> Pixbuf
67 * - GdkRectangle* -> Rectangle
68 * - GtkClipboard* -> Clipboard
69 * - GtkTextAttributes* -> TextAttributes
70 * - GtkTextBuffer* -> TextBuffer
71 * - GtkTextChildAnchor* -> TextChildAnchor
72 * - GtkTextIter* -> TextIter
73 * - GtkTextMark* -> TextMark
74 * - GtkTextTag* -> TextTag
75 * - GtkTextTagTable* -> TextTagTable
76 * - GtkWidget* -> Widget
77 * - PangoTabArray* -> PgTabArray
78 * module aliases:
79 * local aliases:
82 module gtk.TextBuffer;
84 version(noAssert)
86 version(Tango)
88 import tango.io.Stdout; // use the tango loging?
92 private import gtkc.gtktypes;
94 private import gtkc.gtk;
97 private import glib.Str;
98 private import gtk.TextBuffer;
99 private import gdk.Rectangle;
100 private import gtk.Widget;
101 private import pango.PgTabArray;
102 private import gtk.TextAttributes;
103 private import gtk.TextTagTable;
104 private import gtk.TextIter;
105 private import gtk.TextTag;
106 private import gdk.Pixbuf;
107 private import gtk.TextChildAnchor;
108 private import gtk.TextMark;
109 private import gtk.Clipboard;
110 private import gdk.Bitmap;
113 version(Tango) {
114 private import tango.core.Vararg;
115 } else {
116 private import std.stdarg;
123 * Description
124 * You may wish to begin by reading the text widget
125 * conceptual overview which gives an overview of all the objects and data
126 * types related to the text widget and how they work together.
128 private import gobject.ObjectG;
129 public class TextBuffer : ObjectG
132 /** the main Gtk struct */
133 protected GtkTextBuffer* gtkTextBuffer;
136 public GtkTextBuffer* getTextBufferStruct()
138 return gtkTextBuffer;
142 /** the main Gtk struct as a void* */
143 protected void* getStruct()
145 return cast(void*)gtkTextBuffer;
149 * Sets our main struct and passes it to the parent class
151 public this (GtkTextBuffer* gtkTextBuffer)
153 version(noAssert)
155 if ( gtkTextBuffer is null )
157 int zero = 0;
158 version(Tango)
160 Stdout("struct gtkTextBuffer is null on constructor").newline;
162 else
164 printf("struct gtkTextBuffer is null on constructor");
166 zero = zero / zero;
169 else
171 assert(gtkTextBuffer !is null, "struct gtkTextBuffer is null on constructor");
173 super(cast(GObject*)gtkTextBuffer);
174 this.gtkTextBuffer = gtkTextBuffer;
178 * Deletes current contents of buffer, and inserts text instead. If
179 * len is -1, text must be nul-terminated. text must be valid UTF-8.
180 * buffer:
181 * a GtkTextBuffer
182 * text:
183 * UTF-8 text to insert
184 * len:
185 * length of text in bytes
187 public void setText(char[] text)
189 // void gtk_text_buffer_set_text (GtkTextBuffer *buffer, const gchar *text, gint len);
190 gtk_text_buffer_set_text(gtkTextBuffer, Str.toStringz(text), text.length);
194 * Inserts len bytes of text at position iter. If len is -1,
195 * text must be nul-terminated and will be inserted in its
196 * entirety. Emits the "insert_text" signal; insertion actually occurs
197 * in the default handler for the signal. iter is invalidated when
198 * insertion occurs (because the buffer contents change), but the
199 * default signal handler revalidates it to point to the end of the
200 * inserted text.
201 * buffer:
202 * a GtkTextBuffer
203 * iter:
204 * a position in the buffer
205 * text:
206 * UTF-8 format text to insert
207 * len:
208 * length of text in bytes, or -1
210 public void insert(TextIter iter, char[] text)
212 // void gtk_text_buffer_insert (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len);
213 gtk_text_buffer_insert(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), text.length);
217 * Simply calls gtk_text_buffer_insert(), using the current
218 * cursor position as the insertion point.
219 * buffer:
220 * a GtkTextBuffer
221 * text:
222 * some text in UTF-8 format
223 * len:
224 * length of text, in bytes
226 public void insertAtCursor(char[] text)
228 // void gtk_text_buffer_insert_at_cursor (GtkTextBuffer *buffer, const gchar *text, gint len);
229 gtk_text_buffer_insert_at_cursor(gtkTextBuffer, Str.toStringz(text), text.length);
233 * Like gtk_text_buffer_insert(), but the insertion will not occur if
234 * iter is at a non-editable location in the buffer. Usually you
235 * want to prevent insertions at ineditable locations if the insertion
236 * results from a user action (is interactive).
237 * default_editable indicates the editability of text that doesn't
238 * have a tag affecting editability applied to it. Typically the
239 * result of gtk_text_view_get_editable() is appropriate here.
240 * buffer:
241 * a GtkTextBuffer
242 * iter:
243 * a position in buffer
244 * text:
245 * some UTF-8 text
246 * len:
247 * length of text in bytes, or -1
248 * default_editable:
249 * default editability of buffer
250 * Returns:
251 * whether text was actually inserted
253 public int insertInteractive(TextIter iter, char[] text, int defaultEditable)
255 // gboolean gtk_text_buffer_insert_interactive (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, gboolean default_editable);
256 return gtk_text_buffer_insert_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), text.length, defaultEditable);
260 * Calls gtk_text_buffer_insert_interactive() at the cursor
261 * position.
262 * default_editable indicates the editability of text that doesn't
263 * have a tag affecting editability applied to it. Typically the
264 * result of gtk_text_view_get_editable() is appropriate here.
265 * buffer:
266 * a GtkTextBuffer
267 * text:
268 * text in UTF-8 format
269 * len:
270 * length of text in bytes, or -1
271 * default_editable:
272 * default editability of buffer
273 * Returns:
274 * whether text was actually inserted
276 public int insertInteractiveAtCursor(char[] text, int defaultEditable)
278 // gboolean gtk_text_buffer_insert_interactive_at_cursor (GtkTextBuffer *buffer, const gchar *text, gint len, gboolean default_editable);
279 return gtk_text_buffer_insert_interactive_at_cursor(gtkTextBuffer, Str.toStringz(text), text.length, defaultEditable);
283 * Inserts text into buffer at iter, applying the list of tags to
284 * the newly-inserted text. The last tag specified must be NULL to
285 * terminate the list. Equivalent to calling gtk_text_buffer_insert(),
286 * then gtk_text_buffer_apply_tag() on the inserted text;
287 * gtk_text_buffer_insert_with_tags() is just a convenience function.
288 * buffer:
289 * a GtkTextBuffer
290 * iter:
291 * an iterator in buffer
292 * text:
293 * UTF-8 text
294 * len:
295 * length of text, or -1
296 * first_tag:
297 * first tag to apply to text
298 * ...:
299 * NULL-terminated list of tags to apply
301 //version(Tango){} else -- still doesn't work on tango, but it compiles now
302 public void insertWithTags(TextIter iter, char[] text, ... )
304 for (int i = 0; (i<_arguments.length) && (_arguments[i] == typeid(TextTag)); i++)
306 TextTag tag = va_arg!(TextTag)(_argptr);
307 // void gtk_text_buffer_insert_with_tags (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, GtkTextTag *first_tag, ...);
308 gtk_text_buffer_insert_with_tags(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), text.length, (tag is null) ? null : tag.getTextTagStruct(), null);
313 * Same as gtk_text_buffer_insert_with_tags(), but allows you
314 * to pass in tag names instead of tag objects.
315 * buffer:
316 * a GtkTextBuffer
317 * iter:
318 * position in buffer
319 * text:
320 * UTF-8 text
321 * len:
322 * length of text, or -1
323 * first_tag_name:
324 * name of a tag to apply to text
325 * ...:
326 * more tag names
328 // version(Tango){} else -- still doesn't work on tango, but it compiles now
329 public void insertWithTagsByName(TextIter iter, char[] text, ... )
331 for (int i = 0; (i<_arguments.length) && (_arguments[i] == typeid(char[])); i++)
333 char[] tagName = va_arg!(char[])(_argptr);
334 // void gtk_text_buffer_insert_with_tags_by_name (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, const gchar *first_tag_name, ...);
335 gtk_text_buffer_insert_with_tags_by_name(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), text.length, Str.toStringz(tagName), null);
340 * Create a new tag for this buffer
341 * @param tagName can be null for no name
342 * @param propertyName
343 * @param propertyValue
345 TextTag createTag(char[] tagName, char[] propertyName, int propertyValue,
346 char[] propertyName1, char[] propertyValue1)
348 return new TextTag(
349 gtk_text_buffer_create_tag(gtkTextBuffer,
350 Str.toStringz(tagName),
351 Str.toStringz(propertyName),propertyValue,
352 Str.toStringz(propertyName1),
353 Str.toStringz(propertyValue1),
354 null)
359 * Create a new tag for this buffer
360 * @param tagName can be null for no name
361 * @param propertyName
362 * @param propertyValue
364 TextTag createTag(char[] tagName, char[] propertyName, int propertyValue)
366 return new TextTag(
367 gtk_text_buffer_create_tag(gtkTextBuffer,
368 Str.toStringz(tagName),
369 Str.toStringz(propertyName),propertyValue,null)
375 * Create a new tag for this buffer
376 * @param tagName can be null for no name
377 * @param propertyName
378 * @param propertyValue
380 TextTag createTag(char[] tagName, char[] propertyName, double propertyValue)
382 return new TextTag(
383 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), Str.toStringz(propertyName),propertyValue,null)
389 * Create a new tag for this buffer
390 * @param tagName can be null for no name
391 * @param propertyName
392 * @param propertyValue
393 * @param propertyName2
394 * @param propertyValue2
396 TextTag createTag(char[] tagName, char[] propertyName, int propertyValue, char[] propertyName2, int propertyValue2)
398 return new TextTag(
399 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), Str.toStringz(propertyName), propertyValue, Str.toStringz(propertyName2), propertyValue2, null)
403 TextTag createTag(char[] tagName, char[] propertyName, int propertyValue, char[] propertyName2, int propertyValue2, char[] propertyName3, int propertyValue3, char[] propertyName4, int propertyValue4, char[] propertyName5, int propertyValue5)
405 return new TextTag(
406 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), Str.toStringz(propertyName), propertyValue, Str.toStringz(propertyName2), propertyValue2, Str.toStringz(propertyName3), propertyValue3, Str.toStringz(propertyName4), propertyValue4, Str.toStringz(propertyName5), propertyValue5, null)
410 * Create a new tag for this buffer
411 * @param tagName can be null for no name
412 * @param propertyName
413 * @param propertyValue
415 TextTag createTag(char[] tagName, char[] propertyName, char[] propertyValue)
417 return new TextTag(
418 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), Str.toStringz(propertyName),Str.toStringz(propertyValue),null)
424 * Create a new tag for this buffer
425 * @param tagName can be null for no name
426 * @param propertyName
427 * @param propertyValue
428 * @return
430 TextTag createTag(char[] tagName, char[] propertyName, Bitmap propertyValue)
432 return new TextTag(
433 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName), Str.toStringz(propertyName),propertyValue.getBitmapStruct(),null)
439 * Obtain the entire text
440 * @return The text char[]
442 char[] getText()
444 TextIter start = new TextIter();
445 TextIter end = new TextIter();
446 getBounds(start,end);
447 return Str.toString(gtk_text_buffer_get_slice(gtkTextBuffer, start.getTextIterStruct(), end.getTextIterStruct(), true));
451 * Create a new tag for this buffer
452 * @param tagName can be null for no name
453 * @param propertyName
454 * @param propertyValue
455 * @param propertyName2
456 * @param propertyValue2
458 TextTag createTag(char[] tagName,
459 char[] propertyName, char[] propertyValue,
460 char[] propertyName2, int propertyValue2)
462 return new TextTag(
463 gtk_text_buffer_create_tag(gtkTextBuffer, Str.toStringz(tagName),
464 Str.toStringz(propertyName), Str.toStringz(propertyValue),
465 Str.toStringz(propertyName2), propertyValue2, null)
473 // imports for the signal processing
474 private import gobject.Signals;
475 private import gtkc.gdktypes;
476 int[char[]] connectedSignals;
478 void delegate(TextTag, TextIter, TextIter, TextBuffer)[] onApplyTagListeners;
479 void addOnApplyTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
481 if ( !("apply-tag" in connectedSignals) )
483 Signals.connectData(
484 getStruct(),
485 "apply-tag",
486 cast(GCallback)&callBackApplyTag,
487 cast(void*)this,
488 null,
489 connectFlags);
490 connectedSignals["apply-tag"] = 1;
492 onApplyTagListeners ~= dlg;
494 extern(C) static void callBackApplyTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, TextBuffer textBuffer)
496 bool consumed = false;
498 foreach ( void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg ; textBuffer.onApplyTagListeners )
500 dlg(new TextTag(tag), new TextIter(start), new TextIter(end), textBuffer);
503 return consumed;
506 void delegate(TextBuffer)[] onBeginUserActionListeners;
507 void addOnBeginUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
509 if ( !("begin-user-action" in connectedSignals) )
511 Signals.connectData(
512 getStruct(),
513 "begin-user-action",
514 cast(GCallback)&callBackBeginUserAction,
515 cast(void*)this,
516 null,
517 connectFlags);
518 connectedSignals["begin-user-action"] = 1;
520 onBeginUserActionListeners ~= dlg;
522 extern(C) static void callBackBeginUserAction(GtkTextBuffer* textbufferStruct, TextBuffer textBuffer)
524 bool consumed = false;
526 foreach ( void delegate(TextBuffer) dlg ; textBuffer.onBeginUserActionListeners )
528 dlg(textBuffer);
531 return consumed;
534 void delegate(TextBuffer)[] onChangedListeners;
535 void addOnChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
537 if ( !("changed" in connectedSignals) )
539 Signals.connectData(
540 getStruct(),
541 "changed",
542 cast(GCallback)&callBackChanged,
543 cast(void*)this,
544 null,
545 connectFlags);
546 connectedSignals["changed"] = 1;
548 onChangedListeners ~= dlg;
550 extern(C) static void callBackChanged(GtkTextBuffer* textbufferStruct, TextBuffer textBuffer)
552 bool consumed = false;
554 foreach ( void delegate(TextBuffer) dlg ; textBuffer.onChangedListeners )
556 dlg(textBuffer);
559 return consumed;
562 void delegate(TextIter, TextIter, TextBuffer)[] onDeleteRangeListeners;
563 void addOnDeleteRange(void delegate(TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
565 if ( !("delete-range" in connectedSignals) )
567 Signals.connectData(
568 getStruct(),
569 "delete-range",
570 cast(GCallback)&callBackDeleteRange,
571 cast(void*)this,
572 null,
573 connectFlags);
574 connectedSignals["delete-range"] = 1;
576 onDeleteRangeListeners ~= dlg;
578 extern(C) static void callBackDeleteRange(GtkTextBuffer* textbufferStruct, GtkTextIter* start, GtkTextIter* end, TextBuffer textBuffer)
580 bool consumed = false;
582 foreach ( void delegate(TextIter, TextIter, TextBuffer) dlg ; textBuffer.onDeleteRangeListeners )
584 dlg(new TextIter(start), new TextIter(end), textBuffer);
587 return consumed;
590 void delegate(TextBuffer)[] onEndUserActionListeners;
591 void addOnEndUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
593 if ( !("end-user-action" in connectedSignals) )
595 Signals.connectData(
596 getStruct(),
597 "end-user-action",
598 cast(GCallback)&callBackEndUserAction,
599 cast(void*)this,
600 null,
601 connectFlags);
602 connectedSignals["end-user-action"] = 1;
604 onEndUserActionListeners ~= dlg;
606 extern(C) static void callBackEndUserAction(GtkTextBuffer* textbufferStruct, TextBuffer textBuffer)
608 bool consumed = false;
610 foreach ( void delegate(TextBuffer) dlg ; textBuffer.onEndUserActionListeners )
612 dlg(textBuffer);
615 return consumed;
618 void delegate(TextIter, TextChildAnchor, TextBuffer)[] onInsertChildAnchorListeners;
619 void addOnInsertChildAnchor(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
621 if ( !("insert-child-anchor" in connectedSignals) )
623 Signals.connectData(
624 getStruct(),
625 "insert-child-anchor",
626 cast(GCallback)&callBackInsertChildAnchor,
627 cast(void*)this,
628 null,
629 connectFlags);
630 connectedSignals["insert-child-anchor"] = 1;
632 onInsertChildAnchorListeners ~= dlg;
634 extern(C) static void callBackInsertChildAnchor(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextChildAnchor* anchor, TextBuffer textBuffer)
636 bool consumed = false;
638 foreach ( void delegate(TextIter, TextChildAnchor, TextBuffer) dlg ; textBuffer.onInsertChildAnchorListeners )
640 dlg(new TextIter(location), new TextChildAnchor(anchor), textBuffer);
643 return consumed;
646 void delegate(TextIter, Pixbuf, TextBuffer)[] onInsertPixbufListeners;
647 void addOnInsertPixbuf(void delegate(TextIter, Pixbuf, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
649 if ( !("insert-pixbuf" in connectedSignals) )
651 Signals.connectData(
652 getStruct(),
653 "insert-pixbuf",
654 cast(GCallback)&callBackInsertPixbuf,
655 cast(void*)this,
656 null,
657 connectFlags);
658 connectedSignals["insert-pixbuf"] = 1;
660 onInsertPixbufListeners ~= dlg;
662 extern(C) static void callBackInsertPixbuf(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GdkPixbuf* pixbuf, TextBuffer textBuffer)
664 bool consumed = false;
666 foreach ( void delegate(TextIter, Pixbuf, TextBuffer) dlg ; textBuffer.onInsertPixbufListeners )
668 dlg(new TextIter(location), new Pixbuf(pixbuf), textBuffer);
671 return consumed;
674 void delegate(TextIter, char[], gint, TextBuffer)[] onInsertTextListeners;
675 void addOnInsertText(void delegate(TextIter, char[], gint, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
677 if ( !("insert-text" in connectedSignals) )
679 Signals.connectData(
680 getStruct(),
681 "insert-text",
682 cast(GCallback)&callBackInsertText,
683 cast(void*)this,
684 null,
685 connectFlags);
686 connectedSignals["insert-text"] = 1;
688 onInsertTextListeners ~= dlg;
690 extern(C) static void callBackInsertText(GtkTextBuffer* textbufferStruct, GtkTextIter* location, gchar* text, gint len, TextBuffer textBuffer)
692 bool consumed = false;
694 foreach ( void delegate(TextIter, char[], gint, TextBuffer) dlg ; textBuffer.onInsertTextListeners )
696 dlg(new TextIter(location), Str.toString(text), len, textBuffer);
699 return consumed;
702 void delegate(TextMark, TextBuffer)[] onMarkDeletedListeners;
703 void addOnMarkDeleted(void delegate(TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
705 if ( !("mark-deleted" in connectedSignals) )
707 Signals.connectData(
708 getStruct(),
709 "mark-deleted",
710 cast(GCallback)&callBackMarkDeleted,
711 cast(void*)this,
712 null,
713 connectFlags);
714 connectedSignals["mark-deleted"] = 1;
716 onMarkDeletedListeners ~= dlg;
718 extern(C) static void callBackMarkDeleted(GtkTextBuffer* textbufferStruct, GtkTextMark* mark, TextBuffer textBuffer)
720 bool consumed = false;
722 foreach ( void delegate(TextMark, TextBuffer) dlg ; textBuffer.onMarkDeletedListeners )
724 dlg(new TextMark(mark), textBuffer);
727 return consumed;
730 void delegate(TextIter, TextMark, TextBuffer)[] onMarkSetListeners;
731 void addOnMarkSet(void delegate(TextIter, TextMark, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
733 if ( !("mark-set" in connectedSignals) )
735 Signals.connectData(
736 getStruct(),
737 "mark-set",
738 cast(GCallback)&callBackMarkSet,
739 cast(void*)this,
740 null,
741 connectFlags);
742 connectedSignals["mark-set"] = 1;
744 onMarkSetListeners ~= dlg;
746 extern(C) static void callBackMarkSet(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextMark* mark, TextBuffer textBuffer)
748 bool consumed = false;
750 foreach ( void delegate(TextIter, TextMark, TextBuffer) dlg ; textBuffer.onMarkSetListeners )
752 dlg(new TextIter(location), new TextMark(mark), textBuffer);
755 return consumed;
758 void delegate(TextBuffer)[] onModifiedChangedListeners;
759 void addOnModifiedChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
761 if ( !("modified-changed" in connectedSignals) )
763 Signals.connectData(
764 getStruct(),
765 "modified-changed",
766 cast(GCallback)&callBackModifiedChanged,
767 cast(void*)this,
768 null,
769 connectFlags);
770 connectedSignals["modified-changed"] = 1;
772 onModifiedChangedListeners ~= dlg;
774 extern(C) static void callBackModifiedChanged(GtkTextBuffer* textbufferStruct, TextBuffer textBuffer)
776 bool consumed = false;
778 foreach ( void delegate(TextBuffer) dlg ; textBuffer.onModifiedChangedListeners )
780 dlg(textBuffer);
783 return consumed;
786 void delegate(TextTag, TextIter, TextIter, TextBuffer)[] onRemoveTagListeners;
787 void addOnRemoveTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
789 if ( !("remove-tag" in connectedSignals) )
791 Signals.connectData(
792 getStruct(),
793 "remove-tag",
794 cast(GCallback)&callBackRemoveTag,
795 cast(void*)this,
796 null,
797 connectFlags);
798 connectedSignals["remove-tag"] = 1;
800 onRemoveTagListeners ~= dlg;
802 extern(C) static void callBackRemoveTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, TextBuffer textBuffer)
804 bool consumed = false;
806 foreach ( void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg ; textBuffer.onRemoveTagListeners )
808 dlg(new TextTag(tag), new TextIter(start), new TextIter(end), textBuffer);
811 return consumed;
817 * Creates a new text buffer.
818 * table:
819 * a tag table, or NULL to create a new one
820 * Returns:
821 * a new text buffer
823 public this (TextTagTable table)
825 // GtkTextBuffer* gtk_text_buffer_new (GtkTextTagTable *table);
826 this(cast(GtkTextBuffer*)gtk_text_buffer_new((table is null) ? null : table.getTextTagTableStruct()) );
830 * Obtains the number of lines in the buffer. This value is cached, so
831 * the function is very fast.
832 * buffer:
833 * a GtkTextBuffer
834 * Returns:
835 * number of lines in the buffer
837 public int getLineCount()
839 // gint gtk_text_buffer_get_line_count (GtkTextBuffer *buffer);
840 return gtk_text_buffer_get_line_count(gtkTextBuffer);
844 * Gets the number of characters in the buffer; note that characters
845 * and bytes are not the same, you can't e.g. expect the contents of
846 * the buffer in string form to be this many bytes long. The character
847 * count is cached, so this function is very fast.
848 * buffer:
849 * a GtkTextBuffer
850 * Returns:
851 * number of characters in the buffer
853 public int getCharCount()
855 // gint gtk_text_buffer_get_char_count (GtkTextBuffer *buffer);
856 return gtk_text_buffer_get_char_count(gtkTextBuffer);
860 * Get the GtkTextTagTable associated with this buffer.
861 * buffer:
862 * a GtkTextBuffer
863 * Returns:
864 * the buffer's tag table
866 public TextTagTable getTagTable()
868 // GtkTextTagTable* gtk_text_buffer_get_tag_table (GtkTextBuffer *buffer);
869 return new TextTagTable( gtk_text_buffer_get_tag_table(gtkTextBuffer) );
873 * Inserts len bytes of text at position iter. If len is -1,
874 * text must be nul-terminated and will be inserted in its
875 * entirety. Emits the "insert_text" signal; insertion actually occurs
876 * in the default handler for the signal. iter is invalidated when
877 * insertion occurs (because the buffer contents change), but the
878 * default signal handler revalidates it to point to the end of the
879 * inserted text.
880 * buffer:
881 * a GtkTextBuffer
882 * iter:
883 * a position in the buffer
884 * text:
885 * UTF-8 format text to insert
886 * len:
887 * length of text in bytes, or -1
889 public void insert(TextIter iter, char[] text, int len)
891 // void gtk_text_buffer_insert (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len);
892 gtk_text_buffer_insert(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), len);
896 * Simply calls gtk_text_buffer_insert(), using the current
897 * cursor position as the insertion point.
898 * buffer:
899 * a GtkTextBuffer
900 * text:
901 * some text in UTF-8 format
902 * len:
903 * length of text, in bytes
905 public void insertAtCursor(char[] text, int len)
907 // void gtk_text_buffer_insert_at_cursor (GtkTextBuffer *buffer, const gchar *text, gint len);
908 gtk_text_buffer_insert_at_cursor(gtkTextBuffer, Str.toStringz(text), len);
912 * Like gtk_text_buffer_insert(), but the insertion will not occur if
913 * iter is at a non-editable location in the buffer. Usually you
914 * want to prevent insertions at ineditable locations if the insertion
915 * results from a user action (is interactive).
916 * default_editable indicates the editability of text that doesn't
917 * have a tag affecting editability applied to it. Typically the
918 * result of gtk_text_view_get_editable() is appropriate here.
919 * buffer:
920 * a GtkTextBuffer
921 * iter:
922 * a position in buffer
923 * text:
924 * some UTF-8 text
925 * len:
926 * length of text in bytes, or -1
927 * default_editable:
928 * default editability of buffer
929 * Returns:
930 * whether text was actually inserted
932 public int insertInteractive(TextIter iter, char[] text, int len, int defaultEditable)
934 // gboolean gtk_text_buffer_insert_interactive (GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *text, gint len, gboolean default_editable);
935 return gtk_text_buffer_insert_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(text), len, defaultEditable);
939 * Calls gtk_text_buffer_insert_interactive() at the cursor
940 * position.
941 * default_editable indicates the editability of text that doesn't
942 * have a tag affecting editability applied to it. Typically the
943 * result of gtk_text_view_get_editable() is appropriate here.
944 * buffer:
945 * a GtkTextBuffer
946 * text:
947 * text in UTF-8 format
948 * len:
949 * length of text in bytes, or -1
950 * default_editable:
951 * default editability of buffer
952 * Returns:
953 * whether text was actually inserted
955 public int insertInteractiveAtCursor(char[] text, int len, int defaultEditable)
957 // gboolean gtk_text_buffer_insert_interactive_at_cursor (GtkTextBuffer *buffer, const gchar *text, gint len, gboolean default_editable);
958 return gtk_text_buffer_insert_interactive_at_cursor(gtkTextBuffer, Str.toStringz(text), len, defaultEditable);
962 * Copies text, tags, and pixbufs between start and end (the order
963 * of start and end doesn't matter) and inserts the copy at iter.
964 * Used instead of simply getting/inserting text because it preserves
965 * images and tags. If start and end are in a different buffer from
966 * buffer, the two buffers must share the same tag table.
967 * Implemented via emissions of the insert_text and apply_tag signals,
968 * so expect those.
969 * buffer:
970 * a GtkTextBuffer
971 * iter:
972 * a position in buffer
973 * start:
974 * a position in a GtkTextBuffer
975 * end:
976 * another position in the same buffer as start
978 public void insertRange(TextIter iter, TextIter start, TextIter end)
980 // void gtk_text_buffer_insert_range (GtkTextBuffer *buffer, GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end);
981 gtk_text_buffer_insert_range(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
985 * Same as gtk_text_buffer_insert_range(), but does nothing if the
986 * insertion point isn't editable. The default_editable parameter
987 * indicates whether the text is editable at iter if no tags
988 * enclosing iter affect editability. Typically the result of
989 * gtk_text_view_get_editable() is appropriate here.
990 * buffer:
991 * a GtkTextBuffer
992 * iter:
993 * a position in buffer
994 * start:
995 * a position in a GtkTextBuffer
996 * end:
997 * another position in the same buffer as start
998 * default_editable:
999 * default editability of the buffer
1000 * Returns:
1001 * whether an insertion was possible at iter
1003 public int insertRangeInteractive(TextIter iter, TextIter start, TextIter end, int defaultEditable)
1005 // gboolean gtk_text_buffer_insert_range_interactive (GtkTextBuffer *buffer, GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end, gboolean default_editable);
1006 return gtk_text_buffer_insert_range_interactive(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), defaultEditable);
1012 * Deletes text between start and end. The order of start and end
1013 * is not actually relevant; gtk_text_buffer_delete() will reorder
1014 * them. This function actually emits the "delete_range" signal, and
1015 * the default handler of that signal deletes the text. Because the
1016 * buffer is modified, all outstanding iterators become invalid after
1017 * calling this function; however, the start and end will be
1018 * re-initialized to point to the location where text was deleted.
1019 * buffer:
1020 * a GtkTextBuffer
1021 * start:
1022 * a position in buffer
1023 * end:
1024 * another position in buffer
1026 public void delet(TextIter start, TextIter end)
1028 // void gtk_text_buffer_delete (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end);
1029 gtk_text_buffer_delete(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1033 * Deletes all editable text in the given range.
1034 * Calls gtk_text_buffer_delete() for each editable sub-range of
1035 * [start,end). start and end are revalidated to point to
1036 * the location of the last deleted range, or left untouched if
1037 * no text was deleted.
1038 * buffer:
1039 * a GtkTextBuffer
1040 * start_iter:
1041 * start of range to delete
1042 * end_iter:
1043 * end of range
1044 * default_editable:
1045 * whether the buffer is editable by default
1046 * Returns:
1047 * whether some text was actually deleted
1049 public int deleteInteractive(TextIter startIter, TextIter endIter, int defaultEditable)
1051 // gboolean gtk_text_buffer_delete_interactive (GtkTextBuffer *buffer, GtkTextIter *start_iter, GtkTextIter *end_iter, gboolean default_editable);
1052 return gtk_text_buffer_delete_interactive(gtkTextBuffer, (startIter is null) ? null : startIter.getTextIterStruct(), (endIter is null) ? null : endIter.getTextIterStruct(), defaultEditable);
1056 * Performs the appropriate action as if the user hit the delete
1057 * key with the cursor at the position specified by iter. In the
1058 * normal case a single character will be deleted, but when
1059 * combining accents are involved, more than one character can
1060 * be deleted, and when precomposed character and accent combinations
1061 * are involved, less than one character will be deleted.
1062 * Because the buffer is modified, all outstanding iterators become
1063 * invalid after calling this function; however, the iter will be
1064 * re-initialized to point to the location where text was deleted.
1065 * buffer:
1066 * a GtkTextBuffer
1067 * iter:
1068 * a position in buffer
1069 * interactive:
1070 * whether the deletion is caused by user interaction
1071 * default_editable:
1072 * whether the buffer is editable by default
1073 * Returns:
1074 * TRUE if the buffer was modified
1075 * Since 2.6
1077 public int backspace(TextIter iter, int interactive, int defaultEditable)
1079 // gboolean gtk_text_buffer_backspace (GtkTextBuffer *buffer, GtkTextIter *iter, gboolean interactive, gboolean default_editable);
1080 return gtk_text_buffer_backspace(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), interactive, defaultEditable);
1085 * Returns the text in the range [start,end). Excludes undisplayed
1086 * text (text marked with tags that set the invisibility attribute) if
1087 * include_hidden_chars is FALSE. Does not include characters
1088 * representing embedded images, so byte and character indexes into
1089 * the returned string do not correspond to byte
1090 * and character indexes into the buffer. Contrast with
1091 * gtk_text_buffer_get_slice().
1092 * buffer:
1093 * a GtkTextBuffer
1094 * start:
1095 * start of a range
1096 * end:
1097 * end of a range
1098 * include_hidden_chars:
1099 * whether to include invisible text
1100 * Returns:
1101 * an allocated UTF-8 string
1103 public char[] getText(TextIter start, TextIter end, int includeHiddenChars)
1105 // gchar* gtk_text_buffer_get_text (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end, gboolean include_hidden_chars);
1106 return Str.toString(gtk_text_buffer_get_text(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), includeHiddenChars) );
1110 * Returns the text in the range [start,end). Excludes undisplayed
1111 * text (text marked with tags that set the invisibility attribute) if
1112 * include_hidden_chars is FALSE. The returned string includes a
1113 * 0xFFFC character whenever the buffer contains
1114 * embedded images, so byte and character indexes into
1115 * the returned string do correspond to byte
1116 * and character indexes into the buffer. Contrast with
1117 * gtk_text_buffer_get_text(). Note that 0xFFFC can occur in normal
1118 * text as well, so it is not a reliable indicator that a pixbuf or
1119 * widget is in the buffer.
1120 * buffer:
1121 * a GtkTextBuffer
1122 * start:
1123 * start of a range
1124 * end:
1125 * end of a range
1126 * include_hidden_chars:
1127 * whether to include invisible text
1128 * Returns:
1129 * an allocated UTF-8 string
1131 public char[] getSlice(TextIter start, TextIter end, int includeHiddenChars)
1133 // gchar* gtk_text_buffer_get_slice (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end, gboolean include_hidden_chars);
1134 return Str.toString(gtk_text_buffer_get_slice(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), includeHiddenChars) );
1138 * Inserts an image into the text buffer at iter. The image will be
1139 * counted as one character in character counts, and when obtaining
1140 * the buffer contents as a string, will be represented by the Unicode
1141 * "object replacement character" 0xFFFC. Note that the "slice"
1142 * variants for obtaining portions of the buffer as a string include
1143 * this character for pixbufs, but the "text" variants do
1144 * not. e.g. see gtk_text_buffer_get_slice() and
1145 * gtk_text_buffer_get_text().
1146 * buffer:
1147 * a GtkTextBuffer
1148 * iter:
1149 * location to insert the pixbuf
1150 * pixbuf:
1151 * a GdkPixbuf
1153 public void insertPixbuf(TextIter iter, Pixbuf pixbuf)
1155 // void gtk_text_buffer_insert_pixbuf (GtkTextBuffer *buffer, GtkTextIter *iter, GdkPixbuf *pixbuf);
1156 gtk_text_buffer_insert_pixbuf(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
1160 * Inserts a child widget anchor into the text buffer at iter. The
1161 * anchor will be counted as one character in character counts, and
1162 * when obtaining the buffer contents as a string, will be represented
1163 * by the Unicode "object replacement character" 0xFFFC. Note that the
1164 * "slice" variants for obtaining portions of the buffer as a string
1165 * include this character for child anchors, but the "text" variants do
1166 * not. e.g. see gtk_text_buffer_get_slice() and
1167 * gtk_text_buffer_get_text(). Consider
1168 * gtk_text_buffer_create_child_anchor() as a more convenient
1169 * alternative to this function. The buffer will add a reference to
1170 * the anchor, so you can unref it after insertion.
1171 * buffer:
1172 * a GtkTextBuffer
1173 * iter:
1174 * location to insert the anchor
1175 * anchor:
1176 * a GtkTextChildAnchor
1178 public void insertChildAnchor(TextIter iter, TextChildAnchor anchor)
1180 // void gtk_text_buffer_insert_child_anchor (GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextChildAnchor *anchor);
1181 gtk_text_buffer_insert_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
1185 * This is a convenience function which simply creates a child anchor
1186 * with gtk_text_child_anchor_new() and inserts it into the buffer
1187 * with gtk_text_buffer_insert_child_anchor(). The new anchor is
1188 * owned by the buffer; no reference count is returned to
1189 * the caller of gtk_text_buffer_create_child_anchor().
1190 * buffer:
1191 * a GtkTextBuffer
1192 * iter:
1193 * location in the buffer
1194 * Returns:
1195 * the created child anchor
1197 public TextChildAnchor createChildAnchor(TextIter iter)
1199 // GtkTextChildAnchor* gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer, GtkTextIter *iter);
1200 return new TextChildAnchor( gtk_text_buffer_create_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct()) );
1204 * Creates a mark at position where. If mark_name is NULL, the mark
1205 * is anonymous; otherwise, the mark can be retrieved by name using
1206 * gtk_text_buffer_get_mark(). If a mark has left gravity, and text is
1207 * inserted at the mark's current location, the mark will be moved to
1208 * the left of the newly-inserted text. If the mark has right gravity
1209 * (left_gravity = FALSE), the mark will end up on the right of
1210 * newly-inserted text. The standard left-to-right cursor is a mark
1211 * with right gravity (when you type, the cursor stays on the right
1212 * side of the text you're typing).
1213 * The caller of this function does not own a reference
1214 * to the returned GtkTextMark, so you can ignore the return value
1215 * if you like. Marks are owned by the buffer and go away when the
1216 * buffer does.
1217 * Emits the "mark_set" signal as notification of the mark's initial
1218 * placement.
1219 * buffer:
1220 * a GtkTextBuffer
1221 * mark_name:
1222 * name for mark, or NULL
1223 * where:
1224 * location to place mark
1225 * left_gravity:
1226 * whether the mark has left gravity
1227 * Returns:
1228 * the new GtkTextMark object
1230 public TextMark createMark(char[] markName, TextIter where, int leftGravity)
1232 // GtkTextMark* gtk_text_buffer_create_mark (GtkTextBuffer *buffer, const gchar *mark_name, const GtkTextIter *where, gboolean left_gravity);
1233 return new TextMark( gtk_text_buffer_create_mark(gtkTextBuffer, Str.toStringz(markName), (where is null) ? null : where.getTextIterStruct(), leftGravity) );
1237 * Moves mark to the new location where. Emits the "mark_set" signal
1238 * as notification of the move.
1239 * buffer:
1240 * a GtkTextBuffer
1241 * mark:
1242 * a GtkTextMark
1243 * where:
1244 * new location for mark in buffer
1246 public void moveMark(TextMark mark, TextIter where)
1248 // void gtk_text_buffer_move_mark (GtkTextBuffer *buffer, GtkTextMark *mark, const GtkTextIter *where);
1249 gtk_text_buffer_move_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct(), (where is null) ? null : where.getTextIterStruct());
1253 * Moves the mark named name (which must exist) to location where.
1254 * See gtk_text_buffer_move_mark() for details.
1255 * buffer:
1256 * a GtkTextBuffer
1257 * name:
1258 * name of a mark
1259 * where:
1260 * new location for mark
1262 public void moveMarkByName(char[] name, TextIter where)
1264 // void gtk_text_buffer_move_mark_by_name (GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *where);
1265 gtk_text_buffer_move_mark_by_name(gtkTextBuffer, Str.toStringz(name), (where is null) ? null : where.getTextIterStruct());
1269 * Deletes mark, so that it's no longer located anywhere in the
1270 * buffer. Removes the reference the buffer holds to the mark, so if
1271 * you haven't called g_object_ref() on the mark, it will be freed. Even
1272 * if the mark isn't freed, most operations on mark become
1273 * invalid. There is no way to undelete a
1274 * mark. gtk_text_mark_get_deleted() will return TRUE after this
1275 * function has been called on a mark; gtk_text_mark_get_deleted()
1276 * indicates that a mark no longer belongs to a buffer. The "mark_deleted"
1277 * signal will be emitted as notification after the mark is deleted.
1278 * buffer:
1279 * a GtkTextBuffer
1280 * mark:
1281 * a GtkTextMark in buffer
1283 public void deleteMark(TextMark mark)
1285 // void gtk_text_buffer_delete_mark (GtkTextBuffer *buffer, GtkTextMark *mark);
1286 gtk_text_buffer_delete_mark(gtkTextBuffer, (mark is null) ? null : mark.getTextMarkStruct());
1290 * Deletes the mark named name; the mark must exist. See
1291 * gtk_text_buffer_delete_mark() for details.
1292 * buffer:
1293 * a GtkTextBuffer
1294 * name:
1295 * name of a mark in buffer
1297 public void deleteMarkByName(char[] name)
1299 // void gtk_text_buffer_delete_mark_by_name (GtkTextBuffer *buffer, const gchar *name);
1300 gtk_text_buffer_delete_mark_by_name(gtkTextBuffer, Str.toStringz(name));
1304 * Returns the mark named name in buffer buffer, or NULL if no such
1305 * mark exists in the buffer.
1306 * buffer:
1307 * a GtkTextBuffer
1308 * name:
1309 * a mark name
1310 * Returns:
1311 * a GtkTextMark, or NULL
1313 public TextMark getMark(char[] name)
1315 // GtkTextMark* gtk_text_buffer_get_mark (GtkTextBuffer *buffer, const gchar *name);
1316 return new TextMark( gtk_text_buffer_get_mark(gtkTextBuffer, Str.toStringz(name)) );
1320 * Returns the mark that represents the cursor (insertion point).
1321 * Equivalent to calling gtk_text_buffer_get_mark() to get the mark
1322 * named "insert", but very slightly more efficient, and involves less
1323 * typing.
1324 * buffer:
1325 * a GtkTextBuffer
1326 * Returns:
1327 * insertion point mark
1329 public TextMark getInsert()
1331 // GtkTextMark* gtk_text_buffer_get_insert (GtkTextBuffer *buffer);
1332 return new TextMark( gtk_text_buffer_get_insert(gtkTextBuffer) );
1336 * Returns the mark that represents the selection bound. Equivalent
1337 * to calling gtk_text_buffer_get_mark() to get the mark named
1338 * "selection_bound", but very slightly more efficient, and involves
1339 * less typing.
1340 * The currently-selected text in buffer is the region between the
1341 * "selection_bound" and "insert" marks. If "selection_bound" and
1342 * "insert" are in the same place, then there is no current selection.
1343 * gtk_text_buffer_get_selection_bounds() is another convenient function
1344 * for handling the selection, if you just want to know whether there's a
1345 * selection and what its bounds are.
1346 * buffer:
1347 * a GtkTextBuffer
1348 * Returns:
1349 * selection bound mark
1351 public TextMark getSelectionBound()
1353 // GtkTextMark* gtk_text_buffer_get_selection_bound (GtkTextBuffer *buffer);
1354 return new TextMark( gtk_text_buffer_get_selection_bound(gtkTextBuffer) );
1358 * Indicates whether the buffer has some text currently selected.
1359 * buffer:
1360 * a GtkTextBuffer
1361 * Returns:
1362 * TRUE if the there is text selected
1363 * Since 2.10
1365 public int getHasSelection()
1367 // gboolean gtk_text_buffer_get_has_selection (GtkTextBuffer *buffer);
1368 return gtk_text_buffer_get_has_selection(gtkTextBuffer);
1372 * This function moves the "insert" and "selection_bound" marks
1373 * simultaneously. If you move them to the same place in two steps
1374 * with gtk_text_buffer_move_mark(), you will temporarily select a
1375 * region in between their old and new locations, which can be pretty
1376 * inefficient since the temporarily-selected region will force stuff
1377 * to be recalculated. This function moves them as a unit, which can
1378 * be optimized.
1379 * buffer:
1380 * a GtkTextBuffer
1381 * where:
1382 * where to put the cursor
1384 public void placeCursor(TextIter where)
1386 // void gtk_text_buffer_place_cursor (GtkTextBuffer *buffer, const GtkTextIter *where);
1387 gtk_text_buffer_place_cursor(gtkTextBuffer, (where is null) ? null : where.getTextIterStruct());
1391 * This function moves the "insert" and "selection_bound" marks
1392 * simultaneously. If you move them in two steps
1393 * with gtk_text_buffer_move_mark(), you will temporarily select a
1394 * region in between their old and new locations, which can be pretty
1395 * inefficient since the temporarily-selected region will force stuff
1396 * to be recalculated. This function moves them as a unit, which can
1397 * be optimized.
1398 * buffer:
1399 * a GtkTextBuffer
1400 * ins:
1401 * where to put the "insert" mark
1402 * bound:
1403 * where to put the "selection_bound" mark
1404 * Since 2.4
1406 public void selectRange(TextIter ins, TextIter bound)
1408 // void gtk_text_buffer_select_range (GtkTextBuffer *buffer, const GtkTextIter *ins, const GtkTextIter *bound);
1409 gtk_text_buffer_select_range(gtkTextBuffer, (ins is null) ? null : ins.getTextIterStruct(), (bound is null) ? null : bound.getTextIterStruct());
1413 * Emits the "apply_tag" signal on buffer. The default
1414 * handler for the signal applies tag to the given range.
1415 * start and end do not have to be in order.
1416 * buffer:
1417 * a GtkTextBuffer
1418 * tag:
1419 * a GtkTextTag
1420 * start:
1421 * one bound of range to be tagged
1422 * end:
1423 * other bound of range to be tagged
1425 public void applyTag(TextTag tag, TextIter start, TextIter end)
1427 // void gtk_text_buffer_apply_tag (GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start, const GtkTextIter *end);
1428 gtk_text_buffer_apply_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1432 * Emits the "remove_tag" signal. The default handler for the signal
1433 * removes all occurrences of tag from the given range. start and
1434 * end don't have to be in order.
1435 * buffer:
1436 * a GtkTextBuffer
1437 * tag:
1438 * a GtkTextTag
1439 * start:
1440 * one bound of range to be untagged
1441 * end:
1442 * other bound of range to be untagged
1444 public void removeTag(TextTag tag, TextIter start, TextIter end)
1446 // void gtk_text_buffer_remove_tag (GtkTextBuffer *buffer, GtkTextTag *tag, const GtkTextIter *start, const GtkTextIter *end);
1447 gtk_text_buffer_remove_tag(gtkTextBuffer, (tag is null) ? null : tag.getTextTagStruct(), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1451 * Calls gtk_text_tag_table_lookup() on the buffer's tag table to
1452 * get a GtkTextTag, then calls gtk_text_buffer_apply_tag().
1453 * buffer:
1454 * a GtkTextBuffer
1455 * name:
1456 * name of a named GtkTextTag
1457 * start:
1458 * one bound of range to be tagged
1459 * end:
1460 * other bound of range to be tagged
1462 public void applyTagByName(char[] name, TextIter start, TextIter end)
1464 // void gtk_text_buffer_apply_tag_by_name (GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *start, const GtkTextIter *end);
1465 gtk_text_buffer_apply_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1469 * Calls gtk_text_tag_table_lookup() on the buffer's tag table to
1470 * get a GtkTextTag, then calls gtk_text_buffer_remove_tag().
1471 * buffer:
1472 * a GtkTextBuffer
1473 * name:
1474 * name of a GtkTextTag
1475 * start:
1476 * one bound of range to be untagged
1477 * end:
1478 * other bound of range to be untagged
1480 public void removeTagByName(char[] name, TextIter start, TextIter end)
1482 // void gtk_text_buffer_remove_tag_by_name (GtkTextBuffer *buffer, const gchar *name, const GtkTextIter *start, const GtkTextIter *end);
1483 gtk_text_buffer_remove_tag_by_name(gtkTextBuffer, Str.toStringz(name), (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1487 * Removes all tags in the range between start and end. Be careful
1488 * with this function; it could remove tags added in code unrelated to
1489 * the code you're currently writing. That is, using this function is
1490 * probably a bad idea if you have two or more unrelated code sections
1491 * that add tags.
1492 * buffer:
1493 * a GtkTextBuffer
1494 * start:
1495 * one bound of range to be untagged
1496 * end:
1497 * other bound of range to be untagged
1499 public void removeAllTags(TextIter start, TextIter end)
1501 // void gtk_text_buffer_remove_all_tags (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end);
1502 gtk_text_buffer_remove_all_tags(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1507 * Obtains an iterator pointing to char_offset within the given
1508 * line. The char_offset must exist, offsets off the end of the line
1509 * are not allowed. Note characters, not bytes;
1510 * UTF-8 may encode one character as multiple bytes.
1511 * buffer:
1512 * a GtkTextBuffer
1513 * iter:
1514 * iterator to initialize
1515 * line_number:
1516 * line number counting from 0
1517 * char_offset:
1518 * char offset from start of line
1520 public void getIterAtLineOffset(TextIter iter, int lineNumber, int charOffset)
1522 // void gtk_text_buffer_get_iter_at_line_offset (GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number, gint char_offset);
1523 gtk_text_buffer_get_iter_at_line_offset(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), lineNumber, charOffset);
1527 * Initializes iter to a position char_offset chars from the start
1528 * of the entire buffer. If char_offset is -1 or greater than the number
1529 * of characters in the buffer, iter is initialized to the end iterator,
1530 * the iterator one past the last valid character in the buffer.
1531 * buffer:
1532 * a GtkTextBuffer
1533 * iter:
1534 * iterator to initialize
1535 * char_offset:
1536 * char offset from start of buffer, counting from 0, or -1
1538 public void getIterAtOffset(TextIter iter, int charOffset)
1540 // void gtk_text_buffer_get_iter_at_offset (GtkTextBuffer *buffer, GtkTextIter *iter, gint char_offset);
1541 gtk_text_buffer_get_iter_at_offset(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), charOffset);
1545 * Initializes iter to the start of the given line.
1546 * buffer:
1547 * a GtkTextBuffer
1548 * iter:
1549 * iterator to initialize
1550 * line_number:
1551 * line number counting from 0
1553 public void getIterAtLine(TextIter iter, int lineNumber)
1555 // void gtk_text_buffer_get_iter_at_line (GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number);
1556 gtk_text_buffer_get_iter_at_line(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), lineNumber);
1560 * Obtains an iterator pointing to byte_index within the given line.
1561 * byte_index must be the start of a UTF-8 character, and must not be
1562 * beyond the end of the line. Note bytes, not
1563 * characters; UTF-8 may encode one character as multiple bytes.
1564 * buffer:
1565 * a GtkTextBuffer
1566 * iter:
1567 * iterator to initialize
1568 * line_number:
1569 * line number counting from 0
1570 * byte_index:
1571 * byte index from start of line
1573 public void getIterAtLineIndex(TextIter iter, int lineNumber, int byteIndex)
1575 // void gtk_text_buffer_get_iter_at_line_index (GtkTextBuffer *buffer, GtkTextIter *iter, gint line_number, gint byte_index);
1576 gtk_text_buffer_get_iter_at_line_index(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), lineNumber, byteIndex);
1580 * Initializes iter with the current position of mark.
1581 * buffer:
1582 * a GtkTextBuffer
1583 * iter:
1584 * iterator to initialize
1585 * mark:
1586 * a GtkTextMark in buffer
1588 public void getIterAtMark(TextIter iter, TextMark mark)
1590 // void gtk_text_buffer_get_iter_at_mark (GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextMark *mark);
1591 gtk_text_buffer_get_iter_at_mark(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (mark is null) ? null : mark.getTextMarkStruct());
1595 * Obtains the location of anchor within buffer.
1596 * buffer:
1597 * a GtkTextBuffer
1598 * iter:
1599 * an iterator to be initialized
1600 * anchor:
1601 * a child anchor that appears in buffer
1603 public void getIterAtChildAnchor(TextIter iter, TextChildAnchor anchor)
1605 // void gtk_text_buffer_get_iter_at_child_anchor (GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextChildAnchor *anchor);
1606 gtk_text_buffer_get_iter_at_child_anchor(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
1610 * Initialized iter with the first position in the text buffer. This
1611 * is the same as using gtk_text_buffer_get_iter_at_offset() to get
1612 * the iter at character offset 0.
1613 * buffer:
1614 * a GtkTextBuffer
1615 * iter:
1616 * iterator to initialize
1618 public void getStartIter(TextIter iter)
1620 // void gtk_text_buffer_get_start_iter (GtkTextBuffer *buffer, GtkTextIter *iter);
1621 gtk_text_buffer_get_start_iter(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct());
1625 * Initializes iter with the "end iterator," one past the last valid
1626 * character in the text buffer. If dereferenced with
1627 * gtk_text_iter_get_char(), the end iterator has a character value of
1628 * 0. The entire buffer lies in the range from the first position in
1629 * the buffer (call gtk_text_buffer_get_start_iter() to get
1630 * character position 0) to the end iterator.
1631 * buffer:
1632 * a GtkTextBuffer
1633 * iter:
1634 * iterator to initialize
1636 public void getEndIter(TextIter iter)
1638 // void gtk_text_buffer_get_end_iter (GtkTextBuffer *buffer, GtkTextIter *iter);
1639 gtk_text_buffer_get_end_iter(gtkTextBuffer, (iter is null) ? null : iter.getTextIterStruct());
1643 * Retrieves the first and last iterators in the buffer, i.e. the
1644 * entire buffer lies within the range [start,end).
1645 * buffer:
1646 * a GtkTextBuffer
1647 * start:
1648 * iterator to initialize with first position in the buffer
1649 * end:
1650 * iterator to initialize with the end iterator
1652 public void getBounds(TextIter start, TextIter end)
1654 // void gtk_text_buffer_get_bounds (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end);
1655 gtk_text_buffer_get_bounds(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1659 * Indicates whether the buffer has been modified since the last call
1660 * to gtk_text_buffer_set_modified() set the modification flag to
1661 * FALSE. Used for example to enable a "save" function in a text
1662 * editor.
1663 * buffer:
1664 * a GtkTextBuffer
1665 * Returns:
1666 * TRUE if the buffer has been modified
1668 public int getModified()
1670 // gboolean gtk_text_buffer_get_modified (GtkTextBuffer *buffer);
1671 return gtk_text_buffer_get_modified(gtkTextBuffer);
1675 * Used to keep track of whether the buffer has been modified since the
1676 * last time it was saved. Whenever the buffer is saved to disk, call
1677 * gtk_text_buffer_set_modified (buffer, FALSE). When the buffer is modified,
1678 * it will automatically toggled on the modified bit again. When the modified
1679 * bit flips, the buffer emits a "modified_changed" signal.
1680 * buffer:
1681 * a GtkTextBuffer
1682 * setting:
1683 * modification flag setting
1685 public void setModified(int setting)
1687 // void gtk_text_buffer_set_modified (GtkTextBuffer *buffer, gboolean setting);
1688 gtk_text_buffer_set_modified(gtkTextBuffer, setting);
1692 * Deletes the range between the "insert" and "selection_bound" marks,
1693 * that is, the currently-selected text. If interactive is TRUE,
1694 * the editability of the selection will be considered (users can't delete
1695 * uneditable text).
1696 * buffer:
1697 * a GtkTextBuffer
1698 * interactive:
1699 * whether the deletion is caused by user interaction
1700 * default_editable:
1701 * whether the buffer is editable by default
1702 * Returns:
1703 * whether there was a non-empty selection to delete
1705 public int deleteSelection(int interactive, int defaultEditable)
1707 // gboolean gtk_text_buffer_delete_selection (GtkTextBuffer *buffer, gboolean interactive, gboolean default_editable);
1708 return gtk_text_buffer_delete_selection(gtkTextBuffer, interactive, defaultEditable);
1712 * Pastes the contents of a clipboard at the insertion point, or at override_location.
1713 * (Note: pasting is asynchronous, that is, we'll ask for the paste data and
1714 * return, and at some point later after the main loop runs, the paste
1715 * data will be inserted.)
1716 * buffer:
1717 * a GtkTextBuffer
1718 * clipboard:
1719 * the GtkClipboard to paste from
1720 * override_location:
1721 * location to insert pasted text, or NULL for at the cursor
1722 * default_editable:
1723 * whether the buffer is editable by default
1725 public void pasteClipboard(Clipboard clipboard, TextIter overrideLocation, int defaultEditable)
1727 // void gtk_text_buffer_paste_clipboard (GtkTextBuffer *buffer, GtkClipboard *clipboard, GtkTextIter *override_location, gboolean default_editable);
1728 gtk_text_buffer_paste_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), (overrideLocation is null) ? null : overrideLocation.getTextIterStruct(), defaultEditable);
1732 * Copies the currently-selected text to a clipboard.
1733 * buffer:
1734 * a GtkTextBuffer
1735 * clipboard:
1736 * the GtkClipboard object to copy to.
1738 public void copyClipboard(Clipboard clipboard)
1740 // void gtk_text_buffer_copy_clipboard (GtkTextBuffer *buffer, GtkClipboard *clipboard);
1741 gtk_text_buffer_copy_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
1745 * Copies the currently-selected text to a clipboard, then deletes
1746 * said text if it's editable.
1747 * buffer:
1748 * a GtkTextBuffer
1749 * clipboard:
1750 * the GtkClipboard object to cut to.
1751 * default_editable:
1752 * default editability of the buffer
1754 public void cutClipboard(Clipboard clipboard, int defaultEditable)
1756 // void gtk_text_buffer_cut_clipboard (GtkTextBuffer *buffer, GtkClipboard *clipboard, gboolean default_editable);
1757 gtk_text_buffer_cut_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct(), defaultEditable);
1761 * Returns TRUE if some text is selected; places the bounds
1762 * of the selection in start and end (if the selection has length 0,
1763 * then start and end are filled in with the same value).
1764 * start and end will be in ascending order. If start and end are
1765 * NULL, then they are not filled in, but the return value still indicates
1766 * whether text is selected.
1767 * buffer:
1768 * a GtkTextBuffer a GtkTextBuffer
1769 * start:
1770 * iterator to initialize with selection start
1771 * end:
1772 * iterator to initialize with selection end
1773 * Returns:
1774 * whether the selection has nonzero length
1776 public int getSelectionBounds(TextIter start, TextIter end)
1778 // gboolean gtk_text_buffer_get_selection_bounds (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end);
1779 return gtk_text_buffer_get_selection_bounds(gtkTextBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
1783 * Called to indicate that the buffer operations between here and a
1784 * call to gtk_text_buffer_end_user_action() are part of a single
1785 * user-visible operation. The operations between
1786 * gtk_text_buffer_begin_user_action() and
1787 * gtk_text_buffer_end_user_action() can then be grouped when creating
1788 * an undo stack. GtkTextBuffer maintains a count of calls to
1789 * gtk_text_buffer_begin_user_action() that have not been closed with
1790 * a call to gtk_text_buffer_end_user_action(), and emits the "begin_user_action"
1791 * and "end_user_action" signals only for the outermost pair of calls.
1792 * This allows you to build user actions from other user actions.
1793 * The "interactive" buffer mutation functions, such as
1794 * gtk_text_buffer_insert_interactive(), automatically call begin/end
1795 * user action around the buffer operations they perform, so there's
1796 * no need to add extra calls if you user action consists solely of a
1797 * single call to one of those functions.
1798 * buffer:
1799 * a GtkTextBuffer
1801 public void beginUserAction()
1803 // void gtk_text_buffer_begin_user_action (GtkTextBuffer *buffer);
1804 gtk_text_buffer_begin_user_action(gtkTextBuffer);
1808 * Should be paired with a call to gtk_text_buffer_begin_user_action().
1809 * See that function for a full explanation.
1810 * buffer:
1811 * a GtkTextBuffer
1813 public void endUserAction()
1815 // void gtk_text_buffer_end_user_action (GtkTextBuffer *buffer);
1816 gtk_text_buffer_end_user_action(gtkTextBuffer);
1820 * Adds clipboard to the list of clipboards in which the selection contents
1821 * of buffer are available. In most cases, clipboard will be the GtkClipboard
1822 * of type GDK_SELECTION_PRIMARY for a view of buffer.
1823 * buffer:
1824 * a GtkTextBuffer
1825 * clipboard:
1826 * a GtkClipboard
1828 public void addSelectionClipboard(Clipboard clipboard)
1830 // void gtk_text_buffer_add_selection_clipboard (GtkTextBuffer *buffer, GtkClipboard *clipboard);
1831 gtk_text_buffer_add_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
1835 * Removes a GtkClipboard added with gtk_text_buffer_add_selection_clipboard()
1836 * buffer:
1837 * a GtkTextBuffer
1838 * clipboard:
1839 * a GtkClipboard added to buffer by gtk_text_buffer_add_selection_clipboard().
1841 public void removeSelectionClipboard(Clipboard clipboard)
1843 // void gtk_text_buffer_remove_selection_clipboard (GtkTextBuffer *buffer, GtkClipboard *clipboard);
1844 gtk_text_buffer_remove_selection_clipboard(gtkTextBuffer, (clipboard is null) ? null : clipboard.getClipboardStruct());
1850 * This function deserializes rich text in format format and inserts
1851 * it at iter.
1852 * formats to be used must be registered using
1853 * gtk_text_buffer_register_deserialize_format() or
1854 * gtk_text_buffer_register_deserialize_tagset() beforehand.
1855 * register_buffer:
1856 * the GtkTextBuffer format is registered with
1857 * content_buffer:
1858 * the GtkTextBuffer to deserialize into
1859 * format:
1860 * the rich text format to use for deserializing
1861 * iter:
1862 * insertion point for the deserialized text
1863 * data:
1864 * data to deserialize
1865 * length:
1866 * length of data
1867 * error:
1868 * return location for a GError
1869 * Returns:
1870 * TRUE on success, FALSE otherwise.
1871 * Since 2.10
1873 public int deserialize(TextBuffer contentBuffer, GdkAtom format, TextIter iter, byte* data, uint length, GError** error)
1875 // gboolean gtk_text_buffer_deserialize (GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GdkAtom format, GtkTextIter *iter, const guint8 *data, gsize length, GError **error);
1876 return gtk_text_buffer_deserialize(gtkTextBuffer, (contentBuffer is null) ? null : contentBuffer.getTextBufferStruct(), format, (iter is null) ? null : iter.getTextIterStruct(), data, length, error);
1880 * This functions returns the value set with
1881 * gtk_text_buffer_deserialize_set_can_create_tags()
1882 * buffer:
1883 * a GtkTextBuffer
1884 * format:
1885 * a GdkAtom representing a registered rich text format
1886 * Returns:
1887 * whether deserializing this format may create tags
1888 * Since 2.10
1890 public int deserializeGetCanCreateTags(GdkAtom format)
1892 // gboolean gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer *buffer, GdkAtom format);
1893 return gtk_text_buffer_deserialize_get_can_create_tags(gtkTextBuffer, format);
1897 * Use this function to allow a rich text deserialization function to
1898 * create new tags in the receiving buffer. Note that using this
1899 * function is almost always a bad idea, because the rich text
1900 * functions you register should know how to map the rich text format
1901 * they handler to your text buffers set of tags.
1902 * The ability of creating new (arbitrary!) tags in the receiving buffer
1903 * is meant for special rich text formats like the internal one that
1904 * is registered using gtk_text_buffer_register_deserialize_tagset(),
1905 * because that format is essentially a dump of the internal structure
1906 * of the source buffer, including its tag names.
1907 * You should allow creation of tags only if you know what you are
1908 * doing, e.g. if you defined a tagset name for your application
1909 * suite's text buffers and you know that it's fine to receive new
1910 * tags from these buffers, because you know that your application can
1911 * handle the newly created tags.
1912 * buffer:
1913 * a GtkTextBuffer
1914 * format:
1915 * a GdkAtom representing a registered rich text format
1916 * can_create_tags:
1917 * whether deserializing this format may create tags
1918 * Since 2.10
1920 public void deserializeSetCanCreateTags(GdkAtom format, int canCreateTags)
1922 // void gtk_text_buffer_deserialize_set_can_create_tags (GtkTextBuffer *buffer, GdkAtom format, gboolean can_create_tags);
1923 gtk_text_buffer_deserialize_set_can_create_tags(gtkTextBuffer, format, canCreateTags);
1927 * This function returns the list of targets this text buffer can
1928 * provide for copying and as DND source. The targets in the list are
1929 * added with info values from the GtkTextBufferTargetInfo enum,
1930 * using gtk_target_list_add_rich_text_targets() and
1931 * gtk_target_list_add_text_targets()
1932 * buffer:
1933 * a GtkTextBuffer
1934 * Returns:
1935 * the GtkTargetList
1936 * Since 2.10
1938 public GtkTargetList* getCopyTargetList()
1940 // GtkTargetList* gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer);
1941 return gtk_text_buffer_get_copy_target_list(gtkTextBuffer);
1945 * This function returns the rich text deserialize formats registered
1946 * with buffer using gtk_text_buffer_register_deserialize_format() or
1947 * gtk_text_buffer_register_deserialize_tagset()
1948 * buffer:
1949 * a GtkTextBuffer
1950 * n_formats:
1951 * return location for the number of formats
1952 * Returns:
1953 * an array of GdkAtoms representing the registered
1954 * formats.
1955 * Since 2.10
1957 public GdkAtom* getDeserializeFormats(int* nFormats)
1959 // GdkAtom* gtk_text_buffer_get_deserialize_formats (GtkTextBuffer *buffer, gint *n_formats);
1960 return gtk_text_buffer_get_deserialize_formats(gtkTextBuffer, nFormats);
1964 * This function returns the list of targets this text buffer supports
1965 * for pasting and as DND destination. The targets in the list are
1966 * added with info values from the GtkTextBufferTargetInfo enum,
1967 * using gtk_target_list_add_rich_text_targets() and
1968 * gtk_target_list_add_text_targets()
1969 * buffer:
1970 * a GtkTextBuffer
1971 * Returns:
1972 * the GtkTargetList
1973 * Since 2.10
1975 public GtkTargetList* getPasteTargetList()
1977 // GtkTargetList* gtk_text_buffer_get_paste_target_list (GtkTextBuffer *buffer);
1978 return gtk_text_buffer_get_paste_target_list(gtkTextBuffer);
1982 * This function returns the rich text serialize formats registered
1983 * with buffer using gtk_text_buffer_register_serialize_format() or
1984 * gtk_text_buffer_register_serialize_tagset()
1985 * buffer:
1986 * a GtkTextBuffer
1987 * n_formats:
1988 * return location for the number of formats
1989 * Returns:
1990 * an array of GdkAtoms representing the registered
1991 * formats.
1992 * Since 2.10
1994 public GdkAtom* getSerializeFormats(int* nFormats)
1996 // GdkAtom* gtk_text_buffer_get_serialize_formats (GtkTextBuffer *buffer, gint *n_formats);
1997 return gtk_text_buffer_get_serialize_formats(gtkTextBuffer, nFormats);
2001 * This function registers a rich text deserialization function along with
2002 * its mime_type with the passed buffer.
2003 * buffer:
2004 * a GtkTextBuffer
2005 * mime_type:
2006 * the format's mime-type
2007 * function:
2008 * the deserialize function to register
2009 * user_data:
2010 * function's user_data
2011 * user_data_destroy:
2012 * a function to call when user_data is no longer needed
2013 * Returns:
2014 * the GdkAtom that corresponds to the newly registered
2015 * format's mime-type.
2016 * Since 2.10
2018 public GdkAtom registerDeserializeFormat(char[] mimeType, GtkTextBufferDeserializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
2020 // GdkAtom gtk_text_buffer_register_deserialize_format (GtkTextBuffer *buffer, const gchar *mime_type, GtkTextBufferDeserializeFunc function, gpointer user_data, GDestroyNotify user_data_destroy);
2021 return gtk_text_buffer_register_deserialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
2025 * This function registers GTK+'s internal rich text serialization
2026 * format with the passed buffer. See
2027 * gtk_text_buffer_register_serialize_tagset() for details.
2028 * buffer:
2029 * a GtkTextBuffer
2030 * tagset_name:
2031 * an optional tagset name, on NULL
2032 * Returns:
2033 * the GdkAtom that corresponds to the newly registered
2034 * format's mime-type.
2035 * Since 2.10
2037 public GdkAtom registerDeserializeTagset(char[] tagsetName)
2039 // GdkAtom gtk_text_buffer_register_deserialize_tagset (GtkTextBuffer *buffer, const gchar *tagset_name);
2040 return gtk_text_buffer_register_deserialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
2044 * This function registers a rich text serialization function along with
2045 * its mime_type with the passed buffer.
2046 * buffer:
2047 * a GtkTextBuffer
2048 * mime_type:
2049 * the format's mime-type
2050 * function:
2051 * the serialize function to register
2052 * user_data:
2053 * function's user_data
2054 * user_data_destroy:
2055 * a function to call when user_data is no longer needed
2056 * Returns:
2057 * the GdkAtom that corresponds to the newly registered
2058 * format's mime-type.
2059 * Since 2.10
2061 public GdkAtom registerSerializeFormat(char[] mimeType, GtkTextBufferSerializeFunc funct, void* userData, GDestroyNotify userDataDestroy)
2063 // GdkAtom gtk_text_buffer_register_serialize_format (GtkTextBuffer *buffer, const gchar *mime_type, GtkTextBufferSerializeFunc function, gpointer user_data, GDestroyNotify user_data_destroy);
2064 return gtk_text_buffer_register_serialize_format(gtkTextBuffer, Str.toStringz(mimeType), funct, userData, userDataDestroy);
2068 * This function registers GTK+'s internal rich text serialization
2069 * format with the passed buffer. The internal format does not comply
2070 * to any standard rich text format and only works between GtkTextBuffer
2071 * instances. It is capable of serializing all of a text buffer's tags
2072 * and embedded pixbufs.
2073 * This function is just a wrapper around
2074 * gtk_text_buffer_register_serialize_format(). The mime type used
2075 * for registering is "application/x-gtk-text-buffer-rich-text", or
2076 * "application/x-gtk-text-buffer-rich-text;format=tagset_name" if a
2077 * tagset_name was passed.
2078 * The tagset_name can be used to restrict the transfer of rich text
2079 * to buffers with compatible sets of tags, in order to avoid unknown
2080 * tags from being pasted. It is probably the common case to pass an
2081 * identifier != NULL here, since the NULL tagset requires the
2082 * receiving buffer to deal with with pasting of arbitrary tags.
2083 * buffer:
2084 * a GtkTextBuffer
2085 * tagset_name:
2086 * an optional tagset name, on NULL
2087 * Returns:
2088 * the GdkAtom that corresponds to the newly registered
2089 * format's mime-type.
2090 * Since 2.10
2092 public GdkAtom registerSerializeTagset(char[] tagsetName)
2094 // GdkAtom gtk_text_buffer_register_serialize_tagset (GtkTextBuffer *buffer, const gchar *tagset_name);
2095 return gtk_text_buffer_register_serialize_tagset(gtkTextBuffer, Str.toStringz(tagsetName));
2100 * This function serializes the portion of text between start
2101 * and end in the rich text format represented by format.
2102 * formats to be used must be registered using
2103 * gtk_text_buffer_register_serialize_format() or
2104 * gtk_text_buffer_register_serialize_tagset() beforehand.
2105 * register_buffer:
2106 * the GtkTextBuffer format is registered with
2107 * content_buffer:
2108 * the GtkTextBuffer to serialize
2109 * format:
2110 * the rich text format to use for serializing
2111 * start:
2112 * start of block of text to serialize
2113 * end:
2114 * end of block of test to serialize
2115 * length:
2116 * return location for the length of the serialized data
2117 * Returns:
2118 * the serialized data, encoded as format
2119 * Since 2.10
2121 public byte* serialize(TextBuffer contentBuffer, GdkAtom format, TextIter start, TextIter end, uint* length)
2123 // guint8* gtk_text_buffer_serialize (GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GdkAtom format, const GtkTextIter *start, const GtkTextIter *end, gsize *length);
2124 return gtk_text_buffer_serialize(gtkTextBuffer, (contentBuffer is null) ? null : contentBuffer.getTextBufferStruct(), format, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), length);
2128 * This function unregisters a rich text format that was previously
2129 * registered using gtk_text_buffer_register_deserialize_format() or
2130 * gtk_text_buffer_register_deserialize_tagset().
2131 * buffer:
2132 * a GtkTextBuffer
2133 * format:
2134 * a GdkAtom representing a registered rich text format.
2135 * Since 2.10
2137 public void unregisterDeserializeFormat(GdkAtom format)
2139 // void gtk_text_buffer_unregister_deserialize_format (GtkTextBuffer *buffer, GdkAtom format);
2140 gtk_text_buffer_unregister_deserialize_format(gtkTextBuffer, format);
2144 * This function unregisters a rich text format that was previously
2145 * registered using gtk_text_buffer_register_serialize_format() or
2146 * gtk_text_buffer_register_serialize_tagset()
2147 * buffer:
2148 * a GtkTextBuffer
2149 * format:
2150 * a GdkAtom representing a registered rich text format.
2151 * Since 2.10
2152 * Property Details
2153 * The "copy-target-list" property
2154 * "copy-target-list" GtkTargetList : Read
2155 * The list of targets this buffer supports for clipboard copying
2156 * and as DND source.
2157 * Since 2.10
2159 public void unregisterSerializeFormat(GdkAtom format)
2161 // void gtk_text_buffer_unregister_serialize_format (GtkTextBuffer *buffer, GdkAtom format);
2162 gtk_text_buffer_unregister_serialize_format(gtkTextBuffer, format);