1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/asyncresult.h>
5 #include <giomm/private/asyncresult_p.h>
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
9 /* Copyright (C) 2007 The giomm 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 <gio/gasyncresult.h> //We are not allowed to include individual headers.
31 } // anonymous namespace
37 Glib::RefPtr<Gio::AsyncResult> wrap(GAsyncResult* object, bool take_copy)
39 return Glib::RefPtr<Gio::AsyncResult>( dynamic_cast<Gio::AsyncResult*> (Glib::wrap_auto_interface<Gio::AsyncResult> ((GObject*)(object), take_copy)) );
40 //We use dynamic_cast<> in case of multiple inheritance.
50 /* The *_Class implementation: */
52 const Glib::Interface_Class& AsyncResult_Class::init()
54 if(!gtype_) // create the GType if necessary
56 // Glib::Interface_Class has to know the interface init function
57 // in order to add interfaces to implementing types.
58 class_init_func_ = &AsyncResult_Class::iface_init_function;
60 // We can not derive from another interface, and it is not necessary anyway.
61 gtype_ = g_async_result_get_type();
67 void AsyncResult_Class::iface_init_function(void* g_iface, void*)
69 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
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
75 #ifdef GLIBMM_VFUNCS_ENABLED
76 klass->get_source_object = &get_source_object_vfunc_callback;
77 #endif //GLIBMM_VFUNCS_ENABLED
79 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
80 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
83 #ifdef GLIBMM_VFUNCS_ENABLED
84 GObject* AsyncResult_Class::get_source_object_vfunc_callback(GAsyncResult* self)
86 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
87 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
89 // Non-gtkmmproc-generated custom classes implicitly call the default
90 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
91 // generated classes can use this optimisation, which avoids the unnecessary
92 // parameter conversions if there is no possibility of the virtual function
94 if(obj_base && obj_base->is_derived_())
96 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
97 if(obj) // This can be NULL during destruction.
99 #ifdef GLIBMM_EXCEPTIONS_ENABLED
100 try // Trap C++ exceptions which would normally be lost because this is a C callback.
102 #endif //GLIBMM_EXCEPTIONS_ENABLED
103 // Call the virtual member method, which derived classes might override.
104 return Glib::unwrap(obj->get_source_object_vfunc());
105 #ifdef GLIBMM_EXCEPTIONS_ENABLED
109 Glib::exception_handlers_invoke();
111 #endif //GLIBMM_EXCEPTIONS_ENABLED
115 BaseClassType *const base = static_cast<BaseClassType*>(
116 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
117 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
120 // Call the original underlying C function:
121 if(base && base->get_source_object)
122 return (*base->get_source_object)(self);
125 typedef GObject* RType;
128 #endif //GLIBMM_VFUNCS_ENABLED
130 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
131 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
134 Glib::ObjectBase* AsyncResult_Class::wrap_new(GObject* object)
136 return new AsyncResult((GAsyncResult*)(object));
140 /* The implementation: */
142 AsyncResult::AsyncResult()
144 Glib::Interface(asyncresult_class_.init())
147 AsyncResult::AsyncResult(GAsyncResult* castitem)
149 Glib::Interface((GObject*)(castitem))
152 AsyncResult::AsyncResult(const Glib::Interface_Class& interface_class)
153 : Glib::Interface(interface_class)
157 AsyncResult::~AsyncResult()
161 void AsyncResult::add_interface(GType gtype_implementer)
163 asyncresult_class_.init().add_interface(gtype_implementer);
166 AsyncResult::CppClassType AsyncResult::asyncresult_class_; // initialize static member
168 GType AsyncResult::get_type()
170 return asyncresult_class_.init().get_type();
173 GType AsyncResult::get_base_type()
175 return g_async_result_get_type();
179 Glib::RefPtr<Glib::Object> AsyncResult::get_source_object()
181 return Glib::wrap(g_async_result_get_source_object(gobj()));
184 Glib::RefPtr<const Glib::Object> AsyncResult::get_source_object() const
186 return const_cast<AsyncResult*>(this)->get_source_object();
190 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
191 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
193 #ifdef GLIBMM_VFUNCS_ENABLED
194 Glib::RefPtr<Glib::Object> Gio::AsyncResult::get_source_object_vfunc()
196 BaseClassType *const base = static_cast<BaseClassType*>(
197 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
198 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
201 if(base && base->get_source_object)
202 return Glib::wrap((*base->get_source_object)(gobj()));
204 typedef Glib::RefPtr<Glib::Object> RType;
207 #endif //GLIBMM_VFUNCS_ENABLED