Upgrade gtkmm to 2.10.8, glibmm to 2.13.3 and add cairomm 1.2.4
[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 ((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   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
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 && obj->is_derived_())
105   {
106     #ifdef GLIBMM_EXCEPTIONS_ENABLED
107     try // Trap C++ exceptions which would normally be lost because this is a C callback.
108     {
109     #endif //GLIBMM_EXCEPTIONS_ENABLED
110       // Call the virtual member method, which derived classes might override.
111       return obj->get_document_type_vfunc();
112     #ifdef GLIBMM_EXCEPTIONS_ENABLED
113     }
114     catch(...)
115     {
116       Glib::exception_handlers_invoke();
117     }
118     #endif //GLIBMM_EXCEPTIONS_ENABLED
119   }
120   else
121   {
122     BaseClassType *const base = static_cast<BaseClassType*>(
123         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
124 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
125 )    );
126
127     // Call the original underlying C function:
128     if(base && base->get_document_type)
129       return (*base->get_document_type)(self);
130   }
131
132   typedef const gchar* RType;
133   return RType();
134 }
135 gpointer Document_Class::get_document_vfunc_callback(AtkDocument* self)
136 {
137   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
138       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
139
140   // Non-gtkmmproc-generated custom classes implicitly call the default
141   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
142   // generated classes can use this optimisation, which avoids the unnecessary
143   // parameter conversions if there is no possibility of the virtual function
144   // being overridden:
145   if(obj && obj->is_derived_())
146   {
147     #ifdef GLIBMM_EXCEPTIONS_ENABLED
148     try // Trap C++ exceptions which would normally be lost because this is a C callback.
149     {
150     #endif //GLIBMM_EXCEPTIONS_ENABLED
151       // Call the virtual member method, which derived classes might override.
152       return obj->get_document_vfunc();
153     #ifdef GLIBMM_EXCEPTIONS_ENABLED
154     }
155     catch(...)
156     {
157       Glib::exception_handlers_invoke();
158     }
159     #endif //GLIBMM_EXCEPTIONS_ENABLED
160   }
161   else
162   {
163     BaseClassType *const base = static_cast<BaseClassType*>(
164         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
165 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
166 )    );
167
168     // Call the original underlying C function:
169     if(base && base->get_document)
170       return (*base->get_document)(self);
171   }
172
173   typedef gpointer RType;
174   return RType();
175 }
176 #endif //GLIBMM_VFUNCS_ENABLED
177
178 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
179 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
180
181
182 Glib::ObjectBase* Document_Class::wrap_new(GObject* object)
183 {
184   return new Document((AtkDocument*)(object));
185 }
186
187
188 /* The implementation: */
189
190 Document::Document()
191 :
192   Glib::Interface(document_class_.init())
193 {}
194
195 Document::Document(AtkDocument* castitem)
196 :
197   Glib::Interface((GObject*)(castitem))
198 {}
199
200 Document::~Document()
201 {}
202
203 // static
204 void Document::add_interface(GType gtype_implementer)
205 {
206   document_class_.init().add_interface(gtype_implementer);
207 }
208
209 Document::CppClassType Document::document_class_; // initialize static member
210
211 GType Document::get_type()
212 {
213   return document_class_.init().get_type();
214 }
215
216 GType Document::get_base_type()
217 {
218   return atk_document_get_type();
219 }
220
221
222 Glib::ustring Document::get_document_type() const
223 {
224   return Glib::convert_const_gchar_ptr_to_ustring(atk_document_get_document_type(const_cast<AtkDocument*>(gobj())));
225 }
226
227 gpointer Document::get_document()
228 {
229   return atk_document_get_document(gobj());
230 }
231
232
233 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
234 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
235
236 #ifdef GLIBMM_VFUNCS_ENABLED
237 const gchar* Atk::Document::get_document_type_vfunc() 
238 {
239   BaseClassType *const base = static_cast<BaseClassType*>(
240       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
241 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
242 )  );
243
244   if(base && base->get_document_type)
245     return (*base->get_document_type)(gobj());
246
247   typedef const gchar* RType;
248   return RType();
249 }
250 gpointer Atk::Document::get_document_vfunc() const
251 {
252   BaseClassType *const base = static_cast<BaseClassType*>(
253       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
254 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
255 )  );
256
257   if(base && base->get_document)
258     return (*base->get_document)(const_cast<AtkDocument*>(gobj()));
259
260   typedef gpointer RType;
261   return RType();
262 }
263 #endif //GLIBMM_VFUNCS_ENABLED
264
265
266 } // namespace Atk
267
268