fix for type error on 64 bit systems
[ardour.git] / libs / gtkmm2 / atk / atkmm / action.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <atkmm/action.h>
4 #include <atkmm/private/action_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 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 <atk/atkaction.h>
27
28
29 namespace
30 {
31 } // anonymous namespace
32
33
34 namespace Glib
35 {
36
37 Glib::RefPtr<Atk::Action> wrap(AtkAction* object, bool take_copy)
38 {
39   return Glib::RefPtr<Atk::Action>( dynamic_cast<Atk::Action*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
40   //We use dynamic_cast<> in case of multiple inheritance.
41 }
42
43 } // namespace Glib
44
45
46 namespace Atk
47 {
48
49
50 /* The *_Class implementation: */
51
52 const Glib::Interface_Class& Action_Class::init()
53 {
54   if(!gtype_) // create the GType if necessary
55   {
56     // Glib::Interface_Class has to know the interface init function
57     // in order to add interfaces to implementing types.
58     class_init_func_ = &Action_Class::iface_init_function;
59
60     // We can not derive from another interface, and it is not necessary anyway.
61     gtype_ = atk_action_get_type();
62   }
63
64   return *this;
65 }
66
67 void Action_Class::iface_init_function(void* g_iface, void*)
68 {
69   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
70
71   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
72   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
73   g_assert(klass != 0); 
74
75   klass->do_action = &do_action_vfunc_callback;
76   klass->get_n_actions = &get_n_actions_vfunc_callback;
77   klass->get_description = &get_description_vfunc_callback;
78   klass->get_name = &get_name_vfunc_callback;
79   klass->get_keybinding = &get_keybinding_vfunc_callback;
80   klass->set_description = &set_description_vfunc_callback;
81 }
82
83 gboolean Action_Class::do_action_vfunc_callback(AtkAction* self, gint i)
84 {
85   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
86       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
87
88   // Non-gtkmmproc-generated custom classes implicitly call the default
89   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
90   // generated classes can use this optimisation, which avoids the unnecessary
91   // parameter conversions if there is no possibility of the virtual function
92   // being overridden:
93   if(obj && obj->is_derived_())
94   {
95     try // Trap C++ exceptions which would normally be lost because this is a C callback.
96     {
97       // Call the virtual member method, which derived classes might override.
98       return static_cast<int>(obj->do_action_vfunc(i
99 ));
100     }
101     catch(...)
102     {
103       Glib::exception_handlers_invoke();
104     }
105   }
106   else
107   {
108     BaseClassType *const base = static_cast<BaseClassType*>(
109         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
110 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
111 )    );
112
113     // Call the original underlying C function:
114     if(base && base->do_action)
115       return (*base->do_action)(self, i);
116   }
117
118   typedef gboolean RType;
119   return RType();
120 }
121
122 gint Action_Class::get_n_actions_vfunc_callback(AtkAction* self)
123 {
124   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
125       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
126
127   // Non-gtkmmproc-generated custom classes implicitly call the default
128   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
129   // generated classes can use this optimisation, which avoids the unnecessary
130   // parameter conversions if there is no possibility of the virtual function
131   // being overridden:
132   if(obj && obj->is_derived_())
133   {
134     try // Trap C++ exceptions which would normally be lost because this is a C callback.
135     {
136       // Call the virtual member method, which derived classes might override.
137       return obj->get_n_actions_vfunc();
138     }
139     catch(...)
140     {
141       Glib::exception_handlers_invoke();
142     }
143   }
144   else
145   {
146     BaseClassType *const base = static_cast<BaseClassType*>(
147         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
148 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
149 )    );
150
151     // Call the original underlying C function:
152     if(base && base->get_n_actions)
153       return (*base->get_n_actions)(self);
154   }
155
156   typedef gint RType;
157   return RType();
158 }
159
160 const gchar* Action_Class::get_description_vfunc_callback(AtkAction* self, gint i)
161 {
162   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
163       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
164
165   // Non-gtkmmproc-generated custom classes implicitly call the default
166   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
167   // generated classes can use this optimisation, which avoids the unnecessary
168   // parameter conversions if there is no possibility of the virtual function
169   // being overridden:
170   if(obj && obj->is_derived_())
171   {
172     try // Trap C++ exceptions which would normally be lost because this is a C callback.
173     {
174       // Call the virtual member method, which derived classes might override.
175       return obj->get_description_vfunc(i
176 );
177     }
178     catch(...)
179     {
180       Glib::exception_handlers_invoke();
181     }
182   }
183   else
184   {
185     BaseClassType *const base = static_cast<BaseClassType*>(
186         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
187 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
188 )    );
189
190     // Call the original underlying C function:
191     if(base && base->get_description)
192       return (*base->get_description)(self, i);
193   }
194
195   typedef const gchar* RType;
196   return RType();
197 }
198
199 const gchar* Action_Class::get_name_vfunc_callback(AtkAction* self, gint i)
200 {
201   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
202       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
203
204   // Non-gtkmmproc-generated custom classes implicitly call the default
205   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
206   // generated classes can use this optimisation, which avoids the unnecessary
207   // parameter conversions if there is no possibility of the virtual function
208   // being overridden:
209   if(obj && obj->is_derived_())
210   {
211     try // Trap C++ exceptions which would normally be lost because this is a C callback.
212     {
213       // Call the virtual member method, which derived classes might override.
214       return obj->get_name_vfunc(i
215 );
216     }
217     catch(...)
218     {
219       Glib::exception_handlers_invoke();
220     }
221   }
222   else
223   {
224     BaseClassType *const base = static_cast<BaseClassType*>(
225         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
226 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
227 )    );
228
229     // Call the original underlying C function:
230     if(base && base->get_name)
231       return (*base->get_name)(self, i);
232   }
233
234   typedef const gchar* RType;
235   return RType();
236 }
237
238 const gchar* Action_Class::get_keybinding_vfunc_callback(AtkAction* self, gint i)
239 {
240   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
241       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
242
243   // Non-gtkmmproc-generated custom classes implicitly call the default
244   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
245   // generated classes can use this optimisation, which avoids the unnecessary
246   // parameter conversions if there is no possibility of the virtual function
247   // being overridden:
248   if(obj && obj->is_derived_())
249   {
250     try // Trap C++ exceptions which would normally be lost because this is a C callback.
251     {
252       // Call the virtual member method, which derived classes might override.
253       return obj->get_keybinding_vfunc(i
254 );
255     }
256     catch(...)
257     {
258       Glib::exception_handlers_invoke();
259     }
260   }
261   else
262   {
263     BaseClassType *const base = static_cast<BaseClassType*>(
264         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
265 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
266 )    );
267
268     // Call the original underlying C function:
269     if(base && base->get_keybinding)
270       return (*base->get_keybinding)(self, i);
271   }
272
273   typedef const gchar* RType;
274   return RType();
275 }
276
277 gboolean Action_Class::set_description_vfunc_callback(AtkAction* self, gint i, const gchar* desc)
278 {
279   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
280       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
281
282   // Non-gtkmmproc-generated custom classes implicitly call the default
283   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
284   // generated classes can use this optimisation, which avoids the unnecessary
285   // parameter conversions if there is no possibility of the virtual function
286   // being overridden:
287   if(obj && obj->is_derived_())
288   {
289     try // Trap C++ exceptions which would normally be lost because this is a C callback.
290     {
291       // Call the virtual member method, which derived classes might override.
292       return static_cast<int>(obj->set_description_vfunc(i
293 , Glib::convert_const_gchar_ptr_to_ustring(desc)
294 ));
295     }
296     catch(...)
297     {
298       Glib::exception_handlers_invoke();
299     }
300   }
301   else
302   {
303     BaseClassType *const base = static_cast<BaseClassType*>(
304         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
305 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
306 )    );
307
308     // Call the original underlying C function:
309     if(base && base->set_description)
310       return (*base->set_description)(self, i, desc);
311   }
312
313   typedef gboolean RType;
314   return RType();
315 }
316
317
318 Glib::ObjectBase* Action_Class::wrap_new(GObject* object)
319 {
320   return new Action((AtkAction*)(object));
321 }
322
323
324 /* The implementation: */
325
326 Action::Action()
327 :
328   Glib::Interface(action_class_.init())
329 {}
330
331 Action::Action(AtkAction* castitem)
332 :
333   Glib::Interface((GObject*)(castitem))
334 {}
335
336 Action::~Action()
337 {}
338
339 // static
340 void Action::add_interface(GType gtype_implementer)
341 {
342   action_class_.init().add_interface(gtype_implementer);
343 }
344
345 Action::CppClassType Action::action_class_; // initialize static member
346
347 GType Action::get_type()
348 {
349   return action_class_.init().get_type();
350 }
351
352 GType Action::get_base_type()
353 {
354   return atk_action_get_type();
355 }
356
357
358 bool Action::do_action(int i)
359 {
360   return atk_action_do_action(gobj(), i);
361 }
362
363 int Action::get_n_actions() const
364 {
365   return atk_action_get_n_actions(const_cast<AtkAction*>(gobj()));
366 }
367
368 Glib::ustring Action::get_description(int i) const
369 {
370   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_description(const_cast<AtkAction*>(gobj()), i));
371 }
372
373 Glib::ustring Action::get_name(int i) const
374 {
375   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_name(const_cast<AtkAction*>(gobj()), i));
376 }
377
378 Glib::ustring Action::get_keybinding(int i)
379 {
380   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_keybinding(gobj(), i));
381 }
382
383 bool Action::set_description(int i, const Glib::ustring& desc)
384 {
385   return atk_action_set_description(gobj(), i, desc.c_str());
386 }
387
388 Glib::ustring Action::get_localized_name(int i)
389 {
390   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_localized_name(gobj(), i));
391 }
392
393
394 bool Atk::Action::do_action_vfunc(int i) 
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->do_action)
402     return (*base->do_action)(gobj(),i);
403
404   typedef bool RType;
405   return RType();
406 }
407
408 int Atk::Action::get_n_actions_vfunc() const
409 {
410   BaseClassType *const base = static_cast<BaseClassType*>(
411       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
412 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
413 )  );
414
415   if(base && base->get_n_actions)
416     return (*base->get_n_actions)(const_cast<AtkAction*>(gobj()));
417
418   typedef int RType;
419   return RType();
420 }
421
422 const char* Atk::Action::get_description_vfunc(int i) const
423 {
424   BaseClassType *const base = static_cast<BaseClassType*>(
425       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
426 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
427 )  );
428
429   if(base && base->get_description)
430     return (*base->get_description)(const_cast<AtkAction*>(gobj()),i);
431
432   typedef const char* RType;
433   return RType();
434 }
435
436 const char* Atk::Action::get_name_vfunc(int i) const
437 {
438   BaseClassType *const base = static_cast<BaseClassType*>(
439       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
440 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
441 )  );
442
443   if(base && base->get_name)
444     return (*base->get_name)(const_cast<AtkAction*>(gobj()),i);
445
446   typedef const char* RType;
447   return RType();
448 }
449
450 const char* Atk::Action::get_keybinding_vfunc(int i) const
451 {
452   BaseClassType *const base = static_cast<BaseClassType*>(
453       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
454 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
455 )  );
456
457   if(base && base->get_keybinding)
458     return (*base->get_keybinding)(const_cast<AtkAction*>(gobj()),i);
459
460   typedef const char* RType;
461   return RType();
462 }
463
464 bool Atk::Action::set_description_vfunc(int i, const Glib::ustring& desc) 
465 {
466   BaseClassType *const base = static_cast<BaseClassType*>(
467       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
468 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
469 )  );
470
471   if(base && base->set_description)
472     return (*base->set_description)(gobj(),i,desc.c_str());
473
474   typedef bool RType;
475   return RType();
476 }
477
478
479 } // namespace Atk
480
481