fix for type error on 64 bit systems
[ardour.git] / libs / gtkmm2 / atk / atkmm / image.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <atkmm/image.h>
4 #include <atkmm/private/image_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <atkmm/object.h>
27 #include <atk/atkimage.h>
28
29
30 namespace
31 {
32 } // anonymous namespace
33
34
35 namespace Glib
36 {
37
38 Glib::RefPtr<Atk::Image> wrap(AtkImage* object, bool take_copy)
39 {
40   return Glib::RefPtr<Atk::Image>( dynamic_cast<Atk::Image*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
41   //We use dynamic_cast<> in case of multiple inheritance.
42 }
43
44 } // namespace Glib
45
46
47 namespace Atk
48 {
49
50
51 /* The *_Class implementation: */
52
53 const Glib::Interface_Class& Image_Class::init()
54 {
55   if(!gtype_) // create the GType if necessary
56   {
57     // Glib::Interface_Class has to know the interface init function
58     // in order to add interfaces to implementing types.
59     class_init_func_ = &Image_Class::iface_init_function;
60
61     // We can not derive from another interface, and it is not necessary anyway.
62     gtype_ = atk_image_get_type();
63   }
64
65   return *this;
66 }
67
68 void Image_Class::iface_init_function(void* g_iface, void*)
69 {
70   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
71
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
74   g_assert(klass != 0); 
75
76   klass->set_image_description = &set_image_description_vfunc_callback;
77   klass->get_image_description = &get_image_description_vfunc_callback;
78   klass->get_image_position = &get_image_position_vfunc_callback;
79   klass->get_image_size = &get_image_size_vfunc_callback;
80 }
81
82 gboolean Image_Class::set_image_description_vfunc_callback(AtkImage* self, const gchar* description)
83 {
84   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
85       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
86
87   // Non-gtkmmproc-generated custom classes implicitly call the default
88   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
89   // generated classes can use this optimisation, which avoids the unnecessary
90   // parameter conversions if there is no possibility of the virtual function
91   // being overridden:
92   if(obj && obj->is_derived_())
93   {
94     try // Trap C++ exceptions which would normally be lost because this is a C callback.
95     {
96       // Call the virtual member method, which derived classes might override.
97       return static_cast<int>(obj->set_image_description_vfunc(Glib::convert_const_gchar_ptr_to_ustring(description)
98 ));
99     }
100     catch(...)
101     {
102       Glib::exception_handlers_invoke();
103     }
104   }
105   else
106   {
107     BaseClassType *const base = static_cast<BaseClassType*>(
108         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
109 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
110 )    );
111
112     // Call the original underlying C function:
113     if(base && base->set_image_description)
114       return (*base->set_image_description)(self, description);
115   }
116
117   typedef gboolean RType;
118   return RType();
119 }
120
121 const gchar* Image_Class::get_image_description_vfunc_callback(AtkImage* self)
122 {
123   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
124       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
125
126   // Non-gtkmmproc-generated custom classes implicitly call the default
127   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
128   // generated classes can use this optimisation, which avoids the unnecessary
129   // parameter conversions if there is no possibility of the virtual function
130   // being overridden:
131   if(obj && obj->is_derived_())
132   {
133     try // Trap C++ exceptions which would normally be lost because this is a C callback.
134     {
135       // Call the virtual member method, which derived classes might override.
136       return obj->get_image_description_vfunc();
137     }
138     catch(...)
139     {
140       Glib::exception_handlers_invoke();
141     }
142   }
143   else
144   {
145     BaseClassType *const base = static_cast<BaseClassType*>(
146         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
147 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
148 )    );
149
150     // Call the original underlying C function:
151     if(base && base->get_image_description)
152       return (*base->get_image_description)(self);
153   }
154
155   typedef const gchar* RType;
156   return RType();
157 }
158
159 void Image_Class::get_image_position_vfunc_callback(AtkImage* self, gint* x, gint* y, AtkCoordType coord_type)
160 {
161   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
162       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
163
164   // Non-gtkmmproc-generated custom classes implicitly call the default
165   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
166   // generated classes can use this optimisation, which avoids the unnecessary
167   // parameter conversions if there is no possibility of the virtual function
168   // being overridden:
169   if(obj && obj->is_derived_())
170   {
171     try // Trap C++ exceptions which would normally be lost because this is a C callback.
172     {
173       // Call the virtual member method, which derived classes might override.
174       obj->get_image_position_vfunc(*(x)
175 , *(y)
176 , ((CoordType)(coord_type))
177 );
178     }
179     catch(...)
180     {
181       Glib::exception_handlers_invoke();
182     }
183   }
184   else
185   {
186     BaseClassType *const base = static_cast<BaseClassType*>(
187         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
188 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
189 )    );
190
191     // Call the original underlying C function:
192     if(base && base->get_image_position)
193       (*base->get_image_position)(self, x, y, coord_type);
194   }
195 }
196
197 void Image_Class::get_image_size_vfunc_callback(AtkImage* self, gint* width, gint* height)
198 {
199   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
200       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
201
202   // Non-gtkmmproc-generated custom classes implicitly call the default
203   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
204   // generated classes can use this optimisation, which avoids the unnecessary
205   // parameter conversions if there is no possibility of the virtual function
206   // being overridden:
207   if(obj && obj->is_derived_())
208   {
209     try // Trap C++ exceptions which would normally be lost because this is a C callback.
210     {
211       // Call the virtual member method, which derived classes might override.
212       obj->get_image_size_vfunc(*(width)
213 , *(height)
214 );
215     }
216     catch(...)
217     {
218       Glib::exception_handlers_invoke();
219     }
220   }
221   else
222   {
223     BaseClassType *const base = static_cast<BaseClassType*>(
224         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
225 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
226 )    );
227
228     // Call the original underlying C function:
229     if(base && base->get_image_size)
230       (*base->get_image_size)(self, width, height);
231   }
232 }
233
234
235 Glib::ObjectBase* Image_Class::wrap_new(GObject* object)
236 {
237   return new Image((AtkImage*)(object));
238 }
239
240
241 /* The implementation: */
242
243 Image::Image()
244 :
245   Glib::Interface(image_class_.init())
246 {}
247
248 Image::Image(AtkImage* castitem)
249 :
250   Glib::Interface((GObject*)(castitem))
251 {}
252
253 Image::~Image()
254 {}
255
256 // static
257 void Image::add_interface(GType gtype_implementer)
258 {
259   image_class_.init().add_interface(gtype_implementer);
260 }
261
262 Image::CppClassType Image::image_class_; // initialize static member
263
264 GType Image::get_type()
265 {
266   return image_class_.init().get_type();
267 }
268
269 GType Image::get_base_type()
270 {
271   return atk_image_get_type();
272 }
273
274
275 bool Image::set_image_description(const Glib::ustring& description)
276 {
277   return atk_image_set_image_description(gobj(), description.c_str());
278 }
279
280 Glib::ustring Image::get_image_description() const
281 {
282   return Glib::convert_const_gchar_ptr_to_ustring(atk_image_get_image_description(const_cast<AtkImage*>(gobj())));
283 }
284
285 void Image::get_image_size(int& width, int& height) const
286 {
287   atk_image_get_image_size(const_cast<AtkImage*>(gobj()), &width, &height);
288 }
289
290 void Image::get_image_position(int& x, int& y, CoordType coord_type) const
291 {
292   atk_image_get_image_position(const_cast<AtkImage*>(gobj()), &x, &y, ((AtkCoordType)(coord_type)));
293 }
294
295
296 bool Atk::Image::set_image_description_vfunc(const Glib::ustring& description) 
297 {
298   BaseClassType *const base = static_cast<BaseClassType*>(
299       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
300 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
301 )  );
302
303   if(base && base->set_image_description)
304     return (*base->set_image_description)(gobj(),description.c_str());
305
306   typedef bool RType;
307   return RType();
308 }
309
310 const char* Atk::Image::get_image_description_vfunc() const
311 {
312   BaseClassType *const base = static_cast<BaseClassType*>(
313       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
314 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
315 )  );
316
317   if(base && base->get_image_description)
318     return (*base->get_image_description)(const_cast<AtkImage*>(gobj()));
319
320   typedef const char* RType;
321   return RType();
322 }
323
324 void Atk::Image::get_image_position_vfunc(int& x, int& y, CoordType coord_type) const
325 {
326   BaseClassType *const base = static_cast<BaseClassType*>(
327       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
328 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
329 )  );
330
331   if(base && base->get_image_position)
332     (*base->get_image_position)(const_cast<AtkImage*>(gobj()),&x,&y,((AtkCoordType)(coord_type)));
333 }
334
335 void Atk::Image::get_image_size_vfunc(int& width, int& height) const
336 {
337   BaseClassType *const base = static_cast<BaseClassType*>(
338       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
339 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
340 )  );
341
342   if(base && base->get_image_size)
343     (*base->get_image_size)(const_cast<AtkImage*>(gobj()),&width,&height);
344 }
345
346
347 } // namespace Atk
348
349