1 // -*- c++ -*-
2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
3 #ifndef _GTKMM_IMAGE_H
4 #define _GTKMM_IMAGE_H
5 
6 
7 #include <glibmm/ustring.h>
8 #include <sigc++/sigc++.h>
9 
10 /* $Id: image.hg,v 1.9 2006/04/12 11:11:25 murrayc Exp $ */
11 
12 /* image.h
13  *
14  * Copyright (C) 1998-2002 The gtkmm Development Team
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free
28  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29  */
30 
31 #include <gtkmm/misc.h>
32 #include <gtkmm/iconset.h>
33 #include <gdkmm/pixbufanimation.h>
34 #include <giomm/icon.h>
35 
36 
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 typedef struct _GtkImage GtkImage;
39 typedef struct _GtkImageClass GtkImageClass;
40 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 
42 
43 namespace Gtk
44 { class Image_Class; } // namespace Gtk
45 namespace Gtk
46 {
47 
48 
49 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */
50 
51 /**
52  *
53  * @ingroup gtkmmEnums
54  */
55 enum ImageType
56 {
57   IMAGE_EMPTY,
58   IMAGE_PIXMAP,
59   IMAGE_IMAGE,
60   IMAGE_PIXBUF,
61   IMAGE_STOCK,
62   IMAGE_ICON_SET,
63   IMAGE_ANIMATION,
64   IMAGE_ICON_NAME,
65   IMAGE_GICON
66 };
67 
68 } // namespace Gtk
69 
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 namespace Glib
73 {
74 
75 template <>
76 class Value<Gtk::ImageType> : public Glib::Value_Enum<Gtk::ImageType>
77 {
78 public:
79   static GType value_type() G_GNUC_CONST;
80 };
81 
82 } // namespace Glib
83 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
84 
85 
86 namespace Gtk
87 {
88 
89 
90 /** A widget displaying an image.
91  *
92  * The Gtk::Image widget displays an image. Various kinds of object can be
93  * displayed as an image; most typically, you would load a Gdk::Pixbuf ("pixel
94  * buffer") from a file, and then display that.
95  *
96  * Gtk::Image is a subclass of Gtk::Misc, which implies that you can align it
97  * (center, left, right) and add padding to it, using Gtk::Misc methods.
98  *
99  * Gtk::Image is a "no window" widget (has no Gdk::Window of its own), so by
100  * default does not receive events. If you want to receive events on the
101  * image, such as button clicks, place the image inside a Gtk::EventBox, then
102  * connect to the event signals on the event box.
103  *
104  * The Image widget looks like this:
105  * @image html image1.png
106  *
107  * @ingroup Widgets
108  */
109 
110 class Image : public Misc
111 {
112   public:
113 #ifndef DOXYGEN_SHOULD_SKIP_THIS
114   typedef Image CppObjectType;
115   typedef Image_Class CppClassType;
116   typedef GtkImage BaseObjectType;
117   typedef GtkImageClass BaseClassType;
118 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
119 
120   virtual ~Image();
121 
122 #ifndef DOXYGEN_SHOULD_SKIP_THIS
123 
124 private:
125   friend class Image_Class;
126   static CppClassType image_class_;
127 
128   // noncopyable
129   Image(const Image&);
130   Image& operator=(const Image&);
131 
132 protected:
133   explicit Image(const Glib::ConstructParams& construct_params);
134   explicit Image(GtkImage* castitem);
135 
136 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
137 
138 public:
139 #ifndef DOXYGEN_SHOULD_SKIP_THIS
140   static GType get_type()      G_GNUC_CONST;
141 
142 
143   static GType get_base_type() G_GNUC_CONST;
144 #endif
145 
146   ///Provides access to the underlying C GtkObject.
gobj()147   GtkImage*       gobj()       { return reinterpret_cast<GtkImage*>(gobject_); }
148 
149   ///Provides access to the underlying C GtkObject.
gobj()150   const GtkImage* gobj() const { return reinterpret_cast<GtkImage*>(gobject_); }
151 
152 
153 public:
154   //C++ methods used to invoke GTK+ virtual functions:
155 
156 protected:
157   //GTK+ Virtual Functions (override these to change behaviour):
158 
159   //Default Signal Handlers::
160 
161 
162 private:
163 
164 
165 public:
166 
167   Image();
168 
169   //TODO: The C documentation says that the constructor parameters can be NULL. Choose sensible method overloads.
170 
171   /** Creates an Image widget displaying @a pixmap with a @a mask.
172    * A Gdk::Pixmap is a server-side image buffer in the pixel format of the current display.
173    *
174    * @param pixmap A Gdk::Pixmap
175    * @param mask A Gdk::Bitmap
176    */
177     explicit Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask);
178 
179 
180   /** Creates an Image widget displaying an @a image with a mask.
181    * A Gdk::Image is a client-side image buffer in the pixel format of the current display.
182    */
183     explicit Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask);
184 
185 
186   /** Creates an Image widget displaying the file @a filename.
187    * If the file isn't found or can't be loaded, the resulting Gtk::Image will display a "broken image" icon.
188    *
189    * If the file contains an animation, the image will contain an animation.
190    *
191    * If you need to detect failures to load the file, use Gdk::Pixbuf::create_from_file() to load the file yourself,
192    * then create the GtkImage from the pixbuf. (Or for animations, use Gdk::PixbufAnimation::create_from_file()).
193    *
194    * The storage type (get_storage_type()) of the returned image is not defined. It will be whatever is appropriate for displaying the file.
195    */
196     explicit Image(const std::string& file);
197 
198 
199   /** Creates a new Image widget displaying @a pixbuf.
200    * Note that this just creates an GtkImage from the pixbuf. The Gtk::Image created will not react to state changes.
201    * Should you want that, you should use the constructor that takes an IconSet.
202    */
203     explicit Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
204 
205 
206   /** Creates a new Image displaying an icon set. Sample stock sizes are ICON_SIZE_MENU, ICON_SIZE_SMALL_TOOLBAR.
207    * Instead of using this function, usually it's better to create an IconFactory, put your icon sets in the icon factory,
208    * add the icon factory to the list of default factories with IconFactory::add_default(), and then use the
209    * constructor that takes a StockID. This will allow themes to override the icon you ship with your application.
210    *
211    * @param icon_set An IconSet
212    * @param size A stock icon size.
213    *
214    * @newin{2,24}
215    */
216     explicit Image(const IconSet& icon_set, IconSize icon_size);
217 
218 
219 #ifndef GTKMM_DISABLE_DEPRECATED
220 
221   /** @deprecated Use the constructor that takes a const IconSet& icon_set instead.
222    */
223     explicit Image(IconSet& icon_set, IconSize icon_size);
224 
225 #endif // GTKMM_DISABLE_DEPRECATED
226 
227 
228   //We don't wrap gtk_image_new_from_icon_name() to avoid a clash with the from-filename constructor.
229   //But we do wrap gtk_image_set_from_icon_name()
230 
231 
232   /** Creates am Image displaying a stock icon.
233    * Sample stock icon identifiers are Gtk::Stock::OPEN, Gtk::Stock::EXIT. Sample stock sizes are Gtk::ICON_SIZE_MENU, Gtk::ICON_SIZE_SMALL_TOOLBAR.
234    * If the stock icon name isn't known, a "broken image" icon will be displayed instead.
235    * You can register your own stock icon names - see Gtk::IconFactory::add().
236    * @param stock_id A stock icon.
237    * @param size A stock icon size.
238    */
239   Image(const Gtk::StockID& stock_id, IconSize size);
240 
241   Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
242 
243 
244   /** See the Image::Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask) constructor for details.
245    *
246    * @param pixmap A #Gdk::Pixmap.
247    * @param mask A #Gdk::Bitmap.
248    */
249   void set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask);
250 
251   /** See the Image::Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask) constructor for details.
252    *
253    * @param gdk_image A #Gdk::Image.
254    * @param mask A #Gdk::Bitmap.
255    */
256   void set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask);
257 
258   /** See the Image::Image(const std::string& file) constructor for details.
259    *
260    * @param filename A filename.
261    */
262   void set(const std::string& filename);
263 
264   /** See the Image::Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf) constructor for details.
265    *
266    * @param pixbuf A #Gdk::Pixbuf.
267    */
268   void set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
269 
270   /** See the Image::Image(const Gtk::StockID& stock_id, IconSize size) constructor for details.
271    *
272    * @param stock_id A stock icon name.
273    * @param size A stock icon size.
274    */
275   void set(const Gtk::StockID& stock_id, IconSize size);
276 
277 
278 #ifndef GTKMM_DISABLE_DEPRECATED
279 
280   /** See new_from_icon_set() for details.
281    *
282    * @deprecated Use the method that takes a const IconSet& instead.
283    *
284    * @param icon_set A Gtk::IconSet.
285    * @param size A stock icon size.
286    */
287   void set(IconSet& icon_set, IconSize size);
288 #endif // GTKMM_DISABLE_DEPRECATED
289 
290 
291   /** See new_from_icon_set() for details.
292    *
293    * @param icon_set A Gtk::IconSet.
294    * @param size A stock icon size.
295    */
296   void set(const IconSet& icon_set, IconSize size);
297 
298 
299   /** Causes the Gtk::Image to display the given animation (or display
300    * nothing, if you set the animation to <tt>0</tt>).
301    *
302    * @param animation The Gdk::PixbufAnimation.
303    */
304   void set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
305 
306   /** See new_from_gicon() for details.
307    *
308    * @newin{2,14}
309    *
310    * @param icon An icon.
311    * @param size An icon size.
312    */
313   void set(const Glib::RefPtr<const Gio::Icon>& icon, IconSize size);
314 
315 
316   /** Causes the Image to display an icon from the current icon theme.
317    * If the icon name isn't known, a "broken image" icon will be
318    * displayed instead.  If the current icon theme is changed, the icon
319    * will be updated appropriately.
320    *
321    * @newin{2,6}
322    *
323    * @param icon_name An icon name.
324    * @param size A stock icon size.
325    */
326   void set_from_icon_name(const Glib::ustring& icon_name, IconSize size);
327 
328 
329   /** Resets the image to be empty.
330    *
331    * @newin{2,8}
332    */
333   void clear();
334 
335 
336   /** Gets the type of representation being used by the Gtk::Image
337    * to store image data. If the Gtk::Image has no image data,
338    * the return value will be Gtk::IMAGE_EMPTY.
339    *
340    * @return Image representation being used.
341    */
342   ImageType get_storage_type() const;
343 
344   void get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const;
345   void get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const;
346 
347   /** Gets the Gdk::Pixbuf being displayed by the Gtk::Image.
348    * The storage type of the image must be Gtk::IMAGE_EMPTY or
349    * Gtk::IMAGE_PIXBUF (see get_storage_type()).
350    * The caller of this function does not own a reference to the
351    * returned pixbuf.
352    *
353    * @return The displayed pixbuf, or <tt>0</tt> if
354    * the image is empty.
355    */
356   Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
357 
358   /** Gets the Gdk::Pixbuf being displayed by the Gtk::Image.
359    * The storage type of the image must be Gtk::IMAGE_EMPTY or
360    * Gtk::IMAGE_PIXBUF (see get_storage_type()).
361    * The caller of this function does not own a reference to the
362    * returned pixbuf.
363    *
364    * @return The displayed pixbuf, or <tt>0</tt> if
365    * the image is empty.
366    */
367   Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const;
368   void get_stock(Gtk::StockID& stock_id, IconSize& size) const;
369   void get_icon_set(IconSet& icon_set, IconSize& size) const;
370 
371   /** Gets the Gdk::PixbufAnimation being displayed by the Gtk::Image.
372    * The storage type of the image must be Gtk::IMAGE_EMPTY or
373    * Gtk::IMAGE_ANIMATION (see get_storage_type()).
374    * The caller of this function does not own a reference to the
375    * returned animation.
376    *
377    * @return The displayed animation, or <tt>0</tt> if
378    * the image is empty.
379    */
380   Glib::RefPtr<Gdk::PixbufAnimation> get_animation();
381 
382   /** Gets the Gdk::PixbufAnimation being displayed by the Gtk::Image.
383    * The storage type of the image must be Gtk::IMAGE_EMPTY or
384    * Gtk::IMAGE_ANIMATION (see get_storage_type()).
385    * The caller of this function does not own a reference to the
386    * returned animation.
387    *
388    * @return The displayed animation, or <tt>0</tt> if
389    * the image is empty.
390    */
391   Glib::RefPtr<const Gdk::PixbufAnimation> get_animation() const;
392 
393  /** Gets the Gio::Icon and size being displayed by the Gtk::Image.
394   * The storage type of the image must be IMAGE_EMPTY or
395   * IMAGE_GICON (see get_storage_type()).
396   *
397   * @param icon_size A place to store an icon size.
398   *
399   * @newin{2,14}
400   */
401   Glib::RefPtr<Gio::Icon> get_gicon(Gtk::IconSize& icon_size);
402 
403  /** Gets the Gio::Icon and size being displayed by the Gtk::Image.
404   * The storage type of the image must be IMAGE_EMPTY or
405   * IMAGE_GICON (see get_storage_type()).
406   *
407   * @param icon_size A place to store an icon size.
408   *
409   * @newin{2,14}
410   */
411   Glib::RefPtr<const Gio::Icon> get_gicon(Gtk::IconSize& icon_size) const;
412 
413 
414   Glib::ustring get_icon_name() const;
415   Glib::ustring get_icon_name(IconSize& size);
416 
417 
418   /** Gets the pixel size used for named icons.
419    *
420    * @newin{2,6}
421    *
422    * @return The pixel size used for named icons.
423    */
424   int get_pixel_size() const;
425 
426   /** Sets the pixel size to use for named icons. If the pixel size is set
427    * to a value != -1, it is used instead of the icon size set by
428    * set_from_icon_name().
429    *
430    * @newin{2,6}
431    *
432    * @param pixel_size The new pixel size.
433    */
434   void set_pixel_size(int pixel_size);
435 
436   /** A GdkPixbuf to display.
437    *
438    * @return A PropertyProxy that allows you to get or set the value of the property,
439    * or receive notification when the value of the property changes.
440    */
441   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf() ;
442 
443 /** A GdkPixbuf to display.
444    *
445    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
446    * or receive notification when the value of the property changes.
447    */
448   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf() const;
449 
450   /** A GdkPixmap to display.
451    *
452    * @return A PropertyProxy that allows you to get or set the value of the property,
453    * or receive notification when the value of the property changes.
454    */
455   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > property_pixmap() ;
456 
457 /** A GdkPixmap to display.
458    *
459    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
460    * or receive notification when the value of the property changes.
461    */
462   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > property_pixmap() const;
463 
464   /** A GdkImage to display.
465    *
466    * @return A PropertyProxy that allows you to get or set the value of the property,
467    * or receive notification when the value of the property changes.
468    */
469   Glib::PropertyProxy< Glib::RefPtr<Gdk::Image> > property_image() ;
470 
471 /** A GdkImage to display.
472    *
473    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
474    * or receive notification when the value of the property changes.
475    */
476   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Image> > property_image() const;
477 
478   /** Mask bitmap to use with GdkImage or GdkPixmap.
479    *
480    * @return A PropertyProxy that allows you to get or set the value of the property,
481    * or receive notification when the value of the property changes.
482    */
483   Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixmap> > property_mask() ;
484 
485 /** Mask bitmap to use with GdkImage or GdkPixmap.
486    *
487    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
488    * or receive notification when the value of the property changes.
489    */
490   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixmap> > property_mask() const;
491 
492   /** Filename to load and display.
493    *
494    * @return A PropertyProxy that allows you to get or set the value of the property,
495    * or receive notification when the value of the property changes.
496    */
497   Glib::PropertyProxy< Glib::ustring > property_file() ;
498 
499 /** Filename to load and display.
500    *
501    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
502    * or receive notification when the value of the property changes.
503    */
504   Glib::PropertyProxy_ReadOnly< Glib::ustring > property_file() const;
505 
506   /** Stock ID for a stock image to display.
507    *
508    * @return A PropertyProxy that allows you to get or set the value of the property,
509    * or receive notification when the value of the property changes.
510    */
511   Glib::PropertyProxy< Glib::ustring > property_stock() ;
512 
513 /** Stock ID for a stock image to display.
514    *
515    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
516    * or receive notification when the value of the property changes.
517    */
518   Glib::PropertyProxy_ReadOnly< Glib::ustring > property_stock() const;
519 
520   /** Icon set to display.
521    *
522    * @return A PropertyProxy that allows you to get or set the value of the property,
523    * or receive notification when the value of the property changes.
524    */
525   Glib::PropertyProxy< Gtk::IconSet > property_icon_set() ;
526 
527 /** Icon set to display.
528    *
529    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
530    * or receive notification when the value of the property changes.
531    */
532   Glib::PropertyProxy_ReadOnly< Gtk::IconSet > property_icon_set() const;
533 
534   /** Symbolic size to use for stock icon, icon set or named icon.
535    *
536    * @return A PropertyProxy that allows you to get or set the value of the property,
537    * or receive notification when the value of the property changes.
538    */
539   Glib::PropertyProxy< int > property_icon_size() ;
540 
541 /** Symbolic size to use for stock icon, icon set or named icon.
542    *
543    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
544    * or receive notification when the value of the property changes.
545    */
546   Glib::PropertyProxy_ReadOnly< int > property_icon_size() const;
547 
548   /** Pixel size to use for named icon.
549    *
550    * @return A PropertyProxy that allows you to get or set the value of the property,
551    * or receive notification when the value of the property changes.
552    */
553   Glib::PropertyProxy< int > property_pixel_size() ;
554 
555 /** Pixel size to use for named icon.
556    *
557    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
558    * or receive notification when the value of the property changes.
559    */
560   Glib::PropertyProxy_ReadOnly< int > property_pixel_size() const;
561 
562   /** GdkPixbufAnimation to display.
563    *
564    * @return A PropertyProxy that allows you to get or set the value of the property,
565    * or receive notification when the value of the property changes.
566    */
567   Glib::PropertyProxy< Glib::RefPtr<Gdk::PixbufAnimation> > property_pixbuf_animation() ;
568 
569 /** GdkPixbufAnimation to display.
570    *
571    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
572    * or receive notification when the value of the property changes.
573    */
574   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::PixbufAnimation> > property_pixbuf_animation() const;
575 
576   /** The name of the icon from the icon theme.
577    *
578    * @return A PropertyProxy that allows you to get or set the value of the property,
579    * or receive notification when the value of the property changes.
580    */
581   Glib::PropertyProxy< Glib::ustring > property_icon_name() ;
582 
583 /** The name of the icon from the icon theme.
584    *
585    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
586    * or receive notification when the value of the property changes.
587    */
588   Glib::PropertyProxy_ReadOnly< Glib::ustring > property_icon_name() const;
589 
590   /** The representation being used for image data.
591    *
592    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
593    * or receive notification when the value of the property changes.
594    */
595   Glib::PropertyProxy_ReadOnly< ImageType > property_storage_type() const;
596 
597 
598   /** The GIcon being displayed.
599    *
600    * @return A PropertyProxy that allows you to get or set the value of the property,
601    * or receive notification when the value of the property changes.
602    */
603   Glib::PropertyProxy< Glib::RefPtr<Gio::Icon> > property_gicon() ;
604 
605 /** The GIcon being displayed.
606    *
607    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
608    * or receive notification when the value of the property changes.
609    */
610   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::Icon> > property_gicon() const;
611 
612 
613 };
614 
615 } /* namespace Gtk */
616 
617 
618 namespace Glib
619 {
620   /** A Glib::wrap() method for this object.
621    *
622    * @param object The C instance.
623    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
624    * @result A C++ instance that wraps this C instance.
625    *
626    * @relates Gtk::Image
627    */
628   Gtk::Image* wrap(GtkImage* object, bool take_copy = false);
629 } //namespace Glib
630 
631 
632 #endif /* _GTKMM_IMAGE_H */
633 
634