1 // Generated by gmmproc 2.56.0 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <atkmm/action.h>
7 #include <atkmm/private/action_p.h>
8 
9 
10 // -*- c++ -*-
11 /* $Id: action.ccg,v 1.1 2003/01/21 13:36:56 murrayc Exp $ */
12 
13 /* Copyright 1998-2002 The gtkmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Lesser General Public
17  * License as published by the Free Software Foundation; either
18  * version 2.1 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Lesser General Public License for more details.
24  *
25  * You should have received a copy of the GNU Lesser General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29 
30 #include <atk/atkaction.h>
31 
32 
33 namespace
34 {
35 } // anonymous namespace
36 
37 
38 namespace Glib
39 {
40 
wrap(AtkAction * object,bool take_copy)41 Glib::RefPtr<Atk::Action> wrap(AtkAction* object, bool take_copy)
42 {
43   return Glib::RefPtr<Atk::Action>( dynamic_cast<Atk::Action*> (Glib::wrap_auto_interface<Atk::Action> ((GObject*)(object), take_copy)) );
44   //We use dynamic_cast<> in case of multiple inheritance.
45 }
46 
47 } // namespace Glib
48 
49 
50 namespace Atk
51 {
52 
53 
54 /* The *_Class implementation: */
55 
init()56 const Glib::Interface_Class& Action_Class::init()
57 {
58   if(!gtype_) // create the GType if necessary
59   {
60     // Glib::Interface_Class has to know the interface init function
61     // in order to add interfaces to implementing types.
62     class_init_func_ = &Action_Class::iface_init_function;
63 
64     // We can not derive from another interface, and it is not necessary anyway.
65     gtype_ = atk_action_get_type();
66   }
67 
68   return *this;
69 }
70 
iface_init_function(void * g_iface,void *)71 void Action_Class::iface_init_function(void* g_iface, void*)
72 {
73   const auto klass = static_cast<BaseClassType*>(g_iface);
74 
75   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
76   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
77   g_assert(klass != nullptr);
78 
79   klass->do_action = &do_action_vfunc_callback;
80   klass->get_n_actions = &get_n_actions_vfunc_callback;
81   klass->get_description = &get_description_vfunc_callback;
82   klass->get_name = &get_name_vfunc_callback;
83   klass->get_keybinding = &get_keybinding_vfunc_callback;
84   klass->set_description = &set_description_vfunc_callback;
85 
86 }
87 
do_action_vfunc_callback(AtkAction * self,gint i)88 gboolean Action_Class::do_action_vfunc_callback(AtkAction* self, gint i)
89 {
90   const auto obj_base = static_cast<Glib::ObjectBase*>(
91       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
92 
93   // Non-gtkmmproc-generated custom classes implicitly call the default
94   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
95   // generated classes can use this optimisation, which avoids the unnecessary
96   // parameter conversions if there is no possibility of the virtual function
97   // being overridden:
98   if(obj_base && obj_base->is_derived_())
99   {
100     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
101     if(obj) // This can be NULL during destruction.
102     {
103       try // Trap C++ exceptions which would normally be lost because this is a C callback.
104       {
105         // Call the virtual member method, which derived classes might override.
106         return static_cast<int>(obj->do_action_vfunc(i
107 ));
108       }
109       catch(...)
110       {
111         Glib::exception_handlers_invoke();
112       }
113     }
114   }
115 
116   BaseClassType *const base = static_cast<BaseClassType*>(
117       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
118 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
119 )  );
120 
121   // Call the original underlying C function:
122   if(base && base->do_action)
123     return (*base->do_action)(self, i);
124 
125   using RType = gboolean;
126   return RType();
127 }
get_n_actions_vfunc_callback(AtkAction * self)128 gint Action_Class::get_n_actions_vfunc_callback(AtkAction* self)
129 {
130   const auto obj_base = static_cast<Glib::ObjectBase*>(
131       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
132 
133   // Non-gtkmmproc-generated custom classes implicitly call the default
134   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
135   // generated classes can use this optimisation, which avoids the unnecessary
136   // parameter conversions if there is no possibility of the virtual function
137   // being overridden:
138   if(obj_base && obj_base->is_derived_())
139   {
140     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
141     if(obj) // This can be NULL during destruction.
142     {
143       try // Trap C++ exceptions which would normally be lost because this is a C callback.
144       {
145         // Call the virtual member method, which derived classes might override.
146         return obj->get_n_actions_vfunc();
147       }
148       catch(...)
149       {
150         Glib::exception_handlers_invoke();
151       }
152     }
153   }
154 
155   BaseClassType *const base = static_cast<BaseClassType*>(
156       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
157 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
158 )  );
159 
160   // Call the original underlying C function:
161   if(base && base->get_n_actions)
162     return (*base->get_n_actions)(self);
163 
164   using RType = gint;
165   return RType();
166 }
get_description_vfunc_callback(AtkAction * self,gint i)167 const gchar* Action_Class::get_description_vfunc_callback(AtkAction* self, gint i)
168 {
169   const auto obj_base = static_cast<Glib::ObjectBase*>(
170       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
171 
172   // Non-gtkmmproc-generated custom classes implicitly call the default
173   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
174   // generated classes can use this optimisation, which avoids the unnecessary
175   // parameter conversions if there is no possibility of the virtual function
176   // being overridden:
177   if(obj_base && obj_base->is_derived_())
178   {
179     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
180     if(obj) // This can be NULL during destruction.
181     {
182       try // Trap C++ exceptions which would normally be lost because this is a C callback.
183       {
184         // Call the virtual member method, which derived classes might override.
185         return obj->get_description_vfunc(i
186 );
187       }
188       catch(...)
189       {
190         Glib::exception_handlers_invoke();
191       }
192     }
193   }
194 
195   BaseClassType *const base = static_cast<BaseClassType*>(
196       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
197 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
198 )  );
199 
200   // Call the original underlying C function:
201   if(base && base->get_description)
202     return (*base->get_description)(self, i);
203 
204   using RType = const gchar*;
205   return RType();
206 }
get_name_vfunc_callback(AtkAction * self,gint i)207 const gchar* Action_Class::get_name_vfunc_callback(AtkAction* self, gint i)
208 {
209   const auto obj_base = static_cast<Glib::ObjectBase*>(
210       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
211 
212   // Non-gtkmmproc-generated custom classes implicitly call the default
213   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
214   // generated classes can use this optimisation, which avoids the unnecessary
215   // parameter conversions if there is no possibility of the virtual function
216   // being overridden:
217   if(obj_base && obj_base->is_derived_())
218   {
219     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
220     if(obj) // This can be NULL during destruction.
221     {
222       try // Trap C++ exceptions which would normally be lost because this is a C callback.
223       {
224         // Call the virtual member method, which derived classes might override.
225         return obj->get_name_vfunc(i
226 );
227       }
228       catch(...)
229       {
230         Glib::exception_handlers_invoke();
231       }
232     }
233   }
234 
235   BaseClassType *const base = static_cast<BaseClassType*>(
236       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
237 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
238 )  );
239 
240   // Call the original underlying C function:
241   if(base && base->get_name)
242     return (*base->get_name)(self, i);
243 
244   using RType = const gchar*;
245   return RType();
246 }
get_keybinding_vfunc_callback(AtkAction * self,gint i)247 const gchar* Action_Class::get_keybinding_vfunc_callback(AtkAction* self, gint i)
248 {
249   const auto obj_base = static_cast<Glib::ObjectBase*>(
250       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
251 
252   // Non-gtkmmproc-generated custom classes implicitly call the default
253   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
254   // generated classes can use this optimisation, which avoids the unnecessary
255   // parameter conversions if there is no possibility of the virtual function
256   // being overridden:
257   if(obj_base && obj_base->is_derived_())
258   {
259     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
260     if(obj) // This can be NULL during destruction.
261     {
262       try // Trap C++ exceptions which would normally be lost because this is a C callback.
263       {
264         // Call the virtual member method, which derived classes might override.
265         return obj->get_keybinding_vfunc(i
266 );
267       }
268       catch(...)
269       {
270         Glib::exception_handlers_invoke();
271       }
272     }
273   }
274 
275   BaseClassType *const base = static_cast<BaseClassType*>(
276       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
277 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
278 )  );
279 
280   // Call the original underlying C function:
281   if(base && base->get_keybinding)
282     return (*base->get_keybinding)(self, i);
283 
284   using RType = const gchar*;
285   return RType();
286 }
set_description_vfunc_callback(AtkAction * self,gint i,const gchar * desc)287 gboolean Action_Class::set_description_vfunc_callback(AtkAction* self, gint i, const gchar* desc)
288 {
289   const auto obj_base = static_cast<Glib::ObjectBase*>(
290       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
291 
292   // Non-gtkmmproc-generated custom classes implicitly call the default
293   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
294   // generated classes can use this optimisation, which avoids the unnecessary
295   // parameter conversions if there is no possibility of the virtual function
296   // being overridden:
297   if(obj_base && obj_base->is_derived_())
298   {
299     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
300     if(obj) // This can be NULL during destruction.
301     {
302       try // Trap C++ exceptions which would normally be lost because this is a C callback.
303       {
304         // Call the virtual member method, which derived classes might override.
305         return static_cast<int>(obj->set_description_vfunc(i
306 , Glib::convert_const_gchar_ptr_to_ustring(desc)
307 ));
308       }
309       catch(...)
310       {
311         Glib::exception_handlers_invoke();
312       }
313     }
314   }
315 
316   BaseClassType *const base = static_cast<BaseClassType*>(
317       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
318 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
319 )  );
320 
321   // Call the original underlying C function:
322   if(base && base->set_description)
323     return (*base->set_description)(self, i, desc);
324 
325   using RType = gboolean;
326   return RType();
327 }
328 
329 
wrap_new(GObject * object)330 Glib::ObjectBase* Action_Class::wrap_new(GObject* object)
331 {
332   return new Action((AtkAction*)(object));
333 }
334 
335 
336 /* The implementation: */
337 
Action()338 Action::Action()
339 :
340   Glib::Interface(action_class_.init())
341 {}
342 
Action(AtkAction * castitem)343 Action::Action(AtkAction* castitem)
344 :
345   Glib::Interface((GObject*)(castitem))
346 {}
347 
Action(const Glib::Interface_Class & interface_class)348 Action::Action(const Glib::Interface_Class& interface_class)
349 : Glib::Interface(interface_class)
350 {
351 }
352 
Action(Action && src)353 Action::Action(Action&& src) noexcept
354 : Glib::Interface(std::move(src))
355 {}
356 
operator =(Action && src)357 Action& Action::operator=(Action&& src) noexcept
358 {
359   Glib::Interface::operator=(std::move(src));
360   return *this;
361 }
362 
~Action()363 Action::~Action() noexcept
364 {}
365 
366 // static
add_interface(GType gtype_implementer)367 void Action::add_interface(GType gtype_implementer)
368 {
369   action_class_.init().add_interface(gtype_implementer);
370 }
371 
372 Action::CppClassType Action::action_class_; // initialize static member
373 
get_type()374 GType Action::get_type()
375 {
376   return action_class_.init().get_type();
377 }
378 
379 
get_base_type()380 GType Action::get_base_type()
381 {
382   return atk_action_get_type();
383 }
384 
385 
do_action(int i)386 bool Action::do_action(int i)
387 {
388   return atk_action_do_action(gobj(), i);
389 }
390 
get_n_actions() const391 int Action::get_n_actions() const
392 {
393   return atk_action_get_n_actions(const_cast<AtkAction*>(gobj()));
394 }
395 
get_description(int i) const396 Glib::ustring Action::get_description(int i) const
397 {
398   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_description(const_cast<AtkAction*>(gobj()), i));
399 }
400 
get_name(int i) const401 Glib::ustring Action::get_name(int i) const
402 {
403   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_name(const_cast<AtkAction*>(gobj()), i));
404 }
405 
get_keybinding(int i)406 Glib::ustring Action::get_keybinding(int i)
407 {
408   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_keybinding(gobj(), i));
409 }
410 
set_description(int i,const Glib::ustring & desc)411 bool Action::set_description(int i, const Glib::ustring& desc)
412 {
413   return atk_action_set_description(gobj(), i, desc.c_str());
414 }
415 
get_localized_name(int i)416 Glib::ustring Action::get_localized_name(int i)
417 {
418   return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_localized_name(gobj(), i));
419 }
420 
421 
do_action_vfunc(int i)422 bool Atk::Action::do_action_vfunc(int i)
423 {
424   const auto 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->do_action)
430   {
431     bool retval((*base->do_action)(gobj(),i));
432     return retval;
433   }
434 
435   using RType = bool;
436   return RType();
437 }
get_n_actions_vfunc() const438 int Atk::Action::get_n_actions_vfunc() const
439 {
440   const auto base = static_cast<BaseClassType*>(
441       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
442 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
443 )  );
444 
445   if(base && base->get_n_actions)
446   {
447     int retval((*base->get_n_actions)(const_cast<AtkAction*>(gobj())));
448     return retval;
449   }
450 
451   using RType = int;
452   return RType();
453 }
get_description_vfunc(int i) const454 const char* Atk::Action::get_description_vfunc(int i) const
455 {
456   const auto base = static_cast<BaseClassType*>(
457       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
458 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
459 )  );
460 
461   if(base && base->get_description)
462   {
463     const char* retval((*base->get_description)(const_cast<AtkAction*>(gobj()),i));
464     return retval;
465   }
466 
467   using RType = const char*;
468   return RType();
469 }
get_name_vfunc(int i) const470 const char* Atk::Action::get_name_vfunc(int i) const
471 {
472   const auto base = static_cast<BaseClassType*>(
473       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
474 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
475 )  );
476 
477   if(base && base->get_name)
478   {
479     const char* retval((*base->get_name)(const_cast<AtkAction*>(gobj()),i));
480     return retval;
481   }
482 
483   using RType = const char*;
484   return RType();
485 }
get_keybinding_vfunc(int i) const486 const char* Atk::Action::get_keybinding_vfunc(int i) const
487 {
488   const auto base = static_cast<BaseClassType*>(
489       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
490 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
491 )  );
492 
493   if(base && base->get_keybinding)
494   {
495     const char* retval((*base->get_keybinding)(const_cast<AtkAction*>(gobj()),i));
496     return retval;
497   }
498 
499   using RType = const char*;
500   return RType();
501 }
set_description_vfunc(int i,const Glib::ustring & desc)502 bool Atk::Action::set_description_vfunc(int i, const Glib::ustring& desc)
503 {
504   const auto base = static_cast<BaseClassType*>(
505       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
506 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
507 )  );
508 
509   if(base && base->set_description)
510   {
511     bool retval((*base->set_description)(gobj(),i,desc.c_str()));
512     return retval;
513   }
514 
515   using RType = bool;
516   return RType();
517 }
518 
519 
520 } // namespace Atk
521 
522 
523