1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <atkmm/implementor.h>
4 #include <atkmm/private/implementor_p.h>
9 /* Copyright 1998-2002 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/atkobject.h>
32 } // anonymous namespace
38 Glib::RefPtr<Atk::Implementor> wrap(AtkImplementor* object, bool take_copy)
40 return Glib::RefPtr<Atk::Implementor>( dynamic_cast<Atk::Implementor*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
41 //We use dynamic_cast<> in case of multiple inheritance.
51 /* The *_Class implementation: */
53 const Glib::Interface_Class& Implementor_Class::init()
55 if(!gtype_) // create the GType if necessary
57 // Glib::Interface_Class has to know the interface init function
58 // in order to add interfaces to implementing types.
59 class_init_func_ = &Implementor_Class::iface_init_function;
61 // We can not derive from another interface, and it is not necessary anyway.
62 gtype_ = atk_implementor_get_type();
68 void Implementor_Class::iface_init_function(void* g_iface, void*)
70 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
72 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
73 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
76 klass->ref_accessible = &ref_accessible_vfunc_callback;
79 AtkObject* Implementor_Class::ref_accessible_vfunc_callback(AtkImplementor* self)
81 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
82 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
84 // Non-gtkmmproc-generated custom classes implicitly call the default
85 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
86 // generated classes can use this optimisation, which avoids the unnecessary
87 // parameter conversions if there is no possibility of the virtual function
89 if(obj && obj->is_derived_())
91 try // Trap C++ exceptions which would normally be lost because this is a C callback.
93 // Call the virtual member method, which derived classes might override.
94 return Glib::unwrap(obj->ref_accessibile_vfunc());
98 Glib::exception_handlers_invoke();
103 BaseClassType *const base = static_cast<BaseClassType*>(
104 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
105 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
108 // Call the original underlying C function:
109 if(base && base->ref_accessible)
110 return (*base->ref_accessible)(self);
113 typedef AtkObject* RType;
118 Glib::ObjectBase* Implementor_Class::wrap_new(GObject* object)
120 return new Implementor((AtkImplementor*)(object));
124 /* The implementation: */
126 Implementor::Implementor()
128 Glib::Interface(implementor_class_.init())
131 Implementor::Implementor(AtkImplementor* castitem)
133 Glib::Interface((GObject*)(castitem))
136 Implementor::~Implementor()
140 void Implementor::add_interface(GType gtype_implementer)
142 implementor_class_.init().add_interface(gtype_implementer);
145 Implementor::CppClassType Implementor::implementor_class_; // initialize static member
147 GType Implementor::get_type()
149 return implementor_class_.init().get_type();
152 GType Implementor::get_base_type()
154 return atk_implementor_get_type();
158 Glib::RefPtr<Object> Atk::Implementor::ref_accessibile_vfunc()
160 BaseClassType *const base = static_cast<BaseClassType*>(
161 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
162 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
165 if(base && base->ref_accessible)
166 return Glib::wrap((*base->ref_accessible)(gobj()));
168 typedef Glib::RefPtr<Object> RType;