1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/texttagtable.h>
4 #include <gtkmm/private/texttagtable_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
28 #include <gtkmm/texttag.h>
29 #include <gtk/gtktexttag.h>
30 #include <gtk/gtktexttagtable.h>
35 //This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
36 class SignalProxy_ForEach
39 typedef TextTagTable::SlotForEach SlotType;
41 SignalProxy_ForEach(const SlotType& slot);
42 ~SignalProxy_ForEach();
44 static void gtk_callback(GtkTextTag* texttag, gpointer data);
50 SignalProxy_ForEach::SignalProxy_ForEach(const SlotType& slot)
55 SignalProxy_ForEach::~SignalProxy_ForEach()
59 void SignalProxy_ForEach::gtk_callback(GtkTextTag* texttag, gpointer data)
61 SignalProxy_ForEach* pSignalProxy = static_cast<SignalProxy_ForEach*>(data);
64 //Use Slot::operator():
65 (pSignalProxy->slot_)(Glib::wrap(texttag, true)); //true = take_copy.
70 void TextTagTable::foreach(const SlotForEach& slot)
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);
83 void TextTagTable_signal_tag_changed_callback(GtkTextTagTable* self, GtkTextTag* p0,gboolean p1,void* data)
86 typedef sigc::slot< void,const Glib::RefPtr<TextTag>&,bool > SlotType;
88 // Do not try to call a signal on a disassociated wrapper.
89 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
93 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
94 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
100 Glib::exception_handlers_invoke();
105 const Glib::SignalProxyInfo TextTagTable_signal_tag_changed_info =
108 (GCallback) &TextTagTable_signal_tag_changed_callback,
109 (GCallback) &TextTagTable_signal_tag_changed_callback
113 void TextTagTable_signal_tag_added_callback(GtkTextTagTable* self, GtkTextTag* p0,void* data)
116 typedef sigc::slot< void,const Glib::RefPtr<TextTag>& > SlotType;
118 // Do not try to call a signal on a disassociated wrapper.
119 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
123 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
124 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
129 Glib::exception_handlers_invoke();
134 const Glib::SignalProxyInfo TextTagTable_signal_tag_added_info =
137 (GCallback) &TextTagTable_signal_tag_added_callback,
138 (GCallback) &TextTagTable_signal_tag_added_callback
142 void TextTagTable_signal_tag_removed_callback(GtkTextTagTable* self, GtkTextTag* p0,void* data)
145 typedef sigc::slot< void,const Glib::RefPtr<TextTag>& > SlotType;
147 // Do not try to call a signal on a disassociated wrapper.
148 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
152 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
153 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
158 Glib::exception_handlers_invoke();
163 const Glib::SignalProxyInfo TextTagTable_signal_tag_removed_info =
166 (GCallback) &TextTagTable_signal_tag_removed_callback,
167 (GCallback) &TextTagTable_signal_tag_removed_callback
170 } // anonymous namespace
176 Glib::RefPtr<Gtk::TextTagTable> wrap(GtkTextTagTable* object, bool take_copy)
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.
182 } /* namespace Glib */
189 /* The *_Class implementation: */
191 const Glib::Class& TextTagTable_Class::init()
193 if(!gtype_) // create the GType if necessary
195 // Glib::Class has to know the class init function to clone custom types.
196 class_init_func_ = &TextTagTable_Class::class_init_function;
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();
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());
205 // Add derived versions of interfaces, if the C type implements any interfaces:
211 void TextTagTable_Class::class_init_function(void* g_class, void* class_data)
213 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
214 CppClassParent::class_init_function(klass, class_data);
216 klass->tag_changed = &tag_changed_callback;
217 klass->tag_added = &tag_added_callback;
218 klass->tag_removed = &tag_removed_callback;
222 void TextTagTable_Class::tag_changed_callback(GtkTextTagTable* self, GtkTextTag* p0, gboolean p1)
224 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
225 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
232 if(obj && obj->is_derived_())
234 try // Trap C++ exceptions which would normally be lost because this is a C callback.
236 // Call the virtual member method, which derived classes might override.
237 obj->on_tag_changed(Glib::wrap(p0, true)
243 Glib::exception_handlers_invoke();
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).
252 // Call the original underlying C function:
253 if(base && base->tag_changed)
254 (*base->tag_changed)(self, p0, p1);
258 void TextTagTable_Class::tag_added_callback(GtkTextTagTable* self, GtkTextTag* p0)
260 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
261 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
268 if(obj && obj->is_derived_())
270 try // Trap C++ exceptions which would normally be lost because this is a C callback.
272 // Call the virtual member method, which derived classes might override.
273 obj->on_tag_added(Glib::wrap(p0, true)
278 Glib::exception_handlers_invoke();
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).
287 // Call the original underlying C function:
288 if(base && base->tag_added)
289 (*base->tag_added)(self, p0);
293 void TextTagTable_Class::tag_removed_callback(GtkTextTagTable* self, GtkTextTag* p0)
295 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
296 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
303 if(obj && obj->is_derived_())
305 try // Trap C++ exceptions which would normally be lost because this is a C callback.
307 // Call the virtual member method, which derived classes might override.
308 obj->on_tag_removed(Glib::wrap(p0, true)
313 Glib::exception_handlers_invoke();
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).
322 // Call the original underlying C function:
323 if(base && base->tag_removed)
324 (*base->tag_removed)(self, p0);
329 Glib::ObjectBase* TextTagTable_Class::wrap_new(GObject* object)
331 return new TextTagTable((GtkTextTagTable*)object);
335 /* The implementation: */
337 GtkTextTagTable* TextTagTable::gobj_copy()
343 TextTagTable::TextTagTable(const Glib::ConstructParams& construct_params)
345 Glib::Object(construct_params)
348 TextTagTable::TextTagTable(GtkTextTagTable* castitem)
350 Glib::Object((GObject*)(castitem))
353 TextTagTable::~TextTagTable()
357 TextTagTable::CppClassType TextTagTable::texttagtable_class_; // initialize static member
359 GType TextTagTable::get_type()
361 return texttagtable_class_.init().get_type();
364 GType TextTagTable::get_base_type()
366 return gtk_text_tag_table_get_type();
370 TextTagTable::TextTagTable()
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()))
377 Glib::RefPtr<TextTagTable> TextTagTable::create()
379 return Glib::RefPtr<TextTagTable>( new TextTagTable() );
381 void TextTagTable::add(const Glib::RefPtr<TextTag>& tag)
383 gtk_text_tag_table_add(gobj(), Glib::unwrap(tag));
386 void TextTagTable::remove(const Glib::RefPtr<TextTag>& tag)
388 gtk_text_tag_table_remove(gobj(), Glib::unwrap(tag));
391 Glib::RefPtr<TextTag> TextTagTable::lookup(const Glib::ustring& name)
394 Glib::RefPtr<TextTag> retvalue = Glib::wrap(gtk_text_tag_table_lookup(gobj(), name.c_str()));
397 retvalue->reference(); //The function does not do a ref for us.
401 Glib::RefPtr<const TextTag> TextTagTable::lookup(const Glib::ustring& name) const
404 Glib::RefPtr<const TextTag> retvalue = Glib::wrap(gtk_text_tag_table_lookup(const_cast<GtkTextTagTable*>(gobj()), name.c_str()));
407 retvalue->reference(); //The function does not do a ref for us.
411 int TextTagTable::get_size() const
413 return gtk_text_tag_table_get_size(const_cast<GtkTextTagTable*>(gobj()));
417 Glib::SignalProxy2< void,const Glib::RefPtr<TextTag>&,bool > TextTagTable::signal_tag_changed()
419 return Glib::SignalProxy2< void,const Glib::RefPtr<TextTag>&,bool >(this, &TextTagTable_signal_tag_changed_info);
422 Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& > TextTagTable::signal_tag_added()
424 return Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& >(this, &TextTagTable_signal_tag_added_info);
427 Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& > TextTagTable::signal_tag_removed()
429 return Glib::SignalProxy1< void,const Glib::RefPtr<TextTag>& >(this, &TextTagTable_signal_tag_removed_info);
433 void Gtk::TextTagTable::on_tag_changed(const Glib::RefPtr<TextTag>& tag, bool size_changed)
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).
439 if(base && base->tag_changed)
440 (*base->tag_changed)(gobj(),Glib::unwrap(tag),static_cast<int>(size_changed));
443 void Gtk::TextTagTable::on_tag_added(const Glib::RefPtr<TextTag>& tag)
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).
449 if(base && base->tag_added)
450 (*base->tag_added)(gobj(),Glib::unwrap(tag));
453 void Gtk::TextTagTable::on_tag_removed(const Glib::RefPtr<TextTag>& tag)
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).
459 if(base && base->tag_removed)
460 (*base->tag_removed)(gobj(),Glib::unwrap(tag));