Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / texttagtable.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/texttagtable.h>
4 #include <gtkmm/private/texttagtable_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; if not, write to the Free
25  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27
28 #include <gtkmm/texttag.h>
29 #include <gtk/gtktexttag.h>
30 #include <gtk/gtktexttagtable.h>
31
32 namespace Gtk
33 {
34
35 //This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
36 class SignalProxy_ForEach
37 {
38 public:
39   typedef TextTagTable::SlotForEach SlotType;
40
41   SignalProxy_ForEach(const SlotType& slot);
42   ~SignalProxy_ForEach();
43
44   static void gtk_callback(GtkTextTag* texttag, gpointer data);
45
46 protected:
47   SlotType slot_;
48 };
49
50 SignalProxy_ForEach::SignalProxy_ForEach(const SlotType& slot)
51 {
52   slot_ = slot;
53 }
54
55 SignalProxy_ForEach::~SignalProxy_ForEach()
56 {
57 }
58
59 void SignalProxy_ForEach::gtk_callback(GtkTextTag* texttag, gpointer data)
60 {
61   SignalProxy_ForEach* pSignalProxy = static_cast<SignalProxy_ForEach*>(data);
62   if(pSignalProxy)
63   {
64     //Use Slot::operator():
65     (pSignalProxy->slot_)(Glib::wrap(texttag, true)); //true = take_copy.
66   }
67 }
68
69
70 void TextTagTable::foreach(const SlotForEach& slot)
71 {
72   SignalProxy_ForEach proxy(slot); //It doesn't need to exist for longer than the function call.
73   gtk_text_tag_table_foreach(gobj(),  &SignalProxy_ForEach::gtk_callback, (gpointer)&proxy);
74 }
75
76
77 } /* namespace Gtk */
78
79
80 namespace
81 {
82
83 void TextTagTable_signal_tag_changed_callback(GtkTextTagTable* self, GtkTextTag* p0,gboolean p1,void* data)
84 {
85   using namespace Gtk;
86   typedef sigc::slot< void,const Glib::RefPtr<TextTag>&,bool > SlotType;
87
88   // Do not try to call a signal on a disassociated wrapper.
89   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
90   {
91     try
92     {
93       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
94         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
95 , p1
96 );
97     }
98     catch(...)
99     {
100       Glib::exception_handlers_invoke();
101     }
102   }
103 }
104
105 const Glib::SignalProxyInfo TextTagTable_signal_tag_changed_info =
106 {
107   "tag_changed",
108   (GCallback) &TextTagTable_signal_tag_changed_callback,
109   (GCallback) &TextTagTable_signal_tag_changed_callback
110 };
111
112
113 void TextTagTable_signal_tag_added_callback(GtkTextTagTable* self, GtkTextTag* p0,void* data)
114 {
115   using namespace Gtk;
116   typedef sigc::slot< void,const Glib::RefPtr<TextTag>& > SlotType;
117
118   // Do not try to call a signal on a disassociated wrapper.
119   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
120   {
121     try
122     {
123       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
124         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
125 );
126     }
127     catch(...)
128     {
129       Glib::exception_handlers_invoke();
130     }
131   }
132 }
133
134 const Glib::SignalProxyInfo TextTagTable_signal_tag_added_info =
135 {
136   "tag_added",
137   (GCallback) &TextTagTable_signal_tag_added_callback,
138   (GCallback) &TextTagTable_signal_tag_added_callback
139 };
140
141
142 void TextTagTable_signal_tag_removed_callback(GtkTextTagTable* self, GtkTextTag* p0,void* data)
143 {
144   using namespace Gtk;
145   typedef sigc::slot< void,const Glib::RefPtr<TextTag>& > SlotType;
146
147   // Do not try to call a signal on a disassociated wrapper.
148   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
149   {
150     try
151     {
152       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
153         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
154 );
155     }
156     catch(...)
157     {
158       Glib::exception_handlers_invoke();
159     }
160   }
161 }
162
163 const Glib::SignalProxyInfo TextTagTable_signal_tag_removed_info =
164 {
165   "tag_removed",
166   (GCallback) &TextTagTable_signal_tag_removed_callback,
167   (GCallback) &TextTagTable_signal_tag_removed_callback
168 };
169
170 } // anonymous namespace
171
172
173 namespace Glib
174 {
175
176 Glib::RefPtr<Gtk::TextTagTable> wrap(GtkTextTagTable* object, bool take_copy)
177 {
178   return Glib::RefPtr<Gtk::TextTagTable>( dynamic_cast<Gtk::TextTagTable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
179   //We use dynamic_cast<> in case of multiple inheritance.
180 }
181
182 } /* namespace Glib */
183
184
185 namespace Gtk
186 {
187
188
189 /* The *_Class implementation: */
190
191 const Glib::Class& TextTagTable_Class::init()
192 {
193   if(!gtype_) // create the GType if necessary
194   {
195     // Glib::Class has to know the class init function to clone custom types.
196     class_init_func_ = &TextTagTable_Class::class_init_function;
197
198     // This is actually just optimized away, apparently with no harm.
199     // Make sure that the parent type has been created.
200     //CppClassParent::CppObjectType::get_type();
201
202     // Create the wrapper type, with the same class/instance size as the base type.
203     register_derived_type(gtk_text_tag_table_get_type());
204
205     // Add derived versions of interfaces, if the C type implements any interfaces:
206   }
207
208   return *this;
209 }
210
211 void TextTagTable_Class::class_init_function(void* g_class, void* class_data)
212 {
213   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
214   CppClassParent::class_init_function(klass, class_data);
215
216   klass->tag_changed = &tag_changed_callback;
217   klass->tag_added = &tag_added_callback;
218   klass->tag_removed = &tag_removed_callback;
219 }
220
221
222 void TextTagTable_Class::tag_changed_callback(GtkTextTagTable* self, GtkTextTag* p0, gboolean p1)
223 {
224   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
225       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
226
227   // Non-gtkmmproc-generated custom classes implicitly call the default
228   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
229   // generated classes can use this optimisation, which avoids the unnecessary
230   // parameter conversions if there is no possibility of the virtual function
231   // being overridden:
232   if(obj && obj->is_derived_())
233   {
234     try // Trap C++ exceptions which would normally be lost because this is a C callback.
235     {
236       // Call the virtual member method, which derived classes might override.
237       obj->on_tag_changed(Glib::wrap(p0, true)
238 , p1
239 );
240     }
241     catch(...)
242     {
243       Glib::exception_handlers_invoke();
244     }
245   }
246   else
247   {
248     BaseClassType *const base = static_cast<BaseClassType*>(
249         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
250     );
251
252     // Call the original underlying C function:
253     if(base && base->tag_changed)
254       (*base->tag_changed)(self, p0, p1);
255   }
256 }
257
258 void TextTagTable_Class::tag_added_callback(GtkTextTagTable* self, GtkTextTag* p0)
259 {
260   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
261       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
262
263   // Non-gtkmmproc-generated custom classes implicitly call the default
264   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
265   // generated classes can use this optimisation, which avoids the unnecessary
266   // parameter conversions if there is no possibility of the virtual function
267   // being overridden:
268   if(obj && obj->is_derived_())
269   {
270     try // Trap C++ exceptions which would normally be lost because this is a C callback.
271     {
272       // Call the virtual member method, which derived classes might override.
273       obj->on_tag_added(Glib::wrap(p0, true)
274 );
275     }
276     catch(...)
277     {
278       Glib::exception_handlers_invoke();
279     }
280   }
281   else
282   {
283     BaseClassType *const base = static_cast<BaseClassType*>(
284         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
285     );
286
287     // Call the original underlying C function:
288     if(base && base->tag_added)
289       (*base->tag_added)(self, p0);
290   }
291 }
292
293 void TextTagTable_Class::tag_removed_callback(GtkTextTagTable* self, GtkTextTag* p0)
294 {
295   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
296       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
297
298   // Non-gtkmmproc-generated custom classes implicitly call the default
299   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
300   // generated classes can use this optimisation, which avoids the unnecessary
301   // parameter conversions if there is no possibility of the virtual function
302   // being overridden:
303   if(obj && obj->is_derived_())
304   {
305     try // Trap C++ exceptions which would normally be lost because this is a C callback.
306     {
307       // Call the virtual member method, which derived classes might override.
308       obj->on_tag_removed(Glib::wrap(p0, true)
309 );
310     }
311     catch(...)
312     {
313       Glib::exception_handlers_invoke();
314     }
315   }
316   else
317   {
318     BaseClassType *const base = static_cast<BaseClassType*>(
319         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
320     );
321
322     // Call the original underlying C function:
323     if(base && base->tag_removed)
324       (*base->tag_removed)(self, p0);
325   }
326 }
327
328
329 Glib::ObjectBase* TextTagTable_Class::wrap_new(GObject* object)
330 {
331   return new TextTagTable((GtkTextTagTable*)object);
332 }
333
334
335 /* The implementation: */
336
337 GtkTextTagTable* TextTagTable::gobj_copy()
338 {
339   reference();
340   return gobj();
341 }
342
343 TextTagTable::TextTagTable(const Glib::ConstructParams& construct_params)
344 :
345   Glib::Object(construct_params)
346 {}
347
348 TextTagTable::TextTagTable(GtkTextTagTable* castitem)
349 :
350   Glib::Object((GObject*)(castitem))
351 {}
352
353 TextTagTable::~TextTagTable()
354 {}
355
356
357 TextTagTable::CppClassType TextTagTable::texttagtable_class_; // initialize static member
358
359 GType TextTagTable::get_type()
360 {
361   return texttagtable_class_.init().get_type();
362 }
363
364 GType TextTagTable::get_base_type()
365 {
366   return gtk_text_tag_table_get_type();
367 }
368
369
370 TextTagTable::TextTagTable()
371 :
372   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
373   Glib::Object(Glib::ConstructParams(texttagtable_class_.init()))
374 {
375   }
376
377 Glib::RefPtr<TextTagTable> TextTagTable::create()
378 {
379   return Glib::RefPtr<TextTagTable>( new TextTagTable() );
380 }
381 void TextTagTable::add(const Glib::RefPtr<TextTag>& tag)
382 {
383   gtk_text_tag_table_add(gobj(), Glib::unwrap(tag));
384 }
385
386 void TextTagTable::remove(const Glib::RefPtr<TextTag>& tag)
387 {
388   gtk_text_tag_table_remove(gobj(), Glib::unwrap(tag));
389 }
390
391 Glib::RefPtr<TextTag> TextTagTable::lookup(const Glib::ustring& name)
392 {
393
394   Glib::RefPtr<TextTag> retvalue = Glib::wrap(gtk_text_tag_table_lookup(gobj(), name.c_str()));
395
396   if(retvalue)
397     retvalue->reference(); //The function does not do a ref for us.
398   return retvalue;
399 }
400
401 Glib::RefPtr<const TextTag> TextTagTable::lookup(const Glib::ustring& name) const
402 {
403
404   Glib::RefPtr<const TextTag> retvalue = Glib::wrap(gtk_text_tag_table_lookup(const_cast<GtkTextTagTable*>(gobj()), name.c_str()));
405
406   if(retvalue)
407     retvalue->reference(); //The function does not do a ref for us.
408   return retvalue;
409 }
410
411 int TextTagTable::get_size() const
412 {
413   return gtk_text_tag_table_get_size(const_cast<GtkTextTagTable*>(gobj()));
414 }
415
416
417 Glib::SignalProxy2< void,const Glib::RefPtr<TextTag>&,bool > TextTagTable::signal_tag_changed()
418 {
419   return Glib::SignalProxy2< void,const Glib::RefPtr<TextTag>&,bool >(this, &TextTagTable_signal_tag_changed_info);
420 }
421
422 Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& > TextTagTable::signal_tag_added()
423 {
424   return Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& >(this, &TextTagTable_signal_tag_added_info);
425 }
426
427 Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& > TextTagTable::signal_tag_removed()
428 {
429   return Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& >(this, &TextTagTable_signal_tag_removed_info);
430 }
431
432
433 void Gtk::TextTagTable::on_tag_changed(const Glib::RefPtr<TextTag>& tag, bool size_changed)
434 {
435   BaseClassType *const base = static_cast<BaseClassType*>(
436       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
437   );
438
439   if(base && base->tag_changed)
440     (*base->tag_changed)(gobj(),Glib::unwrap(tag),static_cast<int>(size_changed));
441 }
442
443 void Gtk::TextTagTable::on_tag_added(const Glib::RefPtr<TextTag>& tag)
444 {
445   BaseClassType *const base = static_cast<BaseClassType*>(
446       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
447   );
448
449   if(base && base->tag_added)
450     (*base->tag_added)(gobj(),Glib::unwrap(tag));
451 }
452
453 void Gtk::TextTagTable::on_tag_removed(const Glib::RefPtr<TextTag>& tag)
454 {
455   BaseClassType *const base = static_cast<BaseClassType*>(
456       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
457   );
458
459   if(base && base->tag_removed)
460     (*base->tag_removed)(gobj(),Glib::unwrap(tag));
461 }
462
463
464 } // namespace Gtk
465
466