1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <atkmm/image.h>
4 #include <atkmm/private/image_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
26 #include <atkmm/object.h>
27 #include <atk/atkimage.h>
32 } // anonymous namespace
38 Glib::RefPtr<Atk::Image> wrap(AtkImage* object, bool take_copy)
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.
51 /* The *_Class implementation: */
53 const Glib::Interface_Class& Image_Class::init()
55 if(!gtype_) // create the GType if necessary
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;
61 // We can not derive from another interface, and it is not necessary anyway.
62 gtype_ = atk_image_get_type();
68 void Image_Class::iface_init_function(void* g_iface, void*)
70 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
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
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;
82 gboolean Image_Class::set_image_description_vfunc_callback(AtkImage* self, const gchar* description)
84 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
85 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
92 if(obj && obj->is_derived_())
94 try // Trap C++ exceptions which would normally be lost because this is a C callback.
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)
102 Glib::exception_handlers_invoke();
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.
112 // Call the original underlying C function:
113 if(base && base->set_image_description)
114 return (*base->set_image_description)(self, description);
117 typedef gboolean RType;
121 const gchar* Image_Class::get_image_description_vfunc_callback(AtkImage* self)
123 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
124 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
131 if(obj && obj->is_derived_())
133 try // Trap C++ exceptions which would normally be lost because this is a C callback.
135 // Call the virtual member method, which derived classes might override.
136 return obj->get_image_description_vfunc();
140 Glib::exception_handlers_invoke();
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.
150 // Call the original underlying C function:
151 if(base && base->get_image_description)
152 return (*base->get_image_description)(self);
155 typedef const gchar* RType;
159 void Image_Class::get_image_position_vfunc_callback(AtkImage* self, gint* x, gint* y, AtkCoordType coord_type)
161 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
162 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
169 if(obj && obj->is_derived_())
171 try // Trap C++ exceptions which would normally be lost because this is a C callback.
173 // Call the virtual member method, which derived classes might override.
174 obj->get_image_position_vfunc(*(x)
176 , ((CoordType)(coord_type))
181 Glib::exception_handlers_invoke();
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.
191 // Call the original underlying C function:
192 if(base && base->get_image_position)
193 (*base->get_image_position)(self, x, y, coord_type);
197 void Image_Class::get_image_size_vfunc_callback(AtkImage* self, gint* width, gint* height)
199 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
200 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
207 if(obj && obj->is_derived_())
209 try // Trap C++ exceptions which would normally be lost because this is a C callback.
211 // Call the virtual member method, which derived classes might override.
212 obj->get_image_size_vfunc(*(width)
218 Glib::exception_handlers_invoke();
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.
228 // Call the original underlying C function:
229 if(base && base->get_image_size)
230 (*base->get_image_size)(self, width, height);
235 Glib::ObjectBase* Image_Class::wrap_new(GObject* object)
237 return new Image((AtkImage*)(object));
241 /* The implementation: */
245 Glib::Interface(image_class_.init())
248 Image::Image(AtkImage* castitem)
250 Glib::Interface((GObject*)(castitem))
257 void Image::add_interface(GType gtype_implementer)
259 image_class_.init().add_interface(gtype_implementer);
262 Image::CppClassType Image::image_class_; // initialize static member
264 GType Image::get_type()
266 return image_class_.init().get_type();
269 GType Image::get_base_type()
271 return atk_image_get_type();
275 bool Image::set_image_description(const Glib::ustring& description)
277 return atk_image_set_image_description(gobj(), description.c_str());
280 Glib::ustring Image::get_image_description() const
282 return Glib::convert_const_gchar_ptr_to_ustring(atk_image_get_image_description(const_cast<AtkImage*>(gobj())));
285 void Image::get_image_size(int& width, int& height) const
287 atk_image_get_image_size(const_cast<AtkImage*>(gobj()), &width, &height);
290 void Image::get_image_position(int& x, int& y, CoordType coord_type) const
292 atk_image_get_image_position(const_cast<AtkImage*>(gobj()), &x, &y, ((AtkCoordType)(coord_type)));
296 bool Atk::Image::set_image_description_vfunc(const Glib::ustring& description)
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.
303 if(base && base->set_image_description)
304 return (*base->set_image_description)(gobj(),description.c_str());
310 const char* Atk::Image::get_image_description_vfunc() const
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.
317 if(base && base->get_image_description)
318 return (*base->get_image_description)(const_cast<AtkImage*>(gobj()));
320 typedef const char* RType;
324 void Atk::Image::get_image_position_vfunc(int& x, int& y, CoordType coord_type) const
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.
331 if(base && base->get_image_position)
332 (*base->get_image_position)(const_cast<AtkImage*>(gobj()),&x,&y,((AtkCoordType)(coord_type)));
335 void Atk::Image::get_image_size_vfunc(int& width, int& height) const
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.
342 if(base && base->get_image_size)
343 (*base->get_image_size)(const_cast<AtkImage*>(gobj()),&width,&height);