1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/image.h>
5 #include <gtkmm/private/image_p.h>
7 #include <gtk/gtktypebuiltins.h>
13 * Copyright 1998-2002 The gtkmm Development Team
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Library General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or (at your option) any later version.
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 * Library General Public License for more details.
25 * You should have received a copy of the GNU Library 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.
30 #include <gtk/gtkimage.h>
31 #include <gdkmm/image.h>
32 #include <gdkmm/bitmap.h>
33 #include <gdkmm/pixmap.h>
38 Image::Image(const Gtk::StockID& stock_id, IconSize size)
40 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
42 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "stock",stock_id.get_c_str(),"icon-size",(GtkIconSize) int(size), static_cast<char*>(0)))
45 Image::Image(IconSet& icon_set, IconSize size)
47 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
49 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "icon-set",icon_set.gobj(),"icon-size",(GtkIconSize) int(size), static_cast<char*>(0)))
52 Image::Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
54 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
56 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixbuf-animation",Glib::unwrap(animation), static_cast<char*>(0)))
59 void Image::get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const
61 GdkPixmap* pPixmap = 0;
62 GdkBitmap* pBitmap = 0;
64 gtk_image_get_pixmap(const_cast<GtkImage*>(gobj()), &pPixmap, &pBitmap);
66 pixmap = Glib::wrap((GdkPixmapObject*) pPixmap, true);
67 mask = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
70 void Image::get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const
73 GdkBitmap* pBitmap = 0;
75 gtk_image_get_image(const_cast<GtkImage*>(gobj()), &pImage, &pBitmap);
77 gdk_image = Glib::wrap(pImage, true);
78 mask = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
81 void Image::get_stock(Gtk::StockID& stock_id, IconSize& size) const
83 char* pStockID = 0; // GTK+ iconsistency: although not const, it should not be freed.
84 GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
86 gtk_image_get_stock(const_cast<GtkImage*>(gobj()), &pStockID, &icon_size);
88 size = IconSize(static_cast<int>(icon_size));
89 stock_id = Gtk::StockID(pStockID); // the StockID ctor checks for 0
92 void Image::get_icon_set(IconSet& icon_set, IconSize& size) const
94 GtkIconSet* pIconSet = 0;
95 GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
97 gtk_image_get_icon_set(const_cast<GtkImage*>(gobj()), &pIconSet, &icon_size);
99 size = IconSize(static_cast<int>(icon_size));
100 icon_set = Glib::wrap(pIconSet, true); //true = take_copy.
103 Glib::ustring Image::get_icon_name() const
105 const gchar* pchIconName = 0;
106 gtk_image_get_icon_name(const_cast<GtkImage*>(gobj()), &pchIconName, 0);
107 return Glib::convert_const_gchar_ptr_to_ustring(pchIconName);
110 Glib::ustring Image::get_icon_name(IconSize& size)
112 const gchar* pchIconName = 0;
113 GtkIconSize cIconSize = GTK_ICON_SIZE_INVALID;
114 gtk_image_get_icon_name(const_cast<GtkImage*>(gobj()), &pchIconName, &cIconSize);
115 size = (IconSize)cIconSize;
116 return Glib::convert_const_gchar_ptr_to_ustring(pchIconName);
124 } // anonymous namespace
127 GType Glib::Value<Gtk::ImageType>::value_type()
129 return gtk_image_type_get_type();
136 Gtk::Image* wrap(GtkImage* object, bool take_copy)
138 return dynamic_cast<Gtk::Image *> (Glib::wrap_auto ((GObject*)(object), take_copy));
141 } /* namespace Glib */
147 /* The *_Class implementation: */
149 const Glib::Class& Image_Class::init()
151 if(!gtype_) // create the GType if necessary
153 // Glib::Class has to know the class init function to clone custom types.
154 class_init_func_ = &Image_Class::class_init_function;
156 // This is actually just optimized away, apparently with no harm.
157 // Make sure that the parent type has been created.
158 //CppClassParent::CppObjectType::get_type();
160 // Create the wrapper type, with the same class/instance size as the base type.
161 register_derived_type(gtk_image_get_type());
163 // Add derived versions of interfaces, if the C type implements any interfaces:
169 void Image_Class::class_init_function(void* g_class, void* class_data)
171 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
172 CppClassParent::class_init_function(klass, class_data);
174 #ifdef GLIBMM_VFUNCS_ENABLED
175 #endif //GLIBMM_VFUNCS_ENABLED
177 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
178 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
181 #ifdef GLIBMM_VFUNCS_ENABLED
182 #endif //GLIBMM_VFUNCS_ENABLED
184 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
185 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
188 Glib::ObjectBase* Image_Class::wrap_new(GObject* o)
190 return manage(new Image((GtkImage*)(o)));
195 /* The implementation: */
197 Image::Image(const Glib::ConstructParams& construct_params)
199 Gtk::Misc(construct_params)
203 Image::Image(GtkImage* castitem)
205 Gtk::Misc((GtkMisc*)(castitem))
214 Image::CppClassType Image::image_class_; // initialize static member
216 GType Image::get_type()
218 return image_class_.init().get_type();
221 GType Image::get_base_type()
223 return gtk_image_get_type();
229 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
231 Gtk::Misc(Glib::ConstructParams(image_class_.init()))
235 Image::Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
237 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
239 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixmap", Glib::unwrap(pixmap), "mask", Glib::unwrap(mask), static_cast<char*>(0)))
243 Image::Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask)
245 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
247 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "image", Glib::unwrap(image), "mask", Glib::unwrap(mask), static_cast<char*>(0)))
251 Image::Image(const std::string& file)
253 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
255 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "file", file.c_str(), static_cast<char*>(0)))
259 Image::Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
261 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
263 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixbuf", Glib::unwrap(pixbuf), static_cast<char*>(0)))
267 void Image::set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
269 gtk_image_set_from_pixmap(gobj(), Glib::unwrap(pixmap), Glib::unwrap(mask));
272 void Image::set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask)
274 gtk_image_set_from_image(gobj(), Glib::unwrap(gdk_image), Glib::unwrap(mask));
277 void Image::set(const std::string& filename)
279 gtk_image_set_from_file(gobj(), filename.c_str());
282 void Image::set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
284 gtk_image_set_from_pixbuf(gobj(), Glib::unwrap(pixbuf));
287 void Image::set(const Gtk::StockID& stock_id, IconSize size)
289 gtk_image_set_from_stock(gobj(), (stock_id).get_c_str(), static_cast<GtkIconSize>(int(size)));
292 void Image::set(IconSet& icon_set, IconSize size)
294 gtk_image_set_from_icon_set(gobj(), (icon_set).gobj(), static_cast<GtkIconSize>(int(size)));
297 void Image::set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
299 gtk_image_set_from_animation(gobj(), Glib::unwrap(animation));
302 void Image::set_from_icon_name(const Glib::ustring& icon_name, IconSize size)
304 gtk_image_set_from_icon_name(gobj(), icon_name.c_str(), static_cast<GtkIconSize>(int(size)));
309 gtk_image_clear(gobj());
312 ImageType Image::get_storage_type() const
314 return ((ImageType)(gtk_image_get_storage_type(const_cast<GtkImage*>(gobj()))));
317 Glib::RefPtr<Gdk::Pixbuf> Image::get_pixbuf()
320 Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_image_get_pixbuf(gobj()));
322 retvalue->reference(); //The function does not do a ref for us.
327 Glib::RefPtr<const Gdk::Pixbuf> Image::get_pixbuf() const
329 return const_cast<Image*>(this)->get_pixbuf();
332 Glib::RefPtr<Gdk::PixbufAnimation> Image::get_animation()
335 Glib::RefPtr<Gdk::PixbufAnimation> retvalue = Glib::wrap(gtk_image_get_animation(gobj()));
337 retvalue->reference(); //The function does not do a ref for us.
342 Glib::RefPtr<const Gdk::PixbufAnimation> Image::get_animation() const
344 return const_cast<Image*>(this)->get_animation();
347 int Image::get_pixel_size() const
349 return gtk_image_get_pixel_size(const_cast<GtkImage*>(gobj()));
352 void Image::set_pixel_size(int pixel_size)
354 gtk_image_set_pixel_size(gobj(), pixel_size);
358 #ifdef GLIBMM_PROPERTIES_ENABLED
359 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf()
361 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
363 #endif //GLIBMM_PROPERTIES_ENABLED
365 #ifdef GLIBMM_PROPERTIES_ENABLED
366 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf() const
368 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
370 #endif //GLIBMM_PROPERTIES_ENABLED
372 #ifdef GLIBMM_PROPERTIES_ENABLED
373 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap()
375 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
377 #endif //GLIBMM_PROPERTIES_ENABLED
379 #ifdef GLIBMM_PROPERTIES_ENABLED
380 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap() const
382 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
384 #endif //GLIBMM_PROPERTIES_ENABLED
386 #ifdef GLIBMM_PROPERTIES_ENABLED
387 Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> > Image::property_image()
389 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> >(this, "image");
391 #endif //GLIBMM_PROPERTIES_ENABLED
393 #ifdef GLIBMM_PROPERTIES_ENABLED
394 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> > Image::property_image() const
396 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> >(this, "image");
398 #endif //GLIBMM_PROPERTIES_ENABLED
400 #ifdef GLIBMM_PROPERTIES_ENABLED
401 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask()
403 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
405 #endif //GLIBMM_PROPERTIES_ENABLED
407 #ifdef GLIBMM_PROPERTIES_ENABLED
408 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask() const
410 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
412 #endif //GLIBMM_PROPERTIES_ENABLED
414 #ifdef GLIBMM_PROPERTIES_ENABLED
415 Glib::PropertyProxy<Glib::ustring> Image::property_file()
417 return Glib::PropertyProxy<Glib::ustring>(this, "file");
419 #endif //GLIBMM_PROPERTIES_ENABLED
421 #ifdef GLIBMM_PROPERTIES_ENABLED
422 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_file() const
424 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "file");
426 #endif //GLIBMM_PROPERTIES_ENABLED
428 #ifdef GLIBMM_PROPERTIES_ENABLED
429 Glib::PropertyProxy<Glib::ustring> Image::property_stock()
431 return Glib::PropertyProxy<Glib::ustring>(this, "stock");
433 #endif //GLIBMM_PROPERTIES_ENABLED
435 #ifdef GLIBMM_PROPERTIES_ENABLED
436 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_stock() const
438 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "stock");
440 #endif //GLIBMM_PROPERTIES_ENABLED
442 #ifdef GLIBMM_PROPERTIES_ENABLED
443 Glib::PropertyProxy<Gtk::IconSet> Image::property_icon_set()
445 return Glib::PropertyProxy<Gtk::IconSet>(this, "icon-set");
447 #endif //GLIBMM_PROPERTIES_ENABLED
449 #ifdef GLIBMM_PROPERTIES_ENABLED
450 Glib::PropertyProxy_ReadOnly<Gtk::IconSet> Image::property_icon_set() const
452 return Glib::PropertyProxy_ReadOnly<Gtk::IconSet>(this, "icon-set");
454 #endif //GLIBMM_PROPERTIES_ENABLED
456 #ifdef GLIBMM_PROPERTIES_ENABLED
457 Glib::PropertyProxy<int> Image::property_icon_size()
459 return Glib::PropertyProxy<int>(this, "icon-size");
461 #endif //GLIBMM_PROPERTIES_ENABLED
463 #ifdef GLIBMM_PROPERTIES_ENABLED
464 Glib::PropertyProxy_ReadOnly<int> Image::property_icon_size() const
466 return Glib::PropertyProxy_ReadOnly<int>(this, "icon-size");
468 #endif //GLIBMM_PROPERTIES_ENABLED
470 #ifdef GLIBMM_PROPERTIES_ENABLED
471 Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation()
473 return Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
475 #endif //GLIBMM_PROPERTIES_ENABLED
477 #ifdef GLIBMM_PROPERTIES_ENABLED
478 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation() const
480 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
482 #endif //GLIBMM_PROPERTIES_ENABLED
484 #ifdef GLIBMM_PROPERTIES_ENABLED
485 Glib::PropertyProxy_ReadOnly<ImageType> Image::property_storage_type() const
487 return Glib::PropertyProxy_ReadOnly<ImageType>(this, "storage-type");
489 #endif //GLIBMM_PROPERTIES_ENABLED
492 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
493 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
495 #ifdef GLIBMM_VFUNCS_ENABLED
496 #endif //GLIBMM_VFUNCS_ENABLED