1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/image.h>
4 #include <gtkmm/private/image_p.h>
6 #include <gtk/gtktypebuiltins.h>
12 * Copyright 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtk/gtkimage.h>
30 #include <gdkmm/image.h>
31 #include <gdkmm/bitmap.h>
32 #include <gdkmm/pixmap.h>
37 Image::Image(const Gtk::StockID& stock_id, IconSize size)
39 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
40 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "stock",stock_id.get_c_str(),"icon-size",(GtkIconSize) int(size), (char*) 0))
43 Image::Image(IconSet& icon_set, IconSize size)
45 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
46 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "icon-set",icon_set.gobj(),"icon-size",(GtkIconSize) int(size), (char*) 0))
49 Image::Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
51 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
52 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixbuf-animation",Glib::unwrap(animation), (char*) 0))
55 void Image::get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const
57 GdkPixmap* pPixmap = 0;
58 GdkBitmap* pBitmap = 0;
60 gtk_image_get_pixmap(const_cast<GtkImage*>(gobj()), &pPixmap, &pBitmap);
62 pixmap = Glib::wrap((GdkPixmapObject*) pPixmap, true);
63 mask = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
66 void Image::get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const
69 GdkBitmap* pBitmap = 0;
71 gtk_image_get_image(const_cast<GtkImage*>(gobj()), &pImage, &pBitmap);
73 gdk_image = Glib::wrap(pImage, true);
74 mask = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
77 void Image::get_stock(Gtk::StockID& stock_id, IconSize& size) const
79 char* pStockID = 0; // GTK+ iconsistency: although not const, it should not be freed.
80 GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
82 gtk_image_get_stock(const_cast<GtkImage*>(gobj()), &pStockID, &icon_size);
84 size = IconSize(static_cast<int>(icon_size));
85 stock_id = Gtk::StockID(pStockID); // the StockID ctor checks for 0
88 void Image::get_icon_set(IconSet& icon_set, IconSize& size) const
90 GtkIconSet* pIconSet = 0;
91 GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
93 gtk_image_get_icon_set(const_cast<GtkImage*>(gobj()), &pIconSet, &icon_size);
95 size = IconSize(static_cast<int>(icon_size));
96 icon_set = Glib::wrap(pIconSet, true); //true = take_copy.
101 gtk_image_set_from_pixbuf(gobj(), 0);
104 Glib::ustring Image::get_icon_name() const
106 const gchar* pchIconName = 0;
107 gtk_image_get_icon_name(const_cast<GtkImage*>(gobj()), &pchIconName, 0);
108 return Glib::convert_const_gchar_ptr_to_ustring(pchIconName);
111 Glib::ustring Image::get_icon_name(IconSize& size)
113 const gchar* pchIconName = 0;
114 GtkIconSize cIconSize = GTK_ICON_SIZE_INVALID;
115 gtk_image_get_icon_name(const_cast<GtkImage*>(gobj()), &pchIconName, &cIconSize);
116 size = (IconSize)cIconSize;
117 return Glib::convert_const_gchar_ptr_to_ustring(pchIconName);
125 } // anonymous namespace
128 GType Glib::Value<Gtk::ImageType>::value_type()
130 return gtk_image_type_get_type();
137 Gtk::Image* wrap(GtkImage* object, bool take_copy)
139 return dynamic_cast<Gtk::Image *> (Glib::wrap_auto ((GObject*)(object), take_copy));
142 } /* namespace Glib */
148 /* The *_Class implementation: */
150 const Glib::Class& Image_Class::init()
152 if(!gtype_) // create the GType if necessary
154 // Glib::Class has to know the class init function to clone custom types.
155 class_init_func_ = &Image_Class::class_init_function;
157 // This is actually just optimized away, apparently with no harm.
158 // Make sure that the parent type has been created.
159 //CppClassParent::CppObjectType::get_type();
161 // Create the wrapper type, with the same class/instance size as the base type.
162 register_derived_type(gtk_image_get_type());
164 // Add derived versions of interfaces, if the C type implements any interfaces:
170 void Image_Class::class_init_function(void* g_class, void* class_data)
172 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
173 CppClassParent::class_init_function(klass, class_data);
178 Glib::ObjectBase* Image_Class::wrap_new(GObject* o)
180 return manage(new Image((GtkImage*)(o)));
185 /* The implementation: */
187 Image::Image(const Glib::ConstructParams& construct_params)
189 Gtk::Misc(construct_params)
193 Image::Image(GtkImage* castitem)
195 Gtk::Misc((GtkMisc*)(castitem))
204 Image::CppClassType Image::image_class_; // initialize static member
206 GType Image::get_type()
208 return image_class_.init().get_type();
211 GType Image::get_base_type()
213 return gtk_image_get_type();
219 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
220 Gtk::Misc(Glib::ConstructParams(image_class_.init()))
224 Image::Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
226 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
227 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixmap", Glib::unwrap(pixmap), "mask", Glib::unwrap(mask), (char*) 0))
231 Image::Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask)
233 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
234 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "image", Glib::unwrap(image), "mask", Glib::unwrap(mask), (char*) 0))
238 Image::Image(const std::string& file)
240 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
241 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "file", file.c_str(), (char*) 0))
245 Image::Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
247 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
248 Gtk::Misc(Glib::ConstructParams(image_class_.init(), "pixbuf", Glib::unwrap(pixbuf), (char*) 0))
252 void Image::set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
254 gtk_image_set_from_pixmap(gobj(), Glib::unwrap(pixmap), Glib::unwrap(mask));
257 void Image::set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask)
259 gtk_image_set_from_image(gobj(), Glib::unwrap(gdk_image), Glib::unwrap(mask));
262 void Image::set(const std::string& filename)
264 gtk_image_set_from_file(gobj(), filename.c_str());
267 void Image::set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
269 gtk_image_set_from_pixbuf(gobj(), Glib::unwrap(pixbuf));
272 void Image::set(const Gtk::StockID& stock_id, IconSize size)
274 gtk_image_set_from_stock(gobj(), (stock_id).get_c_str(), static_cast<GtkIconSize>(int(size)));
277 void Image::set(IconSet& icon_set, IconSize size)
279 gtk_image_set_from_icon_set(gobj(), (icon_set).gobj(), static_cast<GtkIconSize>(int(size)));
282 void Image::set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
284 gtk_image_set_from_animation(gobj(), Glib::unwrap(animation));
287 void Image::set_from_icon_name(const Glib::ustring& icon_name, IconSize size)
289 gtk_image_set_from_icon_name(gobj(), icon_name.c_str(), static_cast<GtkIconSize>(int(size)));
292 ImageType Image::get_storage_type() const
294 return ((ImageType)(gtk_image_get_storage_type(const_cast<GtkImage*>(gobj()))));
297 Glib::RefPtr<Gdk::Pixbuf> Image::get_pixbuf()
300 Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_image_get_pixbuf(gobj()));
303 retvalue->reference(); //The function does not do a ref for us.
307 Glib::RefPtr<const Gdk::Pixbuf> Image::get_pixbuf() const
310 Glib::RefPtr<const Gdk::Pixbuf> retvalue = Glib::wrap(gtk_image_get_pixbuf(const_cast<GtkImage*>(gobj())));
313 retvalue->reference(); //The function does not do a ref for us.
317 Glib::RefPtr<Gdk::PixbufAnimation> Image::get_animation()
320 Glib::RefPtr<Gdk::PixbufAnimation> retvalue = Glib::wrap(gtk_image_get_animation(gobj()));
323 retvalue->reference(); //The function does not do a ref for us.
327 Glib::RefPtr<const Gdk::PixbufAnimation> Image::get_animation() const
330 Glib::RefPtr<const Gdk::PixbufAnimation> retvalue = Glib::wrap(gtk_image_get_animation(const_cast<GtkImage*>(gobj())));
333 retvalue->reference(); //The function does not do a ref for us.
337 int Image::get_pixel_size() const
339 return gtk_image_get_pixel_size(const_cast<GtkImage*>(gobj()));
342 void Image::set_pixel_size(int pixel_size)
344 gtk_image_set_pixel_size(gobj(), pixel_size);
348 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf()
350 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
353 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf() const
355 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
358 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap()
360 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
363 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap() const
365 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
368 Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> > Image::property_image()
370 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> >(this, "image");
373 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> > Image::property_image() const
375 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> >(this, "image");
378 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask()
380 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
383 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask() const
385 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
388 Glib::PropertyProxy_WriteOnly<Glib::ustring> Image::property_file()
390 return Glib::PropertyProxy_WriteOnly<Glib::ustring>(this, "file");
393 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_file() const
395 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "file");
398 Glib::PropertyProxy<Glib::ustring> Image::property_stock()
400 return Glib::PropertyProxy<Glib::ustring>(this, "stock");
403 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_stock() const
405 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "stock");
408 Glib::PropertyProxy<Gtk::IconSet> Image::property_icon_set()
410 return Glib::PropertyProxy<Gtk::IconSet>(this, "icon-set");
413 Glib::PropertyProxy_ReadOnly<Gtk::IconSet> Image::property_icon_set() const
415 return Glib::PropertyProxy_ReadOnly<Gtk::IconSet>(this, "icon-set");
418 Glib::PropertyProxy<int> Image::property_icon_size()
420 return Glib::PropertyProxy<int>(this, "icon-size");
423 Glib::PropertyProxy_ReadOnly<int> Image::property_icon_size() const
425 return Glib::PropertyProxy_ReadOnly<int>(this, "icon-size");
428 Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation()
430 return Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
433 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation() const
435 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
438 Glib::PropertyProxy_ReadOnly<ImageType> Image::property_storage_type() const
440 return Glib::PropertyProxy_ReadOnly<ImageType>(this, "storage-type");