1 // Generated by gmmproc 2.56.0 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <atkmm/document.h>
7 #include <atkmm/private/document_p.h>
8
9
10 // -*- c++ -*-
11 /* $Id: document.ccg,v 1.1 2004/01/02 09:56:43 murrayc Exp $ */
12
13 /* Copyright 2003 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 <atkmm/object.h>
31 #include <atk/atkdocument.h>
32
33
34 namespace Atk
35 {
36
37
38 } // namespace Atk
39
40
41 namespace
42 {
43 } // anonymous namespace
44
45
46 namespace Glib
47 {
48
wrap(AtkDocument * object,bool take_copy)49 Glib::RefPtr<Atk::Document> wrap(AtkDocument* object, bool take_copy)
50 {
51 return Glib::RefPtr<Atk::Document>( dynamic_cast<Atk::Document*> (Glib::wrap_auto_interface<Atk::Document> ((GObject*)(object), take_copy)) );
52 //We use dynamic_cast<> in case of multiple inheritance.
53 }
54
55 } // namespace Glib
56
57
58 namespace Atk
59 {
60
61
62 /* The *_Class implementation: */
63
init()64 const Glib::Interface_Class& Document_Class::init()
65 {
66 if(!gtype_) // create the GType if necessary
67 {
68 // Glib::Interface_Class has to know the interface init function
69 // in order to add interfaces to implementing types.
70 class_init_func_ = &Document_Class::iface_init_function;
71
72 // We can not derive from another interface, and it is not necessary anyway.
73 gtype_ = atk_document_get_type();
74 }
75
76 return *this;
77 }
78
iface_init_function(void * g_iface,void *)79 void Document_Class::iface_init_function(void* g_iface, void*)
80 {
81 const auto klass = static_cast<BaseClassType*>(g_iface);
82
83 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
84 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
85 g_assert(klass != nullptr);
86
87 klass->get_document_type = &get_document_type_vfunc_callback;
88 klass->get_document = &get_document_vfunc_callback;
89
90 }
91
get_document_type_vfunc_callback(AtkDocument * self)92 const gchar* Document_Class::get_document_type_vfunc_callback(AtkDocument* self)
93 {
94 const auto obj_base = static_cast<Glib::ObjectBase*>(
95 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
96
97 // Non-gtkmmproc-generated custom classes implicitly call the default
98 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
99 // generated classes can use this optimisation, which avoids the unnecessary
100 // parameter conversions if there is no possibility of the virtual function
101 // being overridden:
102 if(obj_base && obj_base->is_derived_())
103 {
104 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
105 if(obj) // This can be NULL during destruction.
106 {
107 try // Trap C++ exceptions which would normally be lost because this is a C callback.
108 {
109 // Call the virtual member method, which derived classes might override.
110 return obj->get_document_type_vfunc();
111 }
112 catch(...)
113 {
114 Glib::exception_handlers_invoke();
115 }
116 }
117 }
118
119 BaseClassType *const base = static_cast<BaseClassType*>(
120 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
121 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
122 ) );
123
124 // Call the original underlying C function:
125 if(base && base->get_document_type)
126 return (*base->get_document_type)(self);
127
128 using RType = const gchar*;
129 return RType();
130 }
get_document_vfunc_callback(AtkDocument * self)131 gpointer Document_Class::get_document_vfunc_callback(AtkDocument* self)
132 {
133 const auto obj_base = static_cast<Glib::ObjectBase*>(
134 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
135
136 // Non-gtkmmproc-generated custom classes implicitly call the default
137 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
138 // generated classes can use this optimisation, which avoids the unnecessary
139 // parameter conversions if there is no possibility of the virtual function
140 // being overridden:
141 if(obj_base && obj_base->is_derived_())
142 {
143 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
144 if(obj) // This can be NULL during destruction.
145 {
146 try // Trap C++ exceptions which would normally be lost because this is a C callback.
147 {
148 // Call the virtual member method, which derived classes might override.
149 return obj->get_document_vfunc();
150 }
151 catch(...)
152 {
153 Glib::exception_handlers_invoke();
154 }
155 }
156 }
157
158 BaseClassType *const base = static_cast<BaseClassType*>(
159 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
160 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
161 ) );
162
163 // Call the original underlying C function:
164 if(base && base->get_document)
165 return (*base->get_document)(self);
166
167 using RType = gpointer;
168 return RType();
169 }
170
171
wrap_new(GObject * object)172 Glib::ObjectBase* Document_Class::wrap_new(GObject* object)
173 {
174 return new Document((AtkDocument*)(object));
175 }
176
177
178 /* The implementation: */
179
Document()180 Document::Document()
181 :
182 Glib::Interface(document_class_.init())
183 {}
184
Document(AtkDocument * castitem)185 Document::Document(AtkDocument* castitem)
186 :
187 Glib::Interface((GObject*)(castitem))
188 {}
189
Document(const Glib::Interface_Class & interface_class)190 Document::Document(const Glib::Interface_Class& interface_class)
191 : Glib::Interface(interface_class)
192 {
193 }
194
Document(Document && src)195 Document::Document(Document&& src) noexcept
196 : Glib::Interface(std::move(src))
197 {}
198
operator =(Document && src)199 Document& Document::operator=(Document&& src) noexcept
200 {
201 Glib::Interface::operator=(std::move(src));
202 return *this;
203 }
204
~Document()205 Document::~Document() noexcept
206 {}
207
208 // static
add_interface(GType gtype_implementer)209 void Document::add_interface(GType gtype_implementer)
210 {
211 document_class_.init().add_interface(gtype_implementer);
212 }
213
214 Document::CppClassType Document::document_class_; // initialize static member
215
get_type()216 GType Document::get_type()
217 {
218 return document_class_.init().get_type();
219 }
220
221
get_base_type()222 GType Document::get_base_type()
223 {
224 return atk_document_get_type();
225 }
226
227
228 #ifndef ATKMM_DISABLE_DEPRECATED
229 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_document_type() const230 Glib::ustring Document::get_document_type() const
231 {
232 return Glib::convert_const_gchar_ptr_to_ustring(atk_document_get_document_type(const_cast<AtkDocument*>(gobj())));
233 }
234 G_GNUC_END_IGNORE_DEPRECATIONS
235 #endif // ATKMM_DISABLE_DEPRECATED
236
237 #ifndef ATKMM_DISABLE_DEPRECATED
238 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_document()239 gpointer Document::get_document()
240 {
241 return atk_document_get_document(gobj());
242 }
243 G_GNUC_END_IGNORE_DEPRECATIONS
244 #endif // ATKMM_DISABLE_DEPRECATED
245
get_attribute_value(const Glib::ustring & attribute_name) const246 Glib::ustring Document::get_attribute_value(const Glib::ustring& attribute_name) const
247 {
248 return Glib::convert_const_gchar_ptr_to_ustring(atk_document_get_attribute_value(const_cast<AtkDocument*>(gobj()), attribute_name.c_str()));
249 }
250
set_attribute_value(const Glib::ustring & attribute_name,const Glib::ustring & attribute_value)251 bool Document::set_attribute_value(const Glib::ustring& attribute_name, const Glib::ustring& attribute_value)
252 {
253 return atk_document_set_attribute_value(gobj(), attribute_name.c_str(), attribute_value.c_str());
254 }
255
256
get_document_type_vfunc()257 const gchar* Atk::Document::get_document_type_vfunc()
258 {
259 const auto base = static_cast<BaseClassType*>(
260 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
261 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
262 ) );
263
264 if(base && base->get_document_type)
265 {
266 const gchar* retval((*base->get_document_type)(gobj()));
267 return retval;
268 }
269
270 using RType = const gchar*;
271 return RType();
272 }
get_document_vfunc() const273 gpointer Atk::Document::get_document_vfunc() const
274 {
275 const auto 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(gobject_), CppObjectType::get_type()) // Get the interface.
278 ) );
279
280 if(base && base->get_document)
281 {
282 gpointer retval((*base->get_document)(const_cast<AtkDocument*>(gobj())));
283 return retval;
284 }
285
286 using RType = gpointer;
287 return RType();
288 }
289
290
291 } // namespace Atk
292
293
294