fix for type error on 64 bit systems
[ardour.git] / libs / gtkmm2 / atk / atkmm / hypertext.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <atkmm/hypertext.h>
4 #include <atkmm/private/hypertext_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 2003 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 <atkmm/object.h>
27 #include <atk/atkhypertext.h>
28
29
30 namespace Atk
31 {
32
33
34 } // namespace Atk
35
36
37 namespace
38 {
39
40 void Hypertext_signal_link_selected_callback(AtkHypertext* self, gint p0,void* data)
41 {
42   using namespace Atk;
43   typedef sigc::slot< void,int > SlotType;
44
45   // Do not try to call a signal on a disassociated wrapper.
46   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
47   {
48     try
49     {
50       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
51         (*static_cast<SlotType*>(slot))(p0
52 );
53     }
54     catch(...)
55     {
56       Glib::exception_handlers_invoke();
57     }
58   }
59 }
60
61 const Glib::SignalProxyInfo Hypertext_signal_link_selected_info =
62 {
63   "link_selected",
64   (GCallback) &Hypertext_signal_link_selected_callback,
65   (GCallback) &Hypertext_signal_link_selected_callback
66 };
67
68 } // anonymous namespace
69
70
71 namespace Glib
72 {
73
74 Glib::RefPtr<Atk::Hypertext> wrap(AtkHypertext* object, bool take_copy)
75 {
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.
78 }
79
80 } // namespace Glib
81
82
83 namespace Atk
84 {
85
86
87 /* The *_Class implementation: */
88
89 const Glib::Interface_Class& Hypertext_Class::init()
90 {
91   if(!gtype_) // create the GType if necessary
92   {
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;
96
97     // We can not derive from another interface, and it is not necessary anyway.
98     gtype_ = atk_hypertext_get_type();
99   }
100
101   return *this;
102 }
103
104 void Hypertext_Class::iface_init_function(void* g_iface, void*)
105 {
106   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
107
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); 
111
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;
116 }
117
118 AtkHyperlink* Hypertext_Class::get_link_vfunc_callback(AtkHypertext* self, gint link_index)
119 {
120   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
121       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
122
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
127   // being overridden:
128   if(obj && obj->is_derived_())
129   {
130     try // Trap C++ exceptions which would normally be lost because this is a C callback.
131     {
132       // Call the virtual member method, which derived classes might override.
133       return Glib::unwrap(obj->get_link_vfunc(link_index
134 ));
135     }
136     catch(...)
137     {
138       Glib::exception_handlers_invoke();
139     }
140   }
141   else
142   {
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.
146 )    );
147
148     // Call the original underlying C function:
149     if(base && base->get_link)
150       return (*base->get_link)(self, link_index);
151   }
152
153   typedef AtkHyperlink* RType;
154   return RType();
155 }
156
157 gint Hypertext_Class::get_n_links_vfunc_callback(AtkHypertext* self)
158 {
159   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
160       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
161
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
166   // being overridden:
167   if(obj && obj->is_derived_())
168   {
169     try // Trap C++ exceptions which would normally be lost because this is a C callback.
170     {
171       // Call the virtual member method, which derived classes might override.
172       return obj->get_n_links_vfunc();
173     }
174     catch(...)
175     {
176       Glib::exception_handlers_invoke();
177     }
178   }
179   else
180   {
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.
184 )    );
185
186     // Call the original underlying C function:
187     if(base && base->get_n_links)
188       return (*base->get_n_links)(self);
189   }
190
191   typedef gint RType;
192   return RType();
193 }
194
195 gint Hypertext_Class::get_link_index_vfunc_callback(AtkHypertext* self, gint char_index)
196 {
197   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
198       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
199
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
204   // being overridden:
205   if(obj && obj->is_derived_())
206   {
207     try // Trap C++ exceptions which would normally be lost because this is a C callback.
208     {
209       // Call the virtual member method, which derived classes might override.
210       return obj->get_link_index_vfunc(char_index
211 );
212     }
213     catch(...)
214     {
215       Glib::exception_handlers_invoke();
216     }
217   }
218   else
219   {
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.
223 )    );
224
225     // Call the original underlying C function:
226     if(base && base->get_link_index)
227       return (*base->get_link_index)(self, char_index);
228   }
229
230   typedef gint RType;
231   return RType();
232 }
233
234
235 void Hypertext_Class::link_selected_callback(AtkHypertext* self, gint p0)
236 {
237   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
238       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
239
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
244   // being overridden:
245   if(obj && obj->is_derived_())
246   {
247     try // Trap C++ exceptions which would normally be lost because this is a C callback.
248     {
249       // Call the virtual member method, which derived classes might override.
250       obj->on_link_selected(p0
251 );
252     }
253     catch(...)
254     {
255       Glib::exception_handlers_invoke();
256     }
257   }
258   else
259   {
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.
263 )    );
264
265     // Call the original underlying C function:
266     if(base && base->link_selected)
267       (*base->link_selected)(self, p0);
268   }
269 }
270
271
272 Glib::ObjectBase* Hypertext_Class::wrap_new(GObject* object)
273 {
274   return new Hypertext((AtkHypertext*)(object));
275 }
276
277
278 /* The implementation: */
279
280 Hypertext::Hypertext()
281 :
282   Glib::Interface(hypertext_class_.init())
283 {}
284
285 Hypertext::Hypertext(AtkHypertext* castitem)
286 :
287   Glib::Interface((GObject*)(castitem))
288 {}
289
290 Hypertext::~Hypertext()
291 {}
292
293 // static
294 void Hypertext::add_interface(GType gtype_implementer)
295 {
296   hypertext_class_.init().add_interface(gtype_implementer);
297 }
298
299 Hypertext::CppClassType Hypertext::hypertext_class_; // initialize static member
300
301 GType Hypertext::get_type()
302 {
303   return hypertext_class_.init().get_type();
304 }
305
306 GType Hypertext::get_base_type()
307 {
308   return atk_hypertext_get_type();
309 }
310
311
312 Glib::RefPtr<Hyperlink> Hypertext::get_link(int link_index)
313 {
314   return Glib::wrap(atk_hypertext_get_link(gobj(), link_index));
315 }
316
317 Glib::RefPtr<const Hyperlink> Hypertext::get_link(int link_index) const
318 {
319   return Glib::wrap(atk_hypertext_get_link(const_cast<AtkHypertext*>(gobj()), link_index));
320 }
321
322 int Hypertext::get_n_links() const
323 {
324   return atk_hypertext_get_n_links(const_cast<AtkHypertext*>(gobj()));
325 }
326
327 int Hypertext::get_link_index(int char_index) const
328 {
329   return atk_hypertext_get_link_index(const_cast<AtkHypertext*>(gobj()), char_index);
330 }
331
332
333 Glib::SignalProxy1< void,int > Hypertext::signal_link_selected()
334 {
335   return Glib::SignalProxy1< void,int >(this, &Hypertext_signal_link_selected_info);
336 }
337
338
339 void Atk::Hypertext::on_link_selected(int link_index)
340 {
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.
344 )  );
345
346   if(base && base->link_selected)
347     (*base->link_selected)(gobj(),link_index);
348 }
349
350
351 Glib::RefPtr<Hyperlink> Atk::Hypertext::get_link_vfunc(int link_index) 
352 {
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.
356 )  );
357
358   if(base && base->get_link)
359     return Glib::wrap((*base->get_link)(gobj(),link_index));
360
361   typedef Glib::RefPtr<Hyperlink> RType;
362   return RType();
363 }
364
365 int Atk::Hypertext::get_n_links_vfunc() const
366 {
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.
370 )  );
371
372   if(base && base->get_n_links)
373     return (*base->get_n_links)(const_cast<AtkHypertext*>(gobj()));
374
375   typedef int RType;
376   return RType();
377 }
378
379 int Atk::Hypertext::get_link_index_vfunc(int char_index) const
380 {
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.
384 )  );
385
386   if(base && base->get_link_index)
387     return (*base->get_link_index)(const_cast<AtkHypertext*>(gobj()),char_index);
388
389   typedef int RType;
390   return RType();
391 }
392
393
394 } // namespace Atk
395
396