Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / image.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/image.h>
4 #include <gtkmm/private/image_p.h>
5
6 #include <gtk/gtktypebuiltins.h>
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* 
11  *
12  * Copyright 1998-2002 The gtkmm Development Team
13  *
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.
18  *
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.
23  *
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.
27  */
28
29 #include <gtk/gtkimage.h>
30 #include <gdkmm/image.h>
31 #include <gdkmm/bitmap.h>
32 #include <gdkmm/pixmap.h>
33
34 namespace Gtk
35 {
36
37 Image::Image(const Gtk::StockID& stock_id, IconSize size)
38 :
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))
41 {}
42
43 Image::Image(IconSet& icon_set, IconSize size)
44 :
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))
47 {}
48
49 Image::Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
50 :
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))
53 {}
54
55 void Image::get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const
56 {
57   GdkPixmap* pPixmap = 0;
58   GdkBitmap* pBitmap = 0;
59
60   gtk_image_get_pixmap(const_cast<GtkImage*>(gobj()), &pPixmap, &pBitmap);
61
62   pixmap = Glib::wrap((GdkPixmapObject*) pPixmap, true);
63   mask   = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
64 }
65
66 void Image::get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const
67 {
68   GdkImage* pImage = 0;
69   GdkBitmap* pBitmap = 0;
70
71   gtk_image_get_image(const_cast<GtkImage*>(gobj()), &pImage, &pBitmap);
72
73   gdk_image = Glib::wrap(pImage, true);
74   mask = Glib::RefPtr<Gdk::Bitmap>::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap, true));
75 }
76
77 void Image::get_stock(Gtk::StockID& stock_id, IconSize& size) const
78 {
79   char* pStockID = 0; // GTK+ iconsistency: although not const, it should not be freed.
80   GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
81
82   gtk_image_get_stock(const_cast<GtkImage*>(gobj()), &pStockID, &icon_size);
83
84   size = IconSize(static_cast<int>(icon_size));
85   stock_id = Gtk::StockID(pStockID); // the StockID ctor checks for 0
86 }
87
88 void Image::get_icon_set(IconSet& icon_set, IconSize& size) const
89 {
90   GtkIconSet* pIconSet = 0;
91   GtkIconSize icon_size = GTK_ICON_SIZE_INVALID;
92
93   gtk_image_get_icon_set(const_cast<GtkImage*>(gobj()), &pIconSet, &icon_size);
94
95   size = IconSize(static_cast<int>(icon_size));
96   icon_set = Glib::wrap(pIconSet, true); //true = take_copy.
97 }
98
99 void Image::clear()
100 {
101   gtk_image_set_from_pixbuf(gobj(), 0);
102 }
103
104 Glib::ustring Image::get_icon_name() const
105 {
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);
109 }
110
111 Glib::ustring Image::get_icon_name(IconSize& size)
112 {
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);
118 }
119
120 } // namespace Gtk
121
122
123 namespace
124 {
125 } // anonymous namespace
126
127 // static
128 GType Glib::Value<Gtk::ImageType>::value_type()
129 {
130   return gtk_image_type_get_type();
131 }
132
133
134 namespace Glib
135 {
136
137 Gtk::Image* wrap(GtkImage* object, bool take_copy)
138 {
139   return dynamic_cast<Gtk::Image *> (Glib::wrap_auto ((GObject*)(object), take_copy));
140 }
141
142 } /* namespace Glib */
143
144 namespace Gtk
145 {
146
147
148 /* The *_Class implementation: */
149
150 const Glib::Class& Image_Class::init()
151 {
152   if(!gtype_) // create the GType if necessary
153   {
154     // Glib::Class has to know the class init function to clone custom types.
155     class_init_func_ = &Image_Class::class_init_function;
156
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();
160
161     // Create the wrapper type, with the same class/instance size as the base type.
162     register_derived_type(gtk_image_get_type());
163
164     // Add derived versions of interfaces, if the C type implements any interfaces:
165   }
166
167   return *this;
168 }
169
170 void Image_Class::class_init_function(void* g_class, void* class_data)
171 {
172   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
173   CppClassParent::class_init_function(klass, class_data);
174
175 }
176
177
178 Glib::ObjectBase* Image_Class::wrap_new(GObject* o)
179 {
180   return manage(new Image((GtkImage*)(o)));
181
182 }
183
184
185 /* The implementation: */
186
187 Image::Image(const Glib::ConstructParams& construct_params)
188 :
189   Gtk::Misc(construct_params)
190 {
191   }
192
193 Image::Image(GtkImage* castitem)
194 :
195   Gtk::Misc((GtkMisc*)(castitem))
196 {
197   }
198
199 Image::~Image()
200 {
201   destroy_();
202 }
203
204 Image::CppClassType Image::image_class_; // initialize static member
205
206 GType Image::get_type()
207 {
208   return image_class_.init().get_type();
209 }
210
211 GType Image::get_base_type()
212 {
213   return gtk_image_get_type();
214 }
215
216
217 Image::Image()
218 :
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()))
221 {
222   }
223
224 Image::Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
225 :
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))
228 {
229   }
230
231 Image::Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask)
232 :
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))
235 {
236   }
237
238 Image::Image(const std::string& file)
239 :
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))
242 {
243   }
244
245 Image::Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
246 :
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))
249 {
250   }
251
252 void Image::set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask)
253 {
254   gtk_image_set_from_pixmap(gobj(), Glib::unwrap(pixmap), Glib::unwrap(mask));
255 }
256
257 void Image::set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask)
258 {
259   gtk_image_set_from_image(gobj(), Glib::unwrap(gdk_image), Glib::unwrap(mask));
260 }
261
262 void Image::set(const std::string& filename)
263 {
264   gtk_image_set_from_file(gobj(), filename.c_str());
265 }
266
267 void Image::set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
268 {
269   gtk_image_set_from_pixbuf(gobj(), Glib::unwrap(pixbuf));
270 }
271
272 void Image::set(const Gtk::StockID& stock_id, IconSize size)
273 {
274   gtk_image_set_from_stock(gobj(), (stock_id).get_c_str(), static_cast<GtkIconSize>(int(size)));
275 }
276
277 void Image::set(IconSet& icon_set, IconSize size)
278 {
279   gtk_image_set_from_icon_set(gobj(), (icon_set).gobj(), static_cast<GtkIconSize>(int(size)));
280 }
281
282 void Image::set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
283 {
284   gtk_image_set_from_animation(gobj(), Glib::unwrap(animation));
285 }
286
287 void Image::set_from_icon_name(const Glib::ustring& icon_name, IconSize size)
288 {
289   gtk_image_set_from_icon_name(gobj(), icon_name.c_str(), static_cast<GtkIconSize>(int(size)));
290 }
291
292 ImageType Image::get_storage_type() const
293 {
294   return ((ImageType)(gtk_image_get_storage_type(const_cast<GtkImage*>(gobj()))));
295 }
296
297 Glib::RefPtr<Gdk::Pixbuf> Image::get_pixbuf()
298 {
299
300   Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_image_get_pixbuf(gobj()));
301
302   if(retvalue)
303     retvalue->reference(); //The function does not do a ref for us.
304   return retvalue;
305 }
306
307 Glib::RefPtr<const Gdk::Pixbuf> Image::get_pixbuf() const
308 {
309
310   Glib::RefPtr<const Gdk::Pixbuf> retvalue = Glib::wrap(gtk_image_get_pixbuf(const_cast<GtkImage*>(gobj())));
311
312   if(retvalue)
313     retvalue->reference(); //The function does not do a ref for us.
314   return retvalue;
315 }
316
317 Glib::RefPtr<Gdk::PixbufAnimation> Image::get_animation()
318 {
319
320   Glib::RefPtr<Gdk::PixbufAnimation> retvalue = Glib::wrap(gtk_image_get_animation(gobj()));
321
322   if(retvalue)
323     retvalue->reference(); //The function does not do a ref for us.
324   return retvalue;
325 }
326
327 Glib::RefPtr<const Gdk::PixbufAnimation> Image::get_animation() const
328 {
329
330   Glib::RefPtr<const Gdk::PixbufAnimation> retvalue = Glib::wrap(gtk_image_get_animation(const_cast<GtkImage*>(gobj())));
331
332   if(retvalue)
333     retvalue->reference(); //The function does not do a ref for us.
334   return retvalue;
335 }
336
337 int Image::get_pixel_size() const
338 {
339   return gtk_image_get_pixel_size(const_cast<GtkImage*>(gobj()));
340 }
341
342 void Image::set_pixel_size(int pixel_size)
343 {
344   gtk_image_set_pixel_size(gobj(), pixel_size);
345 }
346
347
348 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf() 
349 {
350   return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
351 }
352
353 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > Image::property_pixbuf() const
354 {
355   return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> >(this, "pixbuf");
356 }
357
358 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap() 
359 {
360   return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
361 }
362
363 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_pixmap() const
364 {
365   return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "pixmap");
366 }
367
368 Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> > Image::property_image() 
369 {
370   return Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> >(this, "image");
371 }
372
373 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> > Image::property_image() const
374 {
375   return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> >(this, "image");
376 }
377
378 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask() 
379 {
380   return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
381 }
382
383 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > Image::property_mask() const
384 {
385   return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> >(this, "mask");
386 }
387
388 Glib::PropertyProxy_WriteOnly<Glib::ustring> Image::property_file() 
389 {
390   return Glib::PropertyProxy_WriteOnly<Glib::ustring>(this, "file");
391 }
392
393 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_file() const
394 {
395   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "file");
396 }
397
398 Glib::PropertyProxy<Glib::ustring> Image::property_stock() 
399 {
400   return Glib::PropertyProxy<Glib::ustring>(this, "stock");
401 }
402
403 Glib::PropertyProxy_ReadOnly<Glib::ustring> Image::property_stock() const
404 {
405   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "stock");
406 }
407
408 Glib::PropertyProxy<Gtk::IconSet> Image::property_icon_set() 
409 {
410   return Glib::PropertyProxy<Gtk::IconSet>(this, "icon-set");
411 }
412
413 Glib::PropertyProxy_ReadOnly<Gtk::IconSet> Image::property_icon_set() const
414 {
415   return Glib::PropertyProxy_ReadOnly<Gtk::IconSet>(this, "icon-set");
416 }
417
418 Glib::PropertyProxy<int> Image::property_icon_size() 
419 {
420   return Glib::PropertyProxy<int>(this, "icon-size");
421 }
422
423 Glib::PropertyProxy_ReadOnly<int> Image::property_icon_size() const
424 {
425   return Glib::PropertyProxy_ReadOnly<int>(this, "icon-size");
426 }
427
428 Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation() 
429 {
430   return Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
431 }
432
433 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> > Image::property_pixbuf_animation() const
434 {
435   return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> >(this, "pixbuf-animation");
436 }
437
438 Glib::PropertyProxy_ReadOnly<ImageType> Image::property_storage_type() const
439 {
440   return Glib::PropertyProxy_ReadOnly<ImageType>(this, "storage-type");
441 }
442
443
444 } // namespace Gtk
445
446