rollback to 3428, before the mysterious removal of libs/* at 3431/3432
[ardour.git] / libs / gtkmm2 / atk / atkmm / document.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <atkmm/document.h>
5 #include <atkmm/private/document_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright 2003 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <atkmm/object.h>
28 #include <atk/atkdocument.h>
29
30
31 namespace Atk
32 {
33
34
35 } // namespace Atk
36
37
38 namespace
39 {
40 } // anonymous namespace
41
42
43 namespace Glib
44 {
45
46 Glib::RefPtr<Atk::Document> wrap(AtkDocument* object, bool take_copy)
47 {
48   return Glib::RefPtr<Atk::Document>( dynamic_cast<Atk::Document*> (Glib::wrap_auto_interface<Atk::Document> ((GObject*)(object), take_copy)) );
49   //We use dynamic_cast<> in case of multiple inheritance.
50 }
51
52 } // namespace Glib
53
54
55 namespace Atk
56 {
57
58
59 /* The *_Class implementation: */
60
61 const Glib::Interface_Class& Document_Class::init()
62 {
63   if(!gtype_) // create the GType if necessary
64   {
65     // Glib::Interface_Class has to know the interface init function
66     // in order to add interfaces to implementing types.
67     class_init_func_ = &Document_Class::iface_init_function;
68
69     // We can not derive from another interface, and it is not necessary anyway.
70     gtype_ = atk_document_get_type();
71   }
72
73   return *this;
74 }
75
76 void Document_Class::iface_init_function(void* g_iface, void*)
77 {
78   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
79
80   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
81   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
82   g_assert(klass != 0); 
83
84 #ifdef GLIBMM_VFUNCS_ENABLED
85   klass->get_document_type = &get_document_type_vfunc_callback;
86   klass->get_document = &get_document_vfunc_callback;
87 #endif //GLIBMM_VFUNCS_ENABLED
88
89 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
90 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
91 }
92
93 #ifdef GLIBMM_VFUNCS_ENABLED
94 const gchar* Document_Class::get_document_type_vfunc_callback(AtkDocument* self)
95 {
96   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
97       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
98
99   // Non-gtkmmproc-generated custom classes implicitly call the default
100   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
101   // generated classes can use this optimisation, which avoids the unnecessary
102   // parameter conversions if there is no possibility of the virtual function
103   // being overridden:
104   if(obj_base && obj_base->is_derived_())
105   {
106     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
107     if(obj) // This can be NULL during destruction.
108     {
109       #ifdef GLIBMM_EXCEPTIONS_ENABLED
110       try // Trap C++ exceptions which would normally be lost because this is a C callback.
111       {
112       #endif //GLIBMM_EXCEPTIONS_ENABLED
113         // Call the virtual member method, which derived classes might override.
114         return obj->get_document_type_vfunc();
115       #ifdef GLIBMM_EXCEPTIONS_ENABLED
116       }
117       catch(...)
118       {
119         Glib::exception_handlers_invoke();
120       }
121       #endif //GLIBMM_EXCEPTIONS_ENABLED
122     }
123   }
124   
125   BaseClassType *const base = static_cast<BaseClassType*>(
126       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
127 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
128 )  );
129
130   // Call the original underlying C function:
131   if(base && base->get_document_type)
132     return (*base->get_document_type)(self);
133
134
135   typedef const gchar* RType;
136   return RType();
137 }
138 gpointer Document_Class::get_document_vfunc_callback(AtkDocument* self)
139 {
140   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
141       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
142
143   // Non-gtkmmproc-generated custom classes implicitly call the default
144   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
145   // generated classes can use this optimisation, which avoids the unnecessary
146   // parameter conversions if there is no possibility of the virtual function
147   // being overridden:
148   if(obj_base && obj_base->is_derived_())
149   {
150     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
151     if(obj) // This can be NULL during destruction.
152     {
153       #ifdef GLIBMM_EXCEPTIONS_ENABLED
154       try // Trap C++ exceptions which would normally be lost because this is a C callback.
155       {
156       #endif //GLIBMM_EXCEPTIONS_ENABLED
157         // Call the virtual member method, which derived classes might override.
158         return obj->get_document_vfunc();
159       #ifdef GLIBMM_EXCEPTIONS_ENABLED
160       }
161       catch(...)
162       {
163         Glib::exception_handlers_invoke();
164       }
165       #endif //GLIBMM_EXCEPTIONS_ENABLED
166     }
167   }
168   
169   BaseClassType *const base = static_cast<BaseClassType*>(
170       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
171 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
172 )  );
173
174   // Call the original underlying C function:
175   if(base && base->get_document)
176     return (*base->get_document)(self);
177
178
179   typedef gpointer RType;
180   return RType();
181 }
182 #endif //GLIBMM_VFUNCS_ENABLED
183
184 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
185 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
186
187
188 Glib::ObjectBase* Document_Class::wrap_new(GObject* object)
189 {
190   return new Document((AtkDocument*)(object));
191 }
192
193
194 /* The implementation: */
195
196 Document::Document()
197 :
198   Glib::Interface(document_class_.init())
199 {}
200
201 Document::Document(AtkDocument* castitem)
202 :
203   Glib::Interface((GObject*)(castitem))
204 {}
205
206 Document::~Document()
207 {}
208
209 // static
210 void Document::add_interface(GType gtype_implementer)
211 {
212   document_class_.init().add_interface(gtype_implementer);
213 }
214
215 Document::CppClassType Document::document_class_; // initialize static member
216
217 GType Document::get_type()
218 {
219   return document_class_.init().get_type();
220 }
221
222 GType Document::get_base_type()
223 {
224   return atk_document_get_type();
225 }
226
227
228 Glib::ustring Document::get_document_type() const
229 {
230   return Glib::convert_const_gchar_ptr_to_ustring(atk_document_get_document_type(const_cast<AtkDocument*>(gobj())));
231 }
232
233 gpointer Document::get_document()
234 {
235   return atk_document_get_document(gobj());
236 }
237
238
239 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
240 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
241
242 #ifdef GLIBMM_VFUNCS_ENABLED
243 const gchar* Atk::Document::get_document_type_vfunc() 
244 {
245   BaseClassType *const base = static_cast<BaseClassType*>(
246       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
247 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
248 )  );
249
250   if(base && base->get_document_type)
251     return (*base->get_document_type)(gobj());
252
253   typedef const gchar* RType;
254   return RType();
255 }
256 gpointer Atk::Document::get_document_vfunc() const
257 {
258   BaseClassType *const base = static_cast<BaseClassType*>(
259       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
260 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
261 )  );
262
263   if(base && base->get_document)
264     return (*base->get_document)(const_cast<AtkDocument*>(gobj()));
265
266   typedef gpointer RType;
267   return RType();
268 }
269 #endif //GLIBMM_VFUNCS_ENABLED
270
271
272 } // namespace Atk
273
274