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