1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <atkmm/hypertext.h>
4 #include <atkmm/private/hypertext_p.h>
9 /* Copyright 2003 The gtkmm Development Team
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.
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.
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.
26 #include <atkmm/object.h>
27 #include <atk/atkhypertext.h>
40 void Hypertext_signal_link_selected_callback(AtkHypertext* self, gint p0,void* data)
43 typedef sigc::slot< void,int > SlotType;
45 // Do not try to call a signal on a disassociated wrapper.
46 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
50 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
51 (*static_cast<SlotType*>(slot))(p0
56 Glib::exception_handlers_invoke();
61 const Glib::SignalProxyInfo Hypertext_signal_link_selected_info =
64 (GCallback) &Hypertext_signal_link_selected_callback,
65 (GCallback) &Hypertext_signal_link_selected_callback
68 } // anonymous namespace
74 Glib::RefPtr<Atk::Hypertext> wrap(AtkHypertext* object, bool take_copy)
76 return Glib::RefPtr<Atk::Hypertext>( dynamic_cast<Atk::Hypertext*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
77 //We use dynamic_cast<> in case of multiple inheritance.
87 /* The *_Class implementation: */
89 const Glib::Interface_Class& Hypertext_Class::init()
91 if(!gtype_) // create the GType if necessary
93 // Glib::Interface_Class has to know the interface init function
94 // in order to add interfaces to implementing types.
95 class_init_func_ = &Hypertext_Class::iface_init_function;
97 // We can not derive from another interface, and it is not necessary anyway.
98 gtype_ = atk_hypertext_get_type();
104 void Hypertext_Class::iface_init_function(void* g_iface, void*)
106 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
108 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
109 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
110 g_assert(klass != 0);
112 klass->get_link = &get_link_vfunc_callback;
113 klass->get_n_links = &get_n_links_vfunc_callback;
114 klass->get_link_index = &get_link_index_vfunc_callback;
115 klass->link_selected = &link_selected_callback;
118 AtkHyperlink* Hypertext_Class::get_link_vfunc_callback(AtkHypertext* self, gint link_index)
120 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
121 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
123 // Non-gtkmmproc-generated custom classes implicitly call the default
124 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
125 // generated classes can use this optimisation, which avoids the unnecessary
126 // parameter conversions if there is no possibility of the virtual function
128 if(obj && obj->is_derived_())
130 try // Trap C++ exceptions which would normally be lost because this is a C callback.
132 // Call the virtual member method, which derived classes might override.
133 return Glib::unwrap(obj->get_link_vfunc(link_index
138 Glib::exception_handlers_invoke();
143 BaseClassType *const base = static_cast<BaseClassType*>(
144 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
145 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
148 // Call the original underlying C function:
149 if(base && base->get_link)
150 return (*base->get_link)(self, link_index);
153 typedef AtkHyperlink* RType;
157 gint Hypertext_Class::get_n_links_vfunc_callback(AtkHypertext* self)
159 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
160 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
162 // Non-gtkmmproc-generated custom classes implicitly call the default
163 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
164 // generated classes can use this optimisation, which avoids the unnecessary
165 // parameter conversions if there is no possibility of the virtual function
167 if(obj && obj->is_derived_())
169 try // Trap C++ exceptions which would normally be lost because this is a C callback.
171 // Call the virtual member method, which derived classes might override.
172 return obj->get_n_links_vfunc();
176 Glib::exception_handlers_invoke();
181 BaseClassType *const base = static_cast<BaseClassType*>(
182 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
183 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
186 // Call the original underlying C function:
187 if(base && base->get_n_links)
188 return (*base->get_n_links)(self);
195 gint Hypertext_Class::get_link_index_vfunc_callback(AtkHypertext* self, gint char_index)
197 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
198 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
200 // Non-gtkmmproc-generated custom classes implicitly call the default
201 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
202 // generated classes can use this optimisation, which avoids the unnecessary
203 // parameter conversions if there is no possibility of the virtual function
205 if(obj && obj->is_derived_())
207 try // Trap C++ exceptions which would normally be lost because this is a C callback.
209 // Call the virtual member method, which derived classes might override.
210 return obj->get_link_index_vfunc(char_index
215 Glib::exception_handlers_invoke();
220 BaseClassType *const base = static_cast<BaseClassType*>(
221 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
222 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
225 // Call the original underlying C function:
226 if(base && base->get_link_index)
227 return (*base->get_link_index)(self, char_index);
235 void Hypertext_Class::link_selected_callback(AtkHypertext* self, gint p0)
237 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
238 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
240 // Non-gtkmmproc-generated custom classes implicitly call the default
241 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
242 // generated classes can use this optimisation, which avoids the unnecessary
243 // parameter conversions if there is no possibility of the virtual function
245 if(obj && obj->is_derived_())
247 try // Trap C++ exceptions which would normally be lost because this is a C callback.
249 // Call the virtual member method, which derived classes might override.
250 obj->on_link_selected(p0
255 Glib::exception_handlers_invoke();
260 BaseClassType *const base = static_cast<BaseClassType*>(
261 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
262 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
265 // Call the original underlying C function:
266 if(base && base->link_selected)
267 (*base->link_selected)(self, p0);
272 Glib::ObjectBase* Hypertext_Class::wrap_new(GObject* object)
274 return new Hypertext((AtkHypertext*)(object));
278 /* The implementation: */
280 Hypertext::Hypertext()
282 Glib::Interface(hypertext_class_.init())
285 Hypertext::Hypertext(AtkHypertext* castitem)
287 Glib::Interface((GObject*)(castitem))
290 Hypertext::~Hypertext()
294 void Hypertext::add_interface(GType gtype_implementer)
296 hypertext_class_.init().add_interface(gtype_implementer);
299 Hypertext::CppClassType Hypertext::hypertext_class_; // initialize static member
301 GType Hypertext::get_type()
303 return hypertext_class_.init().get_type();
306 GType Hypertext::get_base_type()
308 return atk_hypertext_get_type();
312 Glib::RefPtr<Hyperlink> Hypertext::get_link(int link_index)
314 return Glib::wrap(atk_hypertext_get_link(gobj(), link_index));
317 Glib::RefPtr<const Hyperlink> Hypertext::get_link(int link_index) const
319 return Glib::wrap(atk_hypertext_get_link(const_cast<AtkHypertext*>(gobj()), link_index));
322 int Hypertext::get_n_links() const
324 return atk_hypertext_get_n_links(const_cast<AtkHypertext*>(gobj()));
327 int Hypertext::get_link_index(int char_index) const
329 return atk_hypertext_get_link_index(const_cast<AtkHypertext*>(gobj()), char_index);
333 Glib::SignalProxy1< void,int > Hypertext::signal_link_selected()
335 return Glib::SignalProxy1< void,int >(this, &Hypertext_signal_link_selected_info);
339 void Atk::Hypertext::on_link_selected(int link_index)
341 BaseClassType *const base = static_cast<BaseClassType*>(
342 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
343 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
346 if(base && base->link_selected)
347 (*base->link_selected)(gobj(),link_index);
351 Glib::RefPtr<Hyperlink> Atk::Hypertext::get_link_vfunc(int link_index)
353 BaseClassType *const base = static_cast<BaseClassType*>(
354 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
355 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
358 if(base && base->get_link)
359 return Glib::wrap((*base->get_link)(gobj(),link_index));
361 typedef Glib::RefPtr<Hyperlink> RType;
365 int Atk::Hypertext::get_n_links_vfunc() const
367 BaseClassType *const base = static_cast<BaseClassType*>(
368 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
369 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
372 if(base && base->get_n_links)
373 return (*base->get_n_links)(const_cast<AtkHypertext*>(gobj()));
379 int Atk::Hypertext::get_link_index_vfunc(int char_index) const
381 BaseClassType *const base = static_cast<BaseClassType*>(
382 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
383 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
386 if(base && base->get_link_index)
387 return (*base->get_link_index)(const_cast<AtkHypertext*>(gobj()),char_index);