add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / image.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_IMAGE_H
4 #define _GTKMM_IMAGE_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* image.h
12  * 
13  * Copyright (C) 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 <gtkmm/misc.h>
31 #include <gtkmm/iconset.h>
32 #include <gdkmm/pixbufanimation.h>
33
34
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef struct _GtkImage GtkImage;
37 typedef struct _GtkImageClass GtkImageClass;
38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39
40
41 namespace Gtk
42 { class Image_Class; } // namespace Gtk
43 namespace Gtk
44 {
45
46
47 /** @addtogroup gtkmmEnums Enums and Flags */
48
49 /**
50  * @ingroup gtkmmEnums
51  */
52 enum ImageType
53 {
54   IMAGE_EMPTY,
55   IMAGE_PIXMAP,
56   IMAGE_IMAGE,
57   IMAGE_PIXBUF,
58   IMAGE_STOCK,
59   IMAGE_ICON_SET,
60   IMAGE_ANIMATION,
61   IMAGE_ICON_NAME
62 };
63
64 } // namespace Gtk
65
66
67 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 namespace Glib
69 {
70
71 template <>
72 class Value<Gtk::ImageType> : public Glib::Value_Enum<Gtk::ImageType>
73 {
74 public:
75   static GType value_type() G_GNUC_CONST;
76 };
77
78 } // namespace Glib
79 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
80
81
82 namespace Gtk
83 {
84
85
86 /** A widget displaying an image.
87  *
88  * The Gtk::Image widget displays an image. Various kinds of object can be
89  * displayed as an image; most typically, you would load a Gdk::Pixbuf ("pixel
90  * buffer") from a file, and then display that. 
91  *
92  * Gtk::Image is a subclass of Gtk::Misc, which implies that you can align it
93  * (center, left, right) and add padding to it, using Gtk::Misc methods.
94  *
95  * Gtk::Image is a "no window" widget (has no Gdk::Window of its own), so by
96  * default does not receive events. If you want to receive events on the
97  * image, such as button clicks, place the image inside a Gtk::EventBox, then
98  * connect to the event signals on the event box. 
99  *
100  * @ingroup Widgets
101  */
102
103 class Image : public Misc
104 {
105   public:
106 #ifndef DOXYGEN_SHOULD_SKIP_THIS
107   typedef Image CppObjectType;
108   typedef Image_Class CppClassType;
109   typedef GtkImage BaseObjectType;
110   typedef GtkImageClass BaseClassType;
111 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
112
113   virtual ~Image();
114
115 #ifndef DOXYGEN_SHOULD_SKIP_THIS
116
117 private:
118   friend class Image_Class;
119   static CppClassType image_class_;
120
121   // noncopyable
122   Image(const Image&);
123   Image& operator=(const Image&);
124
125 protected:
126   explicit Image(const Glib::ConstructParams& construct_params);
127   explicit Image(GtkImage* castitem);
128
129 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
130
131 public:
132 #ifndef DOXYGEN_SHOULD_SKIP_THIS
133   static GType get_type()      G_GNUC_CONST;
134   static GType get_base_type() G_GNUC_CONST;
135 #endif
136
137   ///Provides access to the underlying C GtkObject.
138   GtkImage*       gobj()       { return reinterpret_cast<GtkImage*>(gobject_); }
139
140   ///Provides access to the underlying C GtkObject.
141   const GtkImage* gobj() const { return reinterpret_cast<GtkImage*>(gobject_); }
142
143
144 public:
145   //C++ methods used to invoke GTK+ virtual functions:
146 #ifdef GLIBMM_VFUNCS_ENABLED
147 #endif //GLIBMM_VFUNCS_ENABLED
148
149 protected:
150   //GTK+ Virtual Functions (override these to change behaviour):
151 #ifdef GLIBMM_VFUNCS_ENABLED
152 #endif //GLIBMM_VFUNCS_ENABLED
153
154   //Default Signal Handlers::
155 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
156 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
157
158
159 private:
160
161   
162 public:
163
164   Image();
165   explicit Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask);
166   explicit Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask);
167   explicit Image(const std::string& file);
168   explicit Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
169
170   /** Creates am Image displaying a stock icon.
171    * Sample stock icon identifiers are Gtk::Stock::OPEN, Gtk::Stock::EXIT. Sample stock sizes are Gtk::ICON_SIZE_MENU, Gtk::ICON_SIZE_SMALL_TOOLBAR.
172    * If the stock icon name isn't known, a "broken image" icon will be displayed instead.
173    * You can register your own stock icon names - see Gtk::IconFactory::add().
174    * @param stock_id A stock icon.
175    * @param size A stock icon size.
176    */
177   Image(const Gtk::StockID& stock_id, IconSize size);
178
179   Image(IconSet& icon_set, IconSize size);
180   Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
181
182   
183   /** See new_from_pixmap() for details.
184    * @param pixmap A Gdk::Pixmap or <tt>0</tt>.
185    * @param mask A Gdk::Bitmap or <tt>0</tt>.
186    */
187   void set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask);
188   
189   /** See new_from_image() for details.
190    * @param gdk_image A Gdk::Image or <tt>0</tt>.
191    * @param mask A Gdk::Bitmap or <tt>0</tt>.
192    */
193   void set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask);
194   
195   /** See new_from_file() for details.
196    * @param filename A filename or <tt>0</tt>.
197    */
198   void set(const std::string& filename);
199   
200   /** See new_from_pixbuf() for details.
201    * @param pixbuf A Gdk::Pixbuf or <tt>0</tt>.
202    */
203   void set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
204   
205   /** See the Image::Image(const Gtk::StockID& stock_id, IconSize size) constructor for details.
206    * @param stock_id A stock icon name.
207    * @param size A stock icon size.
208    */
209   void set(const Gtk::StockID& stock_id, IconSize size);
210   
211   /** See new_from_icon_set() for details.
212    * @param icon_set A Gtk::IconSet.
213    * @param size A stock icon size.
214    */
215   void set(IconSet& icon_set, IconSize size);
216   
217   /** Causes the Gtk::Image to display the given animation (or display
218    * nothing, if you set the animation to <tt>0</tt>).
219    * @param animation The Gdk::PixbufAnimation.
220    */
221   void set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
222   
223   /** See new_from_icon_name() for details.
224    * 
225    * @newin2p6
226    * @param icon_name An icon name.
227    * @param size An icon size.
228    */
229   void set_from_icon_name(const Glib::ustring& icon_name, IconSize size);
230
231   
232   /** Resets the image to be empty.
233    * 
234    * @newin2p8
235    */
236   void clear();
237
238   
239   /** Gets the type of representation being used by the Gtk::Image
240    * to store image data. If the Gtk::Image has no image data,
241    * the return value will be Gtk::IMAGE_EMPTY.
242    * @return Image representation being used.
243    */
244   ImageType get_storage_type() const;
245
246   void get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const;
247   void get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const;
248   
249   /** Gets the Gdk::Pixbuf being displayed by the Gtk::Image.
250    * The storage type of the image must be Gtk::IMAGE_EMPTY or
251    * Gtk::IMAGE_PIXBUF (see get_storage_type()).
252    * The caller of this function does not own a reference to the
253    * returned pixbuf.
254    * @return The displayed pixbuf, or <tt>0</tt> if the image is empty.
255    */
256   Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
257   
258   /** Gets the Gdk::Pixbuf being displayed by the Gtk::Image.
259    * The storage type of the image must be Gtk::IMAGE_EMPTY or
260    * Gtk::IMAGE_PIXBUF (see get_storage_type()).
261    * The caller of this function does not own a reference to the
262    * returned pixbuf.
263    * @return The displayed pixbuf, or <tt>0</tt> if the image is empty.
264    */
265   Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const;
266   void get_stock(Gtk::StockID& stock_id, IconSize& size) const;
267   void get_icon_set(IconSet& icon_set, IconSize& size) const;
268   
269   /** Gets the Gdk::PixbufAnimation being displayed by the Gtk::Image.
270    * The storage type of the image must be Gtk::IMAGE_EMPTY or
271    * Gtk::IMAGE_ANIMATION (see get_storage_type()).
272    * The caller of this function does not own a reference to the
273    * returned animation.
274    * @return The displayed animation, or <tt>0</tt> if the image is empty.
275    */
276   Glib::RefPtr<Gdk::PixbufAnimation> get_animation();
277   
278   /** Gets the Gdk::PixbufAnimation being displayed by the Gtk::Image.
279    * The storage type of the image must be Gtk::IMAGE_EMPTY or
280    * Gtk::IMAGE_ANIMATION (see get_storage_type()).
281    * The caller of this function does not own a reference to the
282    * returned animation.
283    * @return The displayed animation, or <tt>0</tt> if the image is empty.
284    */
285   Glib::RefPtr<const Gdk::PixbufAnimation> get_animation() const;
286
287   Glib::ustring get_icon_name() const;
288   Glib::ustring get_icon_name(IconSize& size);
289   
290
291   /** Gets the pixel size used for named icons.
292    * @return The pixel size used for named icons.
293    * 
294    * @newin2p6.
295    */
296   int get_pixel_size() const;
297  
298   /** Sets the pixel size to use for named icons. If the pixel size is set
299    * to a value != -1, it is used instead of the icon size set by
300    * set_from_icon_name().
301    * 
302    * @newin2p6
303    * @param pixel_size The new pixel size.
304    */
305   void set_pixel_size(int pixel_size);
306
307   #ifdef GLIBMM_PROPERTIES_ENABLED
308 /** A GdkPixbuf to display.
309    *
310    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
311    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
312    * the value of the property changes.
313    */
314   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf() ;
315 #endif //#GLIBMM_PROPERTIES_ENABLED
316
317 #ifdef GLIBMM_PROPERTIES_ENABLED
318 /** A GdkPixbuf to display.
319    *
320    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
321    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
322    * the value of the property changes.
323    */
324   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf() const;
325 #endif //#GLIBMM_PROPERTIES_ENABLED
326
327   #ifdef GLIBMM_PROPERTIES_ENABLED
328 /** A GdkPixmap to display.
329    *
330    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
331    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
332    * the value of the property changes.
333    */
334   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > property_pixmap() ;
335 #endif //#GLIBMM_PROPERTIES_ENABLED
336
337 #ifdef GLIBMM_PROPERTIES_ENABLED
338 /** A GdkPixmap to display.
339    *
340    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
341    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
342    * the value of the property changes.
343    */
344   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > property_pixmap() const;
345 #endif //#GLIBMM_PROPERTIES_ENABLED
346
347   #ifdef GLIBMM_PROPERTIES_ENABLED
348 /** A GdkImage to display.
349    *
350    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
351    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
352    * the value of the property changes.
353    */
354   Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> > property_image() ;
355 #endif //#GLIBMM_PROPERTIES_ENABLED
356
357 #ifdef GLIBMM_PROPERTIES_ENABLED
358 /** A GdkImage to display.
359    *
360    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
361    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
362    * the value of the property changes.
363    */
364   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> > property_image() const;
365 #endif //#GLIBMM_PROPERTIES_ENABLED
366
367   #ifdef GLIBMM_PROPERTIES_ENABLED
368 /** Mask bitmap to use with GdkImage or GdkPixmap.
369    *
370    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
371    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
372    * the value of the property changes.
373    */
374   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > property_mask() ;
375 #endif //#GLIBMM_PROPERTIES_ENABLED
376
377 #ifdef GLIBMM_PROPERTIES_ENABLED
378 /** Mask bitmap to use with GdkImage or GdkPixmap.
379    *
380    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
381    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
382    * the value of the property changes.
383    */
384   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > property_mask() const;
385 #endif //#GLIBMM_PROPERTIES_ENABLED
386
387   #ifdef GLIBMM_PROPERTIES_ENABLED
388 /** Filename to load and display.
389    *
390    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
391    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
392    * the value of the property changes.
393    */
394   Glib::PropertyProxy<Glib::ustring> property_file() ;
395 #endif //#GLIBMM_PROPERTIES_ENABLED
396
397 #ifdef GLIBMM_PROPERTIES_ENABLED
398 /** Filename to load and display.
399    *
400    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
401    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
402    * the value of the property changes.
403    */
404   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_file() const;
405 #endif //#GLIBMM_PROPERTIES_ENABLED
406
407   #ifdef GLIBMM_PROPERTIES_ENABLED
408 /** Stock ID for a stock image to display.
409    *
410    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
411    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
412    * the value of the property changes.
413    */
414   Glib::PropertyProxy<Glib::ustring> property_stock() ;
415 #endif //#GLIBMM_PROPERTIES_ENABLED
416
417 #ifdef GLIBMM_PROPERTIES_ENABLED
418 /** Stock ID for a stock image to display.
419    *
420    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
421    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
422    * the value of the property changes.
423    */
424   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_stock() const;
425 #endif //#GLIBMM_PROPERTIES_ENABLED
426
427   #ifdef GLIBMM_PROPERTIES_ENABLED
428 /** Icon set to display.
429    *
430    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
431    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
432    * the value of the property changes.
433    */
434   Glib::PropertyProxy<Gtk::IconSet> property_icon_set() ;
435 #endif //#GLIBMM_PROPERTIES_ENABLED
436
437 #ifdef GLIBMM_PROPERTIES_ENABLED
438 /** Icon set to display.
439    *
440    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
441    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
442    * the value of the property changes.
443    */
444   Glib::PropertyProxy_ReadOnly<Gtk::IconSet> property_icon_set() const;
445 #endif //#GLIBMM_PROPERTIES_ENABLED
446
447   #ifdef GLIBMM_PROPERTIES_ENABLED
448 /** Symbolic size to use for stock icon
449    *
450    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
451    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
452    * the value of the property changes.
453    */
454   Glib::PropertyProxy<int> property_icon_size() ;
455 #endif //#GLIBMM_PROPERTIES_ENABLED
456
457 #ifdef GLIBMM_PROPERTIES_ENABLED
458 /** Symbolic size to use for stock icon
459    *
460    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
461    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
462    * the value of the property changes.
463    */
464   Glib::PropertyProxy_ReadOnly<int> property_icon_size() const;
465 #endif //#GLIBMM_PROPERTIES_ENABLED
466
467   #ifdef GLIBMM_PROPERTIES_ENABLED
468 /** GdkPixbufAnimation to display.
469    *
470    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
471    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
472    * the value of the property changes.
473    */
474   Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> > property_pixbuf_animation() ;
475 #endif //#GLIBMM_PROPERTIES_ENABLED
476
477 #ifdef GLIBMM_PROPERTIES_ENABLED
478 /** GdkPixbufAnimation to display.
479    *
480    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
481    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
482    * the value of the property changes.
483    */
484   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> > property_pixbuf_animation() const;
485 #endif //#GLIBMM_PROPERTIES_ENABLED
486
487   #ifdef GLIBMM_PROPERTIES_ENABLED
488 /** The representation being used for image data.
489    *
490    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
491    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
492    * the value of the property changes.
493    */
494   Glib::PropertyProxy_ReadOnly<ImageType> property_storage_type() const;
495 #endif //#GLIBMM_PROPERTIES_ENABLED
496
497
498 };
499
500 } /* namespace Gtk */
501
502
503 namespace Glib
504 {
505   /** A Glib::wrap() method for this object.
506    * 
507    * @param object The C instance.
508    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
509    * @result A C++ instance that wraps this C instance.
510    *
511    * @relates Gtk::Image
512    */
513   Gtk::Image* wrap(GtkImage* object, bool take_copy = false);
514 } //namespace Glib
515
516
517 #endif /* _GTKMM_IMAGE_H */
518