Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / textbuffer.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/textbuffer.h>
4 #include <gtkmm/private/textbuffer_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright(C) 1998-2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <gtk/gtktextbuffer.h>
27 #include <glib/gslist.h>
28 #include <gtkmm/textmark.h>
29 #include <gtkmm/textiter.h>
30
31
32 namespace Gtk
33 {
34
35 typedef TextChildAnchor ChildAnchor; //Help the code-generator so that it does not have to fully qualify this type in the .cc file.
36
37 TextBuffer::TextBuffer(const Glib::RefPtr<TagTable>& tag_table)
38 :
39   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
40   Glib::Object(Glib::ConstructParams(textbuffer_class_.init(), "tag_table",Glib::unwrap(tag_table), (char*) 0))
41 {}
42
43 Glib::RefPtr<TextBuffer::Tag> TextBuffer::create_tag(const Glib::ustring& tag_name)
44 {
45   //gtk_text_buffer_create_tag takes a varargs list of property names and values.
46   //gtkmm coders should use the Tag.set_* method instead.
47   return Glib::wrap(gtk_text_buffer_create_tag(gobj(), tag_name.c_str(), (char*)0), true); //true = take_copy.
48   //We have to take a copy because gtk_text_buffer_create_tag() doesn't ref for us, for no real reason.
49 }
50
51 Glib::RefPtr<TextBuffer::Tag> TextBuffer::create_tag()
52 {
53   //gtk_text_buffer_create_tag takes a varargs list of property names and values.
54   //gtkmm coders should use the Tag.set_* method instead.
55   return Glib::wrap(gtk_text_buffer_create_tag(gobj(), (const char*)0, (char*)0), true); //true = take_copy.
56   //We have to take a copy because gtk_text_buffer_create_tag() doesn't ref for us, for no real reason.
57 }
58
59 Glib::RefPtr<TextBuffer::Mark>
60 TextBuffer::create_mark(const TextBuffer::iterator& where, bool left_gravity)
61 {
62   return Glib::wrap(gtk_text_buffer_create_mark(
63       gobj(), 0, const_cast<GtkTextIter*>(where.gobj()), left_gravity),
64       true); // acquire reference
65 }
66
67 TextBuffer::iterator TextBuffer::get_iter_at_line_offset(int line_number, int char_offset)
68 {
69   iterator iter;
70   gtk_text_buffer_get_iter_at_line_offset(gobj(), iter.gobj(), line_number, char_offset);
71   return iter;
72 }
73
74 TextBuffer::iterator TextBuffer::get_iter_at_line_index(int line_number, int byte_index)
75 {
76   iterator iter;
77   gtk_text_buffer_get_iter_at_line_index(gobj(), iter.gobj(), line_number, byte_index);
78   return iter;
79 }
80
81 TextBuffer::iterator TextBuffer::get_iter_at_offset(int char_offset)
82 {
83   iterator iter;
84   gtk_text_buffer_get_iter_at_offset(gobj(), iter.gobj(), char_offset);
85   return iter;
86 }
87
88 TextBuffer::iterator TextBuffer::get_iter_at_line(int line_number)
89 {
90   iterator iter;
91   gtk_text_buffer_get_iter_at_line(gobj(), iter.gobj(), line_number);
92   return iter;
93 }
94
95 TextBuffer::iterator TextBuffer::begin()
96 {
97   iterator iter;
98   gtk_text_buffer_get_start_iter(gobj(), iter.gobj());
99   return iter;
100 }
101
102 TextBuffer::iterator TextBuffer::end()
103 {
104   iterator iter;
105   gtk_text_buffer_get_end_iter(gobj(), iter.gobj());
106   return iter;
107 }
108
109 void TextBuffer::get_bounds(iterator& range_begin, iterator& range_end)
110 {
111   gtk_text_buffer_get_bounds(gobj(), range_begin.gobj(), range_end.gobj());
112 }
113
114 TextBuffer::iterator TextBuffer::get_iter_at_mark(const Glib::RefPtr<Mark>& mark)
115 {
116   iterator iter;
117   gtk_text_buffer_get_iter_at_mark(gobj(), iter.gobj(), mark->gobj());
118   return iter;
119 }
120
121 void TextBuffer::set_text(const Glib::ustring& text)
122 {
123   gtk_text_buffer_set_text(gobj(), text.data(), text.bytes());
124 }
125
126 void TextBuffer::set_text(const char* text_begin, const char* text_end)
127 {
128   gtk_text_buffer_set_text(gobj(), text_begin, text_end - text_begin);
129 }
130
131 //deprecated:
132 void TextBuffer::assign(const Glib::ustring& text)
133 {
134   gtk_text_buffer_set_text(gobj(), text.data(), text.bytes());
135 }
136
137 //deprecated:
138 void TextBuffer::assign(const char* text_begin, const char* text_end)
139 {
140   gtk_text_buffer_set_text(gobj(), text_begin, text_end - text_begin);
141 }
142
143 TextBuffer::iterator TextBuffer::insert(const iterator& pos, const Glib::ustring& text)
144 {
145   // gtk_text_buffer_insert() modifies the iterator, but that's not the
146   // STL way so we give it something that we don't mind it modifying.
147   iterator iterCopy (pos);
148   gtk_text_buffer_insert(gobj(), iterCopy.gobj(), text.data(), text.bytes());
149
150   // According to the gtk_text_buffer_insert() docs, the "default signal handler
151   // revalidates it to point to the end of the inserted text".
152   return iterCopy;
153 }
154
155 TextBuffer::iterator TextBuffer::insert(const iterator& pos, const char* text_begin, const char* text_end)
156 {
157   // gtk_text_buffer_insert() modifies the iterator, but that's not the
158   // STL way so we give it something that we don't mind it modifying.
159   iterator iterCopy (pos);
160   gtk_text_buffer_insert(gobj(), iterCopy.gobj(), text_begin, text_end - text_begin);
161
162   // According to the gtk_text_buffer_insert() docs, the "default signal handler
163   // revalidates it to point to the end of the inserted text".
164   return iterCopy;
165 }
166
167 TextBuffer::iterator TextBuffer::insert_pixbuf(const iterator& pos, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
168 {
169   iterator iterCopy (pos);
170   gtk_text_buffer_insert_pixbuf(gobj(), iterCopy.gobj(), pixbuf->gobj());
171   return iterCopy;
172 }
173
174 TextBuffer::iterator TextBuffer::insert_child_anchor(const iterator& pos,
175                                                      const Glib::RefPtr<ChildAnchor>& anchor)
176 {
177   // Copy the iterator. It might be changed because it is used as a signal parameter internally.
178   iterator iterCopy (pos);
179   gtk_text_buffer_insert_child_anchor(gobj(), iterCopy.gobj(), Glib::unwrap(anchor));
180   return iterCopy;
181 }
182
183 Glib::RefPtr<ChildAnchor> TextBuffer::create_child_anchor(const iterator& pos)
184 {
185   // Copy the iterator. It might be changed because it is used as a signal parameter internally.
186   iterator iterCopy (pos);
187   return Glib::wrap(gtk_text_buffer_create_child_anchor(gobj(), iterCopy.gobj()),
188                     true); // The function does not do a ref for us.
189 }
190
191 void TextBuffer::insert_at_cursor(const Glib::ustring& text)
192 {
193   gtk_text_buffer_insert_at_cursor(gobj(), text.data(), text.bytes());
194 }
195
196 void TextBuffer::insert_at_cursor(const char* text_begin, const char* text_end)
197 {
198   gtk_text_buffer_insert_at_cursor(gobj(), text_begin, text_end - text_begin);
199 }
200
201 std::pair<TextBuffer::iterator,bool>
202 TextBuffer::insert_interactive(const iterator& pos, const Glib::ustring& text, bool default_editable)
203 {
204   // Since we have to copy the iterator anyway we can as well create the
205   // std::pair now.  That saves another copy later (mind you, TextIter is
206   // a heavy struct), and allows modern compilers to apply the return value
207   // optimization.
208   std::pair<iterator,bool> pair_iter_success (pos, false);
209
210   pair_iter_success.second = gtk_text_buffer_insert_interactive(
211       gobj(), pair_iter_success.first.gobj(), text.data(), text.bytes(), default_editable);
212
213   return pair_iter_success;
214 }
215
216 std::pair<TextBuffer::iterator,bool>
217 TextBuffer::insert_interactive(const iterator& pos, const char* text_begin, const char* text_end,
218                                bool default_editable)
219 {
220   // Since we have to copy the iterator anyway we can as well create the
221   // std::pair now.  That saves another copy later (mind you, TextIter is
222   // a heavy struct), and allows modern compilers to apply the return value
223   // optimization.
224   std::pair<iterator,bool> pair_iter_success (pos, false);
225
226   pair_iter_success.second =  gtk_text_buffer_insert_interactive(
227       gobj(), pair_iter_success.first.gobj(), text_begin, text_end - text_begin, default_editable);
228
229   return pair_iter_success;
230 }
231
232 bool TextBuffer::insert_interactive_at_cursor(const Glib::ustring& text, bool default_editable)
233 {
234   return gtk_text_buffer_insert_interactive_at_cursor(
235       gobj(), text.data(), text.bytes(), default_editable);
236 }
237
238 bool TextBuffer::insert_interactive_at_cursor(const char* text_begin, const char* text_end,
239                                               bool default_editable)
240 {
241   return gtk_text_buffer_insert_interactive_at_cursor(
242       gobj(), text_begin, text_end - text_begin, default_editable);
243 }
244
245 TextBuffer::iterator TextBuffer::insert_with_tag(const iterator& pos, const Glib::ustring& text,
246                                                  const Glib::RefPtr<Tag>& tag)
247 {
248   // gtk_text_buffer_insert_with_tags() invalidates the iterator, but this lets us recreate it later.
249   const int offset = pos.get_offset();
250
251   iterator iterCopy (pos);
252   gtk_text_buffer_insert_with_tags(
253       gobj(), iterCopy.gobj(), text.data(), text.bytes(), tag->gobj(), (GtkTextTag*)0);
254
255   return get_iter_at_offset(offset + text.size());
256 }
257
258 TextBuffer::iterator TextBuffer::insert_with_tag(const iterator& pos,
259                                                  const char* text_begin, const char* text_end,
260                                                  const Glib::RefPtr<Tag>& tag)
261 {
262   // gtk_text_buffer_insert_with_tags() invalidates the iterator, but this lets us recreate it later.
263   const int offset = pos.get_offset();
264
265   iterator iterCopy (pos);
266   gtk_text_buffer_insert_with_tags(
267       gobj(), iterCopy.gobj(), text_begin, text_end - text_begin, tag->gobj(), (GtkTextTag*)0);
268
269   return get_iter_at_offset(offset + (text_end - text_begin));
270 }
271
272 TextBuffer::iterator TextBuffer::insert_with_tag(const iterator& pos, const Glib::ustring& text,
273                                                  const Glib::ustring& tag_name)
274 {
275   // gtk_text_buffer_insert_with_tags() invalidates the iterator, but this lets us recreate it later.
276   const int offset = pos.get_offset();
277
278   iterator iterCopy (pos);
279   gtk_text_buffer_insert_with_tags_by_name(
280       gobj(), iterCopy.gobj(), text.data(), text.bytes(), tag_name.c_str(), (char*)0);
281
282   return get_iter_at_offset(offset + text.size());
283 }
284
285 TextBuffer::iterator TextBuffer::insert_with_tag(const iterator& pos,
286                                                  const char* text_begin, const char* text_end,
287                                                  const Glib::ustring& tag_name)
288 {
289   // gtk_text_buffer_insert_with_tags() invalidates the iterator, but this lets us recreate it later.
290   const int offset = pos.get_offset();
291
292   iterator iterCopy (pos);
293   gtk_text_buffer_insert_with_tags_by_name(
294       gobj(), iterCopy.gobj(), text_begin, text_end - text_begin, tag_name.c_str(), (char*)0);
295
296   return get_iter_at_offset(offset + (text_end - text_begin));
297 }
298
299 TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos, const Glib::ustring& text,
300                                                   const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags)
301 {
302   const char *const text_begin = text.data();
303   return insert_with_tags(pos, text_begin, text_begin + text.bytes(), tags);
304 }
305
306 TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos,
307                                                   const char* text_begin, const char* text_end,
308                                                   const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags)
309 {
310   const int start_offset = pos.get_offset();
311   iterator range_end (insert(pos, text_begin, text_end));
312
313   GtkTextIter range_begin;
314   gtk_text_buffer_get_iter_at_offset(gobj(), &range_begin, start_offset);
315
316   //This was GtkTextTag* const * const, but the SUN Forte compiler said that it couldn't convert to that. murrayc
317   const GtkTextTag* const* tags_begin = tags.data();
318   const GtkTextTag* const* tags_end   = tags_begin + tags.size();
319
320   //TODO: Investigate if this const_cast<> is really necessary.
321   //I added it for the SUN Forte compiler. murrayc.
322   for(GtkTextTag *const * ptag = const_cast<GtkTextTag* const *>(tags_begin); ptag != const_cast<GtkTextTag* const *>(tags_end); 
323 ++ptag)
324   {
325     gtk_text_buffer_apply_tag(gobj(), *ptag, &range_begin, range_end.gobj());
326   }
327
328   return range_end;
329 }
330
331 TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos, const Glib::ustring& text,
332                                                           const Glib::ArrayHandle<Glib::ustring>& tag_names)
333 {
334   const char *const text_begin = text.data();
335   return insert_with_tags_by_name(pos, text_begin, text_begin + text.bytes(), tag_names);
336 }
337
338 TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos,
339                                                           const char* text_begin, const char* text_end,
340                                                           const Glib::ArrayHandle<Glib::ustring>& tag_names)
341 {
342   // gtk_buffer_insert_with_tags_by_name() is a convenience wrapper, so it's kind of OK to reimplement it:
343
344   const int start_offset = pos.get_offset();
345   iterator range_end (insert(pos, text_begin, text_end));
346
347   GtkTextIter range_begin;
348   gtk_text_buffer_get_iter_at_offset(gobj(), &range_begin, start_offset);
349
350   GtkTextTagTable *const tag_table = gtk_text_buffer_get_tag_table(gobj());
351
352   const char *const *const names_begin = tag_names.data();
353   const char *const *const names_end   = names_begin + tag_names.size();
354
355   for(const char *const * pname = names_begin; pname != names_end; ++pname)
356   {
357     if(GtkTextTag *const tag = gtk_text_tag_table_lookup(tag_table, *pname))
358     {
359       gtk_text_buffer_apply_tag(gobj(), tag, &range_begin, range_end.gobj());
360     }
361     else
362     {
363       g_warning("Gtk::TextBuffer::insert_with_tags_by_name(): no tag with name '%s'!", *pname);
364     }
365   }
366
367   return range_end;
368 }
369
370 TextBuffer::iterator TextBuffer::insert(const iterator& pos,
371                                         const iterator& range_begin, const iterator& range_end)
372 {
373   iterator iterCopy (pos);
374   gtk_text_buffer_insert_range(gobj(), iterCopy.gobj(), range_begin.gobj(), range_end.gobj());
375   return iterCopy;
376 }
377
378 std::pair<TextBuffer::iterator,bool>
379 TextBuffer::insert_interactive(const iterator& pos, const iterator& range_begin,
380                                const iterator& range_end, bool default_editable)
381 {
382   // Since we have to copy the iterator anyway we can as well create the
383   // std::pair now.  That saves another copy later (mind you, TextIter is
384   // a heavy struct), and allows modern compilers to apply the return value
385   // optimization.
386   std::pair<iterator,bool> pair_iter_success (pos, false);
387
388   pair_iter_success.second = gtk_text_buffer_insert_range_interactive(
389       gobj(), pair_iter_success.first.gobj(), range_begin.gobj(), range_end.gobj(), default_editable);
390
391   return pair_iter_success;
392 }
393
394 TextBuffer::iterator TextBuffer::erase(const iterator& range_begin, const iterator& range_end)
395 {
396   // GTK+ sets the iterators to where the deletion occured. We do it the STL way and therefore need copies.
397   iterator beginCopy (range_begin);
398   iterator endCopy   (range_end);
399   gtk_text_buffer_delete(gobj(), beginCopy.gobj(), endCopy.gobj());
400   return beginCopy;
401 }
402
403 TextBuffer::iterator TextBuffer::backspace(const iterator& iter, bool interactive, bool default_editable)
404 {
405   // GTK+ sets the iterators to where the deletion occured. We do it the STL way and therefore need copies.
406   iterator copy(iter);
407   gtk_text_buffer_backspace(gobj(), copy.gobj(), interactive, default_editable);
408   return copy;
409 }
410
411
412 std::pair<TextBuffer::iterator,bool>
413 TextBuffer::erase_interactive(const iterator& range_begin, const iterator& range_end,
414                               bool default_editable)
415 {
416   // Since we have to copy the iterator anyway we can as well create the
417   // std::pair now.  That saves another copy later (mind you, TextIter is
418   // a heavy struct), and allows modern compilers to apply the return value
419   // optimization.
420   std::pair<iterator,bool> pair_iter_success (range_begin, false);
421
422   // GTK+ sets the iterators to where the deletion occured.
423   // We do it the STL way and therefore need copies.
424   iterator endCopy (range_end);
425
426   pair_iter_success.second = gtk_text_buffer_delete_interactive(
427       gobj(), pair_iter_success.first.gobj(), endCopy.gobj(), default_editable);
428
429   return pair_iter_success;
430 }
431
432 void TextBuffer::paste_clipboard(const Glib::RefPtr<Clipboard>& clipboard, const iterator& override_location,
433                                  bool default_editable)
434 {
435   gtk_text_buffer_paste_clipboard(gobj(), clipboard->gobj(),
436       const_cast<GtkTextIter*>(override_location.gobj()), default_editable);
437 }
438
439 void TextBuffer::paste_clipboard(const Glib::RefPtr<Clipboard>& clipboard, bool default_editable)
440 {
441   gtk_text_buffer_paste_clipboard(gobj(), clipboard->gobj(), 0, default_editable);
442 }
443
444 TextBuffer::iterator TextBuffer::get_iter_at_child_anchor(const Glib::RefPtr<ChildAnchor>& anchor)
445 {
446   iterator iter;
447   gtk_text_buffer_get_iter_at_child_anchor(gobj(), iter.gobj(), anchor->gobj());
448   return iter;
449 }
450
451 int TextBuffer::size() const
452 {
453   return get_char_count();
454 }
455
456 Glib::ustring TextBuffer::get_text(bool include_hidden_chars)
457 {
458   return get_text(begin(), end(), include_hidden_chars);
459 }
460
461 } // namespace Gtk
462
463
464 namespace
465 {
466
467 void TextBuffer_signal_insert_callback(GtkTextBuffer* self, GtkTextIter* p0,const gchar* p1,gint p2,void* data)
468 {
469   using namespace Gtk;
470   typedef sigc::slot< void,const TextBuffer::iterator&,const Glib::ustring&,int > SlotType;
471
472   // Do not try to call a signal on a disassociated wrapper.
473   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
474   {
475     try
476     {
477       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
478         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
479 , Glib::ustring(p1, p1 + p2)
480 , p2
481 );
482     }
483     catch(...)
484     {
485       Glib::exception_handlers_invoke();
486     }
487   }
488 }
489
490 const Glib::SignalProxyInfo TextBuffer_signal_insert_info =
491 {
492   "insert_text",
493   (GCallback) &TextBuffer_signal_insert_callback,
494   (GCallback) &TextBuffer_signal_insert_callback
495 };
496
497
498 void TextBuffer_signal_insert_pixbuf_callback(GtkTextBuffer* self, GtkTextIter* p0,GdkPixbuf* p1,void* data)
499 {
500   using namespace Gtk;
501   typedef sigc::slot< void,const TextBuffer::iterator&,const Glib::RefPtr<Gdk::Pixbuf>& > SlotType;
502
503   // Do not try to call a signal on a disassociated wrapper.
504   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
505   {
506     try
507     {
508       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
509         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
510 , Glib::wrap(p1, true)
511 );
512     }
513     catch(...)
514     {
515       Glib::exception_handlers_invoke();
516     }
517   }
518 }
519
520 const Glib::SignalProxyInfo TextBuffer_signal_insert_pixbuf_info =
521 {
522   "insert_pixbuf",
523   (GCallback) &TextBuffer_signal_insert_pixbuf_callback,
524   (GCallback) &TextBuffer_signal_insert_pixbuf_callback
525 };
526
527
528 void TextBuffer_signal_insert_child_anchor_callback(GtkTextBuffer* self, GtkTextIter* p0,GtkTextChildAnchor* p1,void* data)
529 {
530   using namespace Gtk;
531   typedef sigc::slot< void,const TextBuffer::iterator&,const Glib::RefPtr<ChildAnchor>& > SlotType;
532
533   // Do not try to call a signal on a disassociated wrapper.
534   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
535   {
536     try
537     {
538       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
539         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
540 , Glib::wrap(p1, true)
541 );
542     }
543     catch(...)
544     {
545       Glib::exception_handlers_invoke();
546     }
547   }
548 }
549
550 const Glib::SignalProxyInfo TextBuffer_signal_insert_child_anchor_info =
551 {
552   "insert_child_anchor",
553   (GCallback) &TextBuffer_signal_insert_child_anchor_callback,
554   (GCallback) &TextBuffer_signal_insert_child_anchor_callback
555 };
556
557
558 void TextBuffer_signal_erase_callback(GtkTextBuffer* self, GtkTextIter* p0,GtkTextIter* p1,void* data)
559 {
560   using namespace Gtk;
561   typedef sigc::slot< void,const TextBuffer::iterator&,const TextBuffer::iterator& > SlotType;
562
563   // Do not try to call a signal on a disassociated wrapper.
564   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
565   {
566     try
567     {
568       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
569         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
570 , Glib::wrap(p1)
571 );
572     }
573     catch(...)
574     {
575       Glib::exception_handlers_invoke();
576     }
577   }
578 }
579
580 const Glib::SignalProxyInfo TextBuffer_signal_erase_info =
581 {
582   "delete_range",
583   (GCallback) &TextBuffer_signal_erase_callback,
584   (GCallback) &TextBuffer_signal_erase_callback
585 };
586
587
588 const Glib::SignalProxyInfo TextBuffer_signal_changed_info =
589 {
590   "changed",
591   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
592   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
593 };
594
595
596 const Glib::SignalProxyInfo TextBuffer_signal_modified_changed_info =
597 {
598   "modified_changed",
599   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
600   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
601 };
602
603
604 void TextBuffer_signal_mark_set_callback(GtkTextBuffer* self, const GtkTextIter* p0,GtkTextMark* p1,void* data)
605 {
606   using namespace Gtk;
607   typedef sigc::slot< void,const TextBuffer::iterator&,const Glib::RefPtr<TextBuffer::Mark>& > SlotType;
608
609   // Do not try to call a signal on a disassociated wrapper.
610   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
611   {
612     try
613     {
614       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
615         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
616 , Glib::wrap(p1, true)
617 );
618     }
619     catch(...)
620     {
621       Glib::exception_handlers_invoke();
622     }
623   }
624 }
625
626 const Glib::SignalProxyInfo TextBuffer_signal_mark_set_info =
627 {
628   "mark_set",
629   (GCallback) &TextBuffer_signal_mark_set_callback,
630   (GCallback) &TextBuffer_signal_mark_set_callback
631 };
632
633
634 void TextBuffer_signal_mark_deleted_callback(GtkTextBuffer* self, GtkTextMark* p0,void* data)
635 {
636   using namespace Gtk;
637   typedef sigc::slot< void,const Glib::RefPtr<TextBuffer::Mark>& > SlotType;
638
639   // Do not try to call a signal on a disassociated wrapper.
640   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
641   {
642     try
643     {
644       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
645         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
646 );
647     }
648     catch(...)
649     {
650       Glib::exception_handlers_invoke();
651     }
652   }
653 }
654
655 const Glib::SignalProxyInfo TextBuffer_signal_mark_deleted_info =
656 {
657   "mark_deleted",
658   (GCallback) &TextBuffer_signal_mark_deleted_callback,
659   (GCallback) &TextBuffer_signal_mark_deleted_callback
660 };
661
662
663 void TextBuffer_signal_apply_tag_callback(GtkTextBuffer* self, GtkTextTag* p0,const GtkTextIter* p1,const GtkTextIter* p2,void* data)
664 {
665   using namespace Gtk;
666   typedef sigc::slot< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& > SlotType;
667
668   // Do not try to call a signal on a disassociated wrapper.
669   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
670   {
671     try
672     {
673       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
674         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
675 , Glib::wrap(p1)
676 , Glib::wrap(p2)
677 );
678     }
679     catch(...)
680     {
681       Glib::exception_handlers_invoke();
682     }
683   }
684 }
685
686 const Glib::SignalProxyInfo TextBuffer_signal_apply_tag_info =
687 {
688   "apply_tag",
689   (GCallback) &TextBuffer_signal_apply_tag_callback,
690   (GCallback) &TextBuffer_signal_apply_tag_callback
691 };
692
693
694 void TextBuffer_signal_remove_tag_callback(GtkTextBuffer* self, GtkTextTag* p0,const GtkTextIter* p1,const GtkTextIter* p2,void* data)
695 {
696   using namespace Gtk;
697   typedef sigc::slot< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& > SlotType;
698
699   // Do not try to call a signal on a disassociated wrapper.
700   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
701   {
702     try
703     {
704       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
705         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
706 , Glib::wrap(p1)
707 , Glib::wrap(p2)
708 );
709     }
710     catch(...)
711     {
712       Glib::exception_handlers_invoke();
713     }
714   }
715 }
716
717 const Glib::SignalProxyInfo TextBuffer_signal_remove_tag_info =
718 {
719   "remove_tag",
720   (GCallback) &TextBuffer_signal_remove_tag_callback,
721   (GCallback) &TextBuffer_signal_remove_tag_callback
722 };
723
724
725 const Glib::SignalProxyInfo TextBuffer_signal_begin_user_action_info =
726 {
727   "begin_user_action",
728   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
729   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
730 };
731
732
733 const Glib::SignalProxyInfo TextBuffer_signal_end_user_action_info =
734 {
735   "end_user_action",
736   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
737   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
738 };
739
740 } // anonymous namespace
741
742
743 namespace Glib
744 {
745
746 Glib::RefPtr<Gtk::TextBuffer> wrap(GtkTextBuffer* object, bool take_copy)
747 {
748   return Glib::RefPtr<Gtk::TextBuffer>( dynamic_cast<Gtk::TextBuffer*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
749   //We use dynamic_cast<> in case of multiple inheritance.
750 }
751
752 } /* namespace Glib */
753
754
755 namespace Gtk
756 {
757
758
759 /* The *_Class implementation: */
760
761 const Glib::Class& TextBuffer_Class::init()
762 {
763   if(!gtype_) // create the GType if necessary
764   {
765     // Glib::Class has to know the class init function to clone custom types.
766     class_init_func_ = &TextBuffer_Class::class_init_function;
767
768     // This is actually just optimized away, apparently with no harm.
769     // Make sure that the parent type has been created.
770     //CppClassParent::CppObjectType::get_type();
771
772     // Create the wrapper type, with the same class/instance size as the base type.
773     register_derived_type(gtk_text_buffer_get_type());
774
775     // Add derived versions of interfaces, if the C type implements any interfaces:
776   }
777
778   return *this;
779 }
780
781 void TextBuffer_Class::class_init_function(void* g_class, void* class_data)
782 {
783   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
784   CppClassParent::class_init_function(klass, class_data);
785
786   klass->insert_text = &insert_text_callback;
787   klass->insert_pixbuf = &insert_pixbuf_callback;
788   klass->insert_child_anchor = &insert_child_anchor_callback;
789   klass->delete_range = &delete_range_callback;
790   klass->changed = &changed_callback;
791   klass->modified_changed = &modified_changed_callback;
792   klass->mark_set = &mark_set_callback;
793   klass->mark_deleted = &mark_deleted_callback;
794   klass->apply_tag = &apply_tag_callback;
795   klass->remove_tag = &remove_tag_callback;
796   klass->begin_user_action = &begin_user_action_callback;
797   klass->end_user_action = &end_user_action_callback;
798 }
799
800
801 void TextBuffer_Class::insert_text_callback(GtkTextBuffer* self, GtkTextIter* p0, const gchar* p1, gint p2)
802 {
803   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
804       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
805
806   // Non-gtkmmproc-generated custom classes implicitly call the default
807   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
808   // generated classes can use this optimisation, which avoids the unnecessary
809   // parameter conversions if there is no possibility of the virtual function
810   // being overridden:
811   if(obj && obj->is_derived_())
812   {
813     try // Trap C++ exceptions which would normally be lost because this is a C callback.
814     {
815       // Call the virtual member method, which derived classes might override.
816       obj->on_insert(Glib::wrap(p0)
817 , Glib::ustring(p1, p1 + p2)
818 , p2
819 );
820     }
821     catch(...)
822     {
823       Glib::exception_handlers_invoke();
824     }
825   }
826   else
827   {
828     BaseClassType *const base = static_cast<BaseClassType*>(
829         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
830     );
831
832     // Call the original underlying C function:
833     if(base && base->insert_text)
834       (*base->insert_text)(self, p0, p1, p2);
835   }
836 }
837
838 void TextBuffer_Class::insert_pixbuf_callback(GtkTextBuffer* self, GtkTextIter* p0, GdkPixbuf* p1)
839 {
840   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
841       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
842
843   // Non-gtkmmproc-generated custom classes implicitly call the default
844   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
845   // generated classes can use this optimisation, which avoids the unnecessary
846   // parameter conversions if there is no possibility of the virtual function
847   // being overridden:
848   if(obj && obj->is_derived_())
849   {
850     try // Trap C++ exceptions which would normally be lost because this is a C callback.
851     {
852       // Call the virtual member method, which derived classes might override.
853       obj->on_insert_pixbuf(Glib::wrap(p0)
854 , Glib::wrap(p1, true)
855 );
856     }
857     catch(...)
858     {
859       Glib::exception_handlers_invoke();
860     }
861   }
862   else
863   {
864     BaseClassType *const base = static_cast<BaseClassType*>(
865         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
866     );
867
868     // Call the original underlying C function:
869     if(base && base->insert_pixbuf)
870       (*base->insert_pixbuf)(self, p0, p1);
871   }
872 }
873
874 void TextBuffer_Class::insert_child_anchor_callback(GtkTextBuffer* self, GtkTextIter* p0, GtkTextChildAnchor* p1)
875 {
876   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
877       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
878
879   // Non-gtkmmproc-generated custom classes implicitly call the default
880   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
881   // generated classes can use this optimisation, which avoids the unnecessary
882   // parameter conversions if there is no possibility of the virtual function
883   // being overridden:
884   if(obj && obj->is_derived_())
885   {
886     try // Trap C++ exceptions which would normally be lost because this is a C callback.
887     {
888       // Call the virtual member method, which derived classes might override.
889       obj->on_insert_child_anchor(Glib::wrap(p0)
890 , Glib::wrap(p1, true)
891 );
892     }
893     catch(...)
894     {
895       Glib::exception_handlers_invoke();
896     }
897   }
898   else
899   {
900     BaseClassType *const base = static_cast<BaseClassType*>(
901         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
902     );
903
904     // Call the original underlying C function:
905     if(base && base->insert_child_anchor)
906       (*base->insert_child_anchor)(self, p0, p1);
907   }
908 }
909
910 void TextBuffer_Class::delete_range_callback(GtkTextBuffer* self, GtkTextIter* p0, GtkTextIter* p1)
911 {
912   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
913       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
914
915   // Non-gtkmmproc-generated custom classes implicitly call the default
916   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
917   // generated classes can use this optimisation, which avoids the unnecessary
918   // parameter conversions if there is no possibility of the virtual function
919   // being overridden:
920   if(obj && obj->is_derived_())
921   {
922     try // Trap C++ exceptions which would normally be lost because this is a C callback.
923     {
924       // Call the virtual member method, which derived classes might override.
925       obj->on_erase(Glib::wrap(p0)
926 , Glib::wrap(p1)
927 );
928     }
929     catch(...)
930     {
931       Glib::exception_handlers_invoke();
932     }
933   }
934   else
935   {
936     BaseClassType *const base = static_cast<BaseClassType*>(
937         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
938     );
939
940     // Call the original underlying C function:
941     if(base && base->delete_range)
942       (*base->delete_range)(self, p0, p1);
943   }
944 }
945
946 void TextBuffer_Class::changed_callback(GtkTextBuffer* self)
947 {
948   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
949       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
950
951   // Non-gtkmmproc-generated custom classes implicitly call the default
952   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
953   // generated classes can use this optimisation, which avoids the unnecessary
954   // parameter conversions if there is no possibility of the virtual function
955   // being overridden:
956   if(obj && obj->is_derived_())
957   {
958     try // Trap C++ exceptions which would normally be lost because this is a C callback.
959     {
960       // Call the virtual member method, which derived classes might override.
961       obj->on_changed();
962     }
963     catch(...)
964     {
965       Glib::exception_handlers_invoke();
966     }
967   }
968   else
969   {
970     BaseClassType *const base = static_cast<BaseClassType*>(
971         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
972     );
973
974     // Call the original underlying C function:
975     if(base && base->changed)
976       (*base->changed)(self);
977   }
978 }
979
980 void TextBuffer_Class::modified_changed_callback(GtkTextBuffer* self)
981 {
982   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
983       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
984
985   // Non-gtkmmproc-generated custom classes implicitly call the default
986   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
987   // generated classes can use this optimisation, which avoids the unnecessary
988   // parameter conversions if there is no possibility of the virtual function
989   // being overridden:
990   if(obj && obj->is_derived_())
991   {
992     try // Trap C++ exceptions which would normally be lost because this is a C callback.
993     {
994       // Call the virtual member method, which derived classes might override.
995       obj->on_modified_changed();
996     }
997     catch(...)
998     {
999       Glib::exception_handlers_invoke();
1000     }
1001   }
1002   else
1003   {
1004     BaseClassType *const base = static_cast<BaseClassType*>(
1005         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1006     );
1007
1008     // Call the original underlying C function:
1009     if(base && base->modified_changed)
1010       (*base->modified_changed)(self);
1011   }
1012 }
1013
1014 void TextBuffer_Class::mark_set_callback(GtkTextBuffer* self, const GtkTextIter* p0, GtkTextMark* p1)
1015 {
1016   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1017       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1018
1019   // Non-gtkmmproc-generated custom classes implicitly call the default
1020   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1021   // generated classes can use this optimisation, which avoids the unnecessary
1022   // parameter conversions if there is no possibility of the virtual function
1023   // being overridden:
1024   if(obj && obj->is_derived_())
1025   {
1026     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1027     {
1028       // Call the virtual member method, which derived classes might override.
1029       obj->on_mark_set(Glib::wrap(p0)
1030 , Glib::wrap(p1, true)
1031 );
1032     }
1033     catch(...)
1034     {
1035       Glib::exception_handlers_invoke();
1036     }
1037   }
1038   else
1039   {
1040     BaseClassType *const base = static_cast<BaseClassType*>(
1041         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1042     );
1043
1044     // Call the original underlying C function:
1045     if(base && base->mark_set)
1046       (*base->mark_set)(self, p0, p1);
1047   }
1048 }
1049
1050 void TextBuffer_Class::mark_deleted_callback(GtkTextBuffer* self, GtkTextMark* p0)
1051 {
1052   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1053       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1054
1055   // Non-gtkmmproc-generated custom classes implicitly call the default
1056   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1057   // generated classes can use this optimisation, which avoids the unnecessary
1058   // parameter conversions if there is no possibility of the virtual function
1059   // being overridden:
1060   if(obj && obj->is_derived_())
1061   {
1062     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1063     {
1064       // Call the virtual member method, which derived classes might override.
1065       obj->on_mark_deleted(Glib::wrap(p0, true)
1066 );
1067     }
1068     catch(...)
1069     {
1070       Glib::exception_handlers_invoke();
1071     }
1072   }
1073   else
1074   {
1075     BaseClassType *const base = static_cast<BaseClassType*>(
1076         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1077     );
1078
1079     // Call the original underlying C function:
1080     if(base && base->mark_deleted)
1081       (*base->mark_deleted)(self, p0);
1082   }
1083 }
1084
1085 void TextBuffer_Class::apply_tag_callback(GtkTextBuffer* self, GtkTextTag* p0, const GtkTextIter* p1, const GtkTextIter* p2)
1086 {
1087   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1088       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1089
1090   // Non-gtkmmproc-generated custom classes implicitly call the default
1091   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1092   // generated classes can use this optimisation, which avoids the unnecessary
1093   // parameter conversions if there is no possibility of the virtual function
1094   // being overridden:
1095   if(obj && obj->is_derived_())
1096   {
1097     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1098     {
1099       // Call the virtual member method, which derived classes might override.
1100       obj->on_apply_tag(Glib::wrap(p0, true)
1101 , Glib::wrap(p1)
1102 , Glib::wrap(p2)
1103 );
1104     }
1105     catch(...)
1106     {
1107       Glib::exception_handlers_invoke();
1108     }
1109   }
1110   else
1111   {
1112     BaseClassType *const base = static_cast<BaseClassType*>(
1113         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1114     );
1115
1116     // Call the original underlying C function:
1117     if(base && base->apply_tag)
1118       (*base->apply_tag)(self, p0, p1, p2);
1119   }
1120 }
1121
1122 void TextBuffer_Class::remove_tag_callback(GtkTextBuffer* self, GtkTextTag* p0, const GtkTextIter* p1, const GtkTextIter* p2)
1123 {
1124   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1125       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1126
1127   // Non-gtkmmproc-generated custom classes implicitly call the default
1128   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1129   // generated classes can use this optimisation, which avoids the unnecessary
1130   // parameter conversions if there is no possibility of the virtual function
1131   // being overridden:
1132   if(obj && obj->is_derived_())
1133   {
1134     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1135     {
1136       // Call the virtual member method, which derived classes might override.
1137       obj->on_remove_tag(Glib::wrap(p0, true)
1138 , Glib::wrap(p1)
1139 , Glib::wrap(p2)
1140 );
1141     }
1142     catch(...)
1143     {
1144       Glib::exception_handlers_invoke();
1145     }
1146   }
1147   else
1148   {
1149     BaseClassType *const base = static_cast<BaseClassType*>(
1150         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1151     );
1152
1153     // Call the original underlying C function:
1154     if(base && base->remove_tag)
1155       (*base->remove_tag)(self, p0, p1, p2);
1156   }
1157 }
1158
1159 void TextBuffer_Class::begin_user_action_callback(GtkTextBuffer* self)
1160 {
1161   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1162       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1163
1164   // Non-gtkmmproc-generated custom classes implicitly call the default
1165   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1166   // generated classes can use this optimisation, which avoids the unnecessary
1167   // parameter conversions if there is no possibility of the virtual function
1168   // being overridden:
1169   if(obj && obj->is_derived_())
1170   {
1171     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1172     {
1173       // Call the virtual member method, which derived classes might override.
1174       obj->on_begin_user_action();
1175     }
1176     catch(...)
1177     {
1178       Glib::exception_handlers_invoke();
1179     }
1180   }
1181   else
1182   {
1183     BaseClassType *const base = static_cast<BaseClassType*>(
1184         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1185     );
1186
1187     // Call the original underlying C function:
1188     if(base && base->begin_user_action)
1189       (*base->begin_user_action)(self);
1190   }
1191 }
1192
1193 void TextBuffer_Class::end_user_action_callback(GtkTextBuffer* self)
1194 {
1195   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
1196       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
1197
1198   // Non-gtkmmproc-generated custom classes implicitly call the default
1199   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
1200   // generated classes can use this optimisation, which avoids the unnecessary
1201   // parameter conversions if there is no possibility of the virtual function
1202   // being overridden:
1203   if(obj && obj->is_derived_())
1204   {
1205     try // Trap C++ exceptions which would normally be lost because this is a C callback.
1206     {
1207       // Call the virtual member method, which derived classes might override.
1208       obj->on_end_user_action();
1209     }
1210     catch(...)
1211     {
1212       Glib::exception_handlers_invoke();
1213     }
1214   }
1215   else
1216   {
1217     BaseClassType *const base = static_cast<BaseClassType*>(
1218         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
1219     );
1220
1221     // Call the original underlying C function:
1222     if(base && base->end_user_action)
1223       (*base->end_user_action)(self);
1224   }
1225 }
1226
1227
1228 Glib::ObjectBase* TextBuffer_Class::wrap_new(GObject* object)
1229 {
1230   return new TextBuffer((GtkTextBuffer*)object);
1231 }
1232
1233
1234 /* The implementation: */
1235
1236 GtkTextBuffer* TextBuffer::gobj_copy()
1237 {
1238   reference();
1239   return gobj();
1240 }
1241
1242 TextBuffer::TextBuffer(const Glib::ConstructParams& construct_params)
1243 :
1244   Glib::Object(construct_params)
1245 {}
1246
1247 TextBuffer::TextBuffer(GtkTextBuffer* castitem)
1248 :
1249   Glib::Object((GObject*)(castitem))
1250 {}
1251
1252 TextBuffer::~TextBuffer()
1253 {}
1254
1255
1256 TextBuffer::CppClassType TextBuffer::textbuffer_class_; // initialize static member
1257
1258 GType TextBuffer::get_type()
1259 {
1260   return textbuffer_class_.init().get_type();
1261 }
1262
1263 GType TextBuffer::get_base_type()
1264 {
1265   return gtk_text_buffer_get_type();
1266 }
1267
1268
1269 TextBuffer::TextBuffer()
1270 :
1271   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
1272   Glib::Object(Glib::ConstructParams(textbuffer_class_.init()))
1273 {
1274   }
1275
1276 Glib::RefPtr<TextBuffer> TextBuffer::create()
1277 {
1278   return Glib::RefPtr<TextBuffer>( new TextBuffer() );
1279 }
1280 Glib::RefPtr<TextBuffer> TextBuffer::create(const Glib::RefPtr<TagTable>& tag_table)
1281 {
1282   return Glib::RefPtr<TextBuffer>( new TextBuffer(tag_table) );
1283 }
1284 int TextBuffer::get_line_count() const
1285 {
1286   return gtk_text_buffer_get_line_count(const_cast<GtkTextBuffer*>(gobj()));
1287 }
1288
1289 int TextBuffer::get_char_count() const
1290 {
1291   return gtk_text_buffer_get_char_count(const_cast<GtkTextBuffer*>(gobj()));
1292 }
1293
1294 Glib::RefPtr<TextBuffer::TagTable> TextBuffer::get_tag_table()
1295 {
1296
1297   Glib::RefPtr<TextBuffer::TagTable> retvalue = Glib::wrap(gtk_text_buffer_get_tag_table(gobj()));
1298
1299   if(retvalue)
1300     retvalue->reference(); //The function does not do a ref for us.
1301   return retvalue;
1302 }
1303
1304 Glib::RefPtr<const TextBuffer::TagTable> TextBuffer::get_tag_table() const
1305 {
1306
1307   Glib::RefPtr<const TextBuffer::TagTable> retvalue = Glib::wrap(gtk_text_buffer_get_tag_table(const_cast<GtkTextBuffer*>(gobj())));
1308
1309   if(retvalue)
1310     retvalue->reference(); //The function does not do a ref for us.
1311   return retvalue;
1312 }
1313
1314 Glib::ustring TextBuffer::get_text(const iterator& start, const iterator& end, bool include_hidden_chars)
1315 {
1316   return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_buffer_get_text(gobj(), (start).gobj(), (end).gobj(), static_cast<int>(include_hidden_chars)));
1317 }
1318
1319 Glib::ustring TextBuffer::get_slice(const iterator& start, const iterator& end, bool include_hidden_chars)
1320 {
1321   return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_buffer_get_slice(gobj(), (start).gobj(), (end).gobj(), static_cast<int>(include_hidden_chars)));
1322 }
1323
1324 Glib::RefPtr<TextBuffer::Mark> TextBuffer::create_mark(const Glib::ustring& mark_name, const iterator& where, bool left_gravity)
1325 {
1326
1327   Glib::RefPtr<TextBuffer::Mark> retvalue = Glib::wrap(gtk_text_buffer_create_mark(gobj(), mark_name.c_str(), (where).gobj(), static_cast<int>(left_gravity)));
1328
1329   if(retvalue)
1330     retvalue->reference(); //The function does not do a ref for us.
1331   return retvalue;
1332 }
1333
1334 void TextBuffer::move_mark(const Glib::RefPtr<Mark>& mark, const iterator& where)
1335 {
1336   gtk_text_buffer_move_mark(gobj(), Glib::unwrap(mark), (where).gobj());
1337 }
1338
1339 void TextBuffer::delete_mark(const Glib::RefPtr<Mark>& mark)
1340 {
1341   gtk_text_buffer_delete_mark(gobj(), Glib::unwrap(mark));
1342 }
1343
1344 Glib::RefPtr<TextBuffer::Mark> TextBuffer::get_mark(const Glib::ustring& name)
1345 {
1346
1347   Glib::RefPtr<TextBuffer::Mark> retvalue = Glib::wrap(gtk_text_buffer_get_mark(gobj(), name.c_str()));
1348
1349   if(retvalue)
1350     retvalue->reference(); //The function does not do a ref for us.
1351   return retvalue;
1352 }
1353
1354 Glib::RefPtr<const TextBuffer::Mark> TextBuffer::get_mark(const Glib::ustring& name) const
1355 {
1356
1357   Glib::RefPtr<const TextBuffer::Mark> retvalue = Glib::wrap(gtk_text_buffer_get_mark(const_cast<GtkTextBuffer*>(gobj()), name.c_str()));
1358
1359   if(retvalue)
1360     retvalue->reference(); //The function does not do a ref for us.
1361   return retvalue;
1362 }
1363
1364 void TextBuffer::move_mark_by_name(const Glib::ustring& name, const iterator& where)
1365 {
1366   gtk_text_buffer_move_mark_by_name(gobj(), name.c_str(), (where).gobj());
1367 }
1368
1369 void TextBuffer::delete_mark_by_name(const Glib::ustring& name)
1370 {
1371   gtk_text_buffer_delete_mark_by_name(gobj(), name.c_str());
1372 }
1373
1374 Glib::RefPtr<TextBuffer::Mark> TextBuffer::get_insert()
1375 {
1376
1377   Glib::RefPtr<TextBuffer::Mark> retvalue = Glib::wrap(gtk_text_buffer_get_insert(gobj()));
1378
1379   if(retvalue)
1380     retvalue->reference(); //The function does not do a ref for us.
1381   return retvalue;
1382 }
1383
1384 Glib::RefPtr<TextBuffer::Mark> TextBuffer::get_selection_bound()
1385 {
1386
1387   Glib::RefPtr<TextBuffer::Mark> retvalue = Glib::wrap(gtk_text_buffer_get_selection_bound(gobj()));
1388
1389   if(retvalue)
1390     retvalue->reference(); //The function does not do a ref for us.
1391   return retvalue;
1392 }
1393
1394 void TextBuffer::place_cursor(const iterator& where)
1395 {
1396   gtk_text_buffer_place_cursor(gobj(), (where).gobj());
1397 }
1398
1399 void TextBuffer::apply_tag(const Glib::RefPtr<Tag>& tag, const iterator& start, const iterator& end)
1400 {
1401   gtk_text_buffer_apply_tag(gobj(), Glib::unwrap(tag), (start).gobj(), (end).gobj());
1402 }
1403
1404 void TextBuffer::remove_tag(const Glib::RefPtr<Tag>& tag, const iterator& start, const iterator& end)
1405 {
1406   gtk_text_buffer_remove_tag(gobj(), Glib::unwrap(tag), (start).gobj(), (end).gobj());
1407 }
1408
1409 void TextBuffer::apply_tag_by_name(const Glib::ustring& name, const iterator& start, const iterator& end)
1410 {
1411   gtk_text_buffer_apply_tag_by_name(gobj(), name.c_str(), (start).gobj(), (end).gobj());
1412 }
1413
1414 void TextBuffer::remove_tag_by_name(const Glib::ustring& name, const iterator& start, const iterator& end)
1415 {
1416   gtk_text_buffer_remove_tag_by_name(gobj(), name.c_str(), (start).gobj(), (end).gobj());
1417 }
1418
1419 void TextBuffer::remove_all_tags(const iterator& start, const iterator& end)
1420 {
1421   gtk_text_buffer_remove_all_tags(gobj(), (start).gobj(), (end).gobj());
1422 }
1423
1424 bool TextBuffer::get_modified() const
1425 {
1426   return gtk_text_buffer_get_modified(const_cast<GtkTextBuffer*>(gobj()));
1427 }
1428
1429 void TextBuffer::set_modified(bool setting)
1430 {
1431   gtk_text_buffer_set_modified(gobj(), static_cast<int>(setting));
1432 }
1433
1434 void TextBuffer::add_selection_clipboard(const Glib::RefPtr<Clipboard>& clipboard)
1435 {
1436   gtk_text_buffer_add_selection_clipboard(gobj(), Glib::unwrap(clipboard));
1437 }
1438
1439 void TextBuffer::remove_selection_clipboard(const Glib::RefPtr<Clipboard>& clipboard)
1440 {
1441   gtk_text_buffer_remove_selection_clipboard(gobj(), Glib::unwrap(clipboard));
1442 }
1443
1444 void TextBuffer::cut_clipboard(const Glib::RefPtr<Clipboard>& clipboard, bool default_editable)
1445 {
1446   gtk_text_buffer_cut_clipboard(gobj(), Glib::unwrap(clipboard), static_cast<int>(default_editable));
1447 }
1448
1449 void TextBuffer::copy_clipboard(const Glib::RefPtr<Clipboard>& clipboard)
1450 {
1451   gtk_text_buffer_copy_clipboard(gobj(), Glib::unwrap(clipboard));
1452 }
1453
1454 bool TextBuffer::get_selection_bounds(iterator& start, iterator& end) const
1455 {
1456   return gtk_text_buffer_get_selection_bounds(const_cast<GtkTextBuffer*>(gobj()), (start).gobj(), (end).gobj());
1457 }
1458
1459 bool TextBuffer::erase_selection(bool interactive, bool default_editable)
1460 {
1461   return gtk_text_buffer_delete_selection(gobj(), static_cast<int>(interactive), static_cast<int>(default_editable));
1462 }
1463
1464 void TextBuffer::select_range(const iterator& ins, const iterator& bound)
1465 {
1466   gtk_text_buffer_select_range(gobj(), (ins).gobj(), (bound).gobj());
1467 }
1468
1469 void TextBuffer::begin_user_action()
1470 {
1471   gtk_text_buffer_begin_user_action(gobj());
1472 }
1473
1474 void TextBuffer::end_user_action()
1475 {
1476   gtk_text_buffer_end_user_action(gobj());
1477 }
1478
1479
1480 Glib::SignalProxy3< void,const TextBuffer::iterator&,const Glib::ustring&,int > TextBuffer::signal_insert()
1481 {
1482   return Glib::SignalProxy3< void,const TextBuffer::iterator&,const Glib::ustring&,int >(this, &TextBuffer_signal_insert_info);
1483 }
1484
1485 Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<Gdk::Pixbuf>& > TextBuffer::signal_insert_pixbuf()
1486 {
1487   return Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<Gdk::Pixbuf>& >(this, &TextBuffer_signal_insert_pixbuf_info);
1488 }
1489
1490 Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<ChildAnchor>& > TextBuffer::signal_insert_child_anchor()
1491 {
1492   return Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<ChildAnchor>& >(this, &TextBuffer_signal_insert_child_anchor_info);
1493 }
1494
1495 Glib::SignalProxy2< void,const TextBuffer::iterator&,const TextBuffer::iterator& > TextBuffer::signal_erase()
1496 {
1497   return Glib::SignalProxy2< void,const TextBuffer::iterator&,const TextBuffer::iterator& >(this, &TextBuffer_signal_erase_info);
1498 }
1499
1500 Glib::SignalProxy0< void > TextBuffer::signal_changed()
1501 {
1502   return Glib::SignalProxy0< void >(this, &TextBuffer_signal_changed_info);
1503 }
1504
1505 Glib::SignalProxy0< void > TextBuffer::signal_modified_changed()
1506 {
1507   return Glib::SignalProxy0< void >(this, &TextBuffer_signal_modified_changed_info);
1508 }
1509
1510 Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<TextBuffer::Mark>& > TextBuffer::signal_mark_set()
1511 {
1512   return Glib::SignalProxy2< void,const TextBuffer::iterator&,const Glib::RefPtr<TextBuffer::Mark>& >(this, &TextBuffer_signal_mark_set_info);
1513 }
1514
1515 Glib::SignalProxy1< void,const Glib::RefPtr<TextBuffer::Mark>& > TextBuffer::signal_mark_deleted()
1516 {
1517   return Glib::SignalProxy1< void,const Glib::RefPtr<TextBuffer::Mark>& >(this, &TextBuffer_signal_mark_deleted_info);
1518 }
1519
1520 Glib::SignalProxy3< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& > TextBuffer::signal_apply_tag()
1521 {
1522   return Glib::SignalProxy3< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& >(this, &TextBuffer_signal_apply_tag_info);
1523 }
1524
1525 Glib::SignalProxy3< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& > TextBuffer::signal_remove_tag()
1526 {
1527   return Glib::SignalProxy3< void,const Glib::RefPtr<TextBuffer::Tag>&,const TextBuffer::iterator&,const TextBuffer::iterator& >(this, &TextBuffer_signal_remove_tag_info);
1528 }
1529
1530 Glib::SignalProxy0< void > TextBuffer::signal_begin_user_action()
1531 {
1532   return Glib::SignalProxy0< void >(this, &TextBuffer_signal_begin_user_action_info);
1533 }
1534
1535 Glib::SignalProxy0< void > TextBuffer::signal_end_user_action()
1536 {
1537   return Glib::SignalProxy0< void >(this, &TextBuffer_signal_end_user_action_info);
1538 }
1539
1540
1541 void Gtk::TextBuffer::on_insert(const TextBuffer::iterator& pos, const Glib::ustring& text, int bytes)
1542 {
1543   BaseClassType *const base = static_cast<BaseClassType*>(
1544       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1545   );
1546
1547   if(base && base->insert_text)
1548     (*base->insert_text)(gobj(),const_cast<GtkTextIter*>((pos).gobj()),text.c_str(),bytes);
1549 }
1550
1551 void Gtk::TextBuffer::on_insert_pixbuf(const TextBuffer::iterator& pos, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
1552 {
1553   BaseClassType *const base = static_cast<BaseClassType*>(
1554       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1555   );
1556
1557   if(base && base->insert_pixbuf)
1558     (*base->insert_pixbuf)(gobj(),const_cast<GtkTextIter*>((pos).gobj()),Glib::unwrap(pixbuf));
1559 }
1560
1561 void Gtk::TextBuffer::on_insert_child_anchor(const TextBuffer::iterator& pos, const Glib::RefPtr<ChildAnchor>& anchor)
1562 {
1563   BaseClassType *const base = static_cast<BaseClassType*>(
1564       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1565   );
1566
1567   if(base && base->insert_child_anchor)
1568     (*base->insert_child_anchor)(gobj(),const_cast<GtkTextIter*>((pos).gobj()),Glib::unwrap(anchor));
1569 }
1570
1571 void Gtk::TextBuffer::on_erase(const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end)
1572 {
1573   BaseClassType *const base = static_cast<BaseClassType*>(
1574       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1575   );
1576
1577   if(base && base->delete_range)
1578     (*base->delete_range)(gobj(),const_cast<GtkTextIter*>((range_begin).gobj()),const_cast<GtkTextIter*>((range_end).gobj()));
1579 }
1580
1581 void Gtk::TextBuffer::on_changed()
1582 {
1583   BaseClassType *const base = static_cast<BaseClassType*>(
1584       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1585   );
1586
1587   if(base && base->changed)
1588     (*base->changed)(gobj());
1589 }
1590
1591 void Gtk::TextBuffer::on_modified_changed()
1592 {
1593   BaseClassType *const base = static_cast<BaseClassType*>(
1594       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1595   );
1596
1597   if(base && base->modified_changed)
1598     (*base->modified_changed)(gobj());
1599 }
1600
1601 void Gtk::TextBuffer::on_mark_set(const TextBuffer::iterator& location, const Glib::RefPtr<TextBuffer::Mark>& mark)
1602 {
1603   BaseClassType *const base = static_cast<BaseClassType*>(
1604       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1605   );
1606
1607   if(base && base->mark_set)
1608     (*base->mark_set)(gobj(),(location).gobj(),Glib::unwrap(mark));
1609 }
1610
1611 void Gtk::TextBuffer::on_mark_deleted(const Glib::RefPtr<TextBuffer::Mark>& mark)
1612 {
1613   BaseClassType *const base = static_cast<BaseClassType*>(
1614       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1615   );
1616
1617   if(base && base->mark_deleted)
1618     (*base->mark_deleted)(gobj(),Glib::unwrap(mark));
1619 }
1620
1621 void Gtk::TextBuffer::on_apply_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end)
1622 {
1623   BaseClassType *const base = static_cast<BaseClassType*>(
1624       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1625   );
1626
1627   if(base && base->apply_tag)
1628     (*base->apply_tag)(gobj(),Glib::unwrap(tag),(range_begin).gobj(),(range_end).gobj());
1629 }
1630
1631 void Gtk::TextBuffer::on_remove_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end)
1632 {
1633   BaseClassType *const base = static_cast<BaseClassType*>(
1634       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1635   );
1636
1637   if(base && base->remove_tag)
1638     (*base->remove_tag)(gobj(),Glib::unwrap(tag),(range_begin).gobj(),(range_end).gobj());
1639 }
1640
1641 void Gtk::TextBuffer::on_begin_user_action()
1642 {
1643   BaseClassType *const base = static_cast<BaseClassType*>(
1644       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1645   );
1646
1647   if(base && base->begin_user_action)
1648     (*base->begin_user_action)(gobj());
1649 }
1650
1651 void Gtk::TextBuffer::on_end_user_action()
1652 {
1653   BaseClassType *const base = static_cast<BaseClassType*>(
1654       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1655   );
1656
1657   if(base && base->end_user_action)
1658     (*base->end_user_action)(gobj());
1659 }
1660
1661
1662 } // namespace Gtk
1663
1664