rollback to 3428, before the mysterious removal of libs/* at 3431/3432
[ardour.git] / libs / gtkmm2 / atk / atkmm / hypertext.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <atkmm/hypertext.h>
5 #include <atkmm/private/hypertext_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright 2003 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <atkmm/object.h>
28 #include <atk/atkhypertext.h>
29
30
31 namespace Atk
32 {
33
34
35 } // namespace Atk
36
37
38 namespace
39 {
40
41
42 static void Hypertext_signal_link_selected_callback(AtkHypertext* self, gint p0,void* data)
43 {
44   using namespace Atk;
45   typedef sigc::slot< void,int > SlotType;
46
47   // Do not try to call a signal on a disassociated wrapper.
48   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
49   {
50     #ifdef GLIBMM_EXCEPTIONS_ENABLED
51     try
52     {
53     #endif //GLIBMM_EXCEPTIONS_ENABLED
54       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
55         (*static_cast<SlotType*>(slot))(p0
56 );
57     #ifdef GLIBMM_EXCEPTIONS_ENABLED
58     }
59     catch(...)
60     {
61       Glib::exception_handlers_invoke();
62     }
63     #endif //GLIBMM_EXCEPTIONS_ENABLED
64   }
65 }
66
67 static const Glib::SignalProxyInfo Hypertext_signal_link_selected_info =
68 {
69   "link_selected",
70   (GCallback) &Hypertext_signal_link_selected_callback,
71   (GCallback) &Hypertext_signal_link_selected_callback
72 };
73
74
75 } // anonymous namespace
76
77
78 namespace Glib
79 {
80
81 Glib::RefPtr<Atk::Hypertext> wrap(AtkHypertext* object, bool take_copy)
82 {
83   return Glib::RefPtr<Atk::Hypertext>( dynamic_cast<Atk::Hypertext*> (Glib::wrap_auto_interface<Atk::Hypertext> ((GObject*)(object), take_copy)) );
84   //We use dynamic_cast<> in case of multiple inheritance.
85 }
86
87 } // namespace Glib
88
89
90 namespace Atk
91 {
92
93
94 /* The *_Class implementation: */
95
96 const Glib::Interface_Class& Hypertext_Class::init()
97 {
98   if(!gtype_) // create the GType if necessary
99   {
100     // Glib::Interface_Class has to know the interface init function
101     // in order to add interfaces to implementing types.
102     class_init_func_ = &Hypertext_Class::iface_init_function;
103
104     // We can not derive from another interface, and it is not necessary anyway.
105     gtype_ = atk_hypertext_get_type();
106   }
107
108   return *this;
109 }
110
111 void Hypertext_Class::iface_init_function(void* g_iface, void*)
112 {
113   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
114
115   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
116   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
117   g_assert(klass != 0); 
118
119 #ifdef GLIBMM_VFUNCS_ENABLED
120   klass->get_link = &get_link_vfunc_callback;
121   klass->get_n_links = &get_n_links_vfunc_callback;
122   klass->get_link_index = &get_link_index_vfunc_callback;
123 #endif //GLIBMM_VFUNCS_ENABLED
124
125 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
126   klass->link_selected = &link_selected_callback;
127 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
128 }
129
130 #ifdef GLIBMM_VFUNCS_ENABLED
131 AtkHyperlink* Hypertext_Class::get_link_vfunc_callback(AtkHypertext* self, gint link_index)
132 {
133   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
134       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
135
136   // Non-gtkmmproc-generated custom classes implicitly call the default
137   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
138   // generated classes can use this optimisation, which avoids the unnecessary
139   // parameter conversions if there is no possibility of the virtual function
140   // being overridden:
141   if(obj_base && obj_base->is_derived_())
142   {
143     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
144     if(obj) // This can be NULL during destruction.
145     {
146       #ifdef GLIBMM_EXCEPTIONS_ENABLED
147       try // Trap C++ exceptions which would normally be lost because this is a C callback.
148       {
149       #endif //GLIBMM_EXCEPTIONS_ENABLED
150         // Call the virtual member method, which derived classes might override.
151         return Glib::unwrap(obj->get_link_vfunc(link_index
152 ));
153       #ifdef GLIBMM_EXCEPTIONS_ENABLED
154       }
155       catch(...)
156       {
157         Glib::exception_handlers_invoke();
158       }
159       #endif //GLIBMM_EXCEPTIONS_ENABLED
160     }
161   }
162   
163   BaseClassType *const base = static_cast<BaseClassType*>(
164       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
165 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
166 )  );
167
168   // Call the original underlying C function:
169   if(base && base->get_link)
170     return (*base->get_link)(self, link_index);
171
172
173   typedef AtkHyperlink* RType;
174   return RType();
175 }
176 gint Hypertext_Class::get_n_links_vfunc_callback(AtkHypertext* self)
177 {
178   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
179       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
180
181   // Non-gtkmmproc-generated custom classes implicitly call the default
182   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
183   // generated classes can use this optimisation, which avoids the unnecessary
184   // parameter conversions if there is no possibility of the virtual function
185   // being overridden:
186   if(obj_base && obj_base->is_derived_())
187   {
188     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
189     if(obj) // This can be NULL during destruction.
190     {
191       #ifdef GLIBMM_EXCEPTIONS_ENABLED
192       try // Trap C++ exceptions which would normally be lost because this is a C callback.
193       {
194       #endif //GLIBMM_EXCEPTIONS_ENABLED
195         // Call the virtual member method, which derived classes might override.
196         return obj->get_n_links_vfunc();
197       #ifdef GLIBMM_EXCEPTIONS_ENABLED
198       }
199       catch(...)
200       {
201         Glib::exception_handlers_invoke();
202       }
203       #endif //GLIBMM_EXCEPTIONS_ENABLED
204     }
205   }
206   
207   BaseClassType *const base = static_cast<BaseClassType*>(
208       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
209 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
210 )  );
211
212   // Call the original underlying C function:
213   if(base && base->get_n_links)
214     return (*base->get_n_links)(self);
215
216
217   typedef gint RType;
218   return RType();
219 }
220 gint Hypertext_Class::get_link_index_vfunc_callback(AtkHypertext* self, gint char_index)
221 {
222   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
223       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
224
225   // Non-gtkmmproc-generated custom classes implicitly call the default
226   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
227   // generated classes can use this optimisation, which avoids the unnecessary
228   // parameter conversions if there is no possibility of the virtual function
229   // being overridden:
230   if(obj_base && obj_base->is_derived_())
231   {
232     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
233     if(obj) // This can be NULL during destruction.
234     {
235       #ifdef GLIBMM_EXCEPTIONS_ENABLED
236       try // Trap C++ exceptions which would normally be lost because this is a C callback.
237       {
238       #endif //GLIBMM_EXCEPTIONS_ENABLED
239         // Call the virtual member method, which derived classes might override.
240         return obj->get_link_index_vfunc(char_index
241 );
242       #ifdef GLIBMM_EXCEPTIONS_ENABLED
243       }
244       catch(...)
245       {
246         Glib::exception_handlers_invoke();
247       }
248       #endif //GLIBMM_EXCEPTIONS_ENABLED
249     }
250   }
251   
252   BaseClassType *const base = static_cast<BaseClassType*>(
253       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
254 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
255 )  );
256
257   // Call the original underlying C function:
258   if(base && base->get_link_index)
259     return (*base->get_link_index)(self, char_index);
260
261
262   typedef gint RType;
263   return RType();
264 }
265 #endif //GLIBMM_VFUNCS_ENABLED
266
267 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
268 void Hypertext_Class::link_selected_callback(AtkHypertext* self, gint p0)
269 {
270   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
271       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
272
273   // Non-gtkmmproc-generated custom classes implicitly call the default
274   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
275   // generated classes can use this optimisation, which avoids the unnecessary
276   // parameter conversions if there is no possibility of the virtual function
277   // being overridden:
278   if(obj_base && obj_base->is_derived_())
279   {
280     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
281     if(obj) // This can be NULL during destruction.
282     {
283       #ifdef GLIBMM_EXCEPTIONS_ENABLED
284       try // Trap C++ exceptions which would normally be lost because this is a C callback.
285       {
286       #endif //GLIBMM_EXCEPTIONS_ENABLED
287         // Call the virtual member method, which derived classes might override.
288         obj->on_link_selected(p0
289 );
290         return;
291       #ifdef GLIBMM_EXCEPTIONS_ENABLED
292       }
293       catch(...)
294       {
295         Glib::exception_handlers_invoke();
296       }
297       #endif //GLIBMM_EXCEPTIONS_ENABLED
298     }
299   }
300   
301   BaseClassType *const base = static_cast<BaseClassType*>(
302         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
303 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
304 )    );
305
306   // Call the original underlying C function:
307   if(base && base->link_selected)
308     (*base->link_selected)(self, p0);
309 }
310 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
311
312
313 Glib::ObjectBase* Hypertext_Class::wrap_new(GObject* object)
314 {
315   return new Hypertext((AtkHypertext*)(object));
316 }
317
318
319 /* The implementation: */
320
321 Hypertext::Hypertext()
322 :
323   Glib::Interface(hypertext_class_.init())
324 {}
325
326 Hypertext::Hypertext(AtkHypertext* castitem)
327 :
328   Glib::Interface((GObject*)(castitem))
329 {}
330
331 Hypertext::~Hypertext()
332 {}
333
334 // static
335 void Hypertext::add_interface(GType gtype_implementer)
336 {
337   hypertext_class_.init().add_interface(gtype_implementer);
338 }
339
340 Hypertext::CppClassType Hypertext::hypertext_class_; // initialize static member
341
342 GType Hypertext::get_type()
343 {
344   return hypertext_class_.init().get_type();
345 }
346
347 GType Hypertext::get_base_type()
348 {
349   return atk_hypertext_get_type();
350 }
351
352
353 Glib::RefPtr<Hyperlink> Hypertext::get_link(int link_index)
354 {
355   return Glib::wrap(atk_hypertext_get_link(gobj(), link_index));
356 }
357
358 Glib::RefPtr<const Hyperlink> Hypertext::get_link(int link_index) const
359 {
360   return const_cast<Hypertext*>(this)->get_link(link_index);
361 }
362
363 int Hypertext::get_n_links() const
364 {
365   return atk_hypertext_get_n_links(const_cast<AtkHypertext*>(gobj()));
366 }
367
368 int Hypertext::get_link_index(int char_index) const
369 {
370   return atk_hypertext_get_link_index(const_cast<AtkHypertext*>(gobj()), char_index);
371 }
372
373
374 Glib::SignalProxy1< void,int > Hypertext::signal_link_selected()
375 {
376   return Glib::SignalProxy1< void,int >(this, &Hypertext_signal_link_selected_info);
377 }
378
379
380 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
381 void Atk::Hypertext::on_link_selected(int link_index)
382 {
383   BaseClassType *const base = static_cast<BaseClassType*>(
384       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
385 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
386 )  );
387
388   if(base && base->link_selected)
389     (*base->link_selected)(gobj(),link_index);
390 }
391 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
392
393 #ifdef GLIBMM_VFUNCS_ENABLED
394 Glib::RefPtr<Hyperlink> Atk::Hypertext::get_link_vfunc(int link_index) 
395 {
396   BaseClassType *const base = static_cast<BaseClassType*>(
397       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
398 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
399 )  );
400
401   if(base && base->get_link)
402     return Glib::wrap((*base->get_link)(gobj(),link_index));
403
404   typedef Glib::RefPtr<Hyperlink> RType;
405   return RType();
406 }
407 int Atk::Hypertext::get_n_links_vfunc() const
408 {
409   BaseClassType *const base = static_cast<BaseClassType*>(
410       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
411 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
412 )  );
413
414   if(base && base->get_n_links)
415     return (*base->get_n_links)(const_cast<AtkHypertext*>(gobj()));
416
417   typedef int RType;
418   return RType();
419 }
420 int Atk::Hypertext::get_link_index_vfunc(int char_index) const
421 {
422   BaseClassType *const base = static_cast<BaseClassType*>(
423       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
424 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
425 )  );
426
427   if(base && base->get_link_index)
428     return (*base->get_link_index)(const_cast<AtkHypertext*>(gobj()),char_index);
429
430   typedef int RType;
431   return RType();
432 }
433 #endif //GLIBMM_VFUNCS_ENABLED
434
435
436 } // namespace Atk
437
438