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