add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / src / image.hg
1 /* $Id: image.hg,v 1.9 2006/04/12 11:11:25 murrayc Exp $ */
2
3 /* image.h
4  * 
5  * Copyright (C) 1998-2002 The gtkmm Development Team
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include <gtkmm/misc.h>
23 #include <gtkmm/iconset.h>
24 #include <gdkmm/pixbufanimation.h>
25
26 _DEFS(gtkmm,gtk)
27 _PINCLUDE(gtkmm/private/misc_p.h)
28
29
30 namespace Gtk
31 {
32
33 _CC_INCLUDE(gtk/gtktypebuiltins.h)
34 _WRAP_ENUM(ImageType, GtkImageType)
35
36
37 /** A widget displaying an image.
38  *
39  * The Gtk::Image widget displays an image. Various kinds of object can be
40  * displayed as an image; most typically, you would load a Gdk::Pixbuf ("pixel
41  * buffer") from a file, and then display that. 
42  *
43  * Gtk::Image is a subclass of Gtk::Misc, which implies that you can align it
44  * (center, left, right) and add padding to it, using Gtk::Misc methods.
45  *
46  * Gtk::Image is a "no window" widget (has no Gdk::Window of its own), so by
47  * default does not receive events. If you want to receive events on the
48  * image, such as button clicks, place the image inside a Gtk::EventBox, then
49  * connect to the event signals on the event box. 
50  *
51  * @ingroup Widgets
52  */
53 class Image : public Misc
54 {
55   _CLASS_GTKOBJECT(Image,GtkImage,GTK_IMAGE,Gtk::Misc,GtkMisc)
56   _IGNORE(gtk_image_set, gtk_image_get, gtk_image_get_pixmap, gtk_image_get_image, gtk_image_get_stock, gtk_image_get_icon_set)
57 public:
58
59   _CTOR_DEFAULT
60   _WRAP_CTOR(Image(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask), gtk_image_new_from_pixmap)
61   _WRAP_CTOR(Image(const Glib::RefPtr<Gdk::Image>& image, const Glib::RefPtr<Gdk::Bitmap>& mask), gtk_image_new_from_image)
62   _WRAP_CTOR(Image(const std::string& file), gtk_image_new_from_file)
63   _WRAP_CTOR(Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_image_new_from_pixbuf)
64
65   /** Creates am Image displaying a stock icon.
66    * Sample stock icon identifiers are Gtk::Stock::OPEN, Gtk::Stock::EXIT. Sample stock sizes are Gtk::ICON_SIZE_MENU, Gtk::ICON_SIZE_SMALL_TOOLBAR.
67    * If the stock icon name isn't known, a "broken image" icon will be displayed instead.
68    * You can register your own stock icon names - see Gtk::IconFactory::add().
69    * @param stock_id A stock icon.
70    * @param size A stock icon size.
71    */
72   Image(const Gtk::StockID& stock_id, IconSize size);
73
74   Image(IconSet& icon_set, IconSize size);
75   Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
76
77   _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask), gtk_image_set_from_pixmap)
78   _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Image>& gdk_image, const Glib::RefPtr<Gdk::Bitmap>& mask), gtk_image_set_from_image)
79   _WRAP_METHOD(void set(const std::string& filename), gtk_image_set_from_file)
80   _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_image_set_from_pixbuf)
81   _WRAP_METHOD(void set(const Gtk::StockID& stock_id, IconSize size), gtk_image_set_from_stock)
82   _WRAP_METHOD(void set(IconSet& icon_set, IconSize size), gtk_image_set_from_icon_set)
83   _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation), gtk_image_set_from_animation)
84   _WRAP_METHOD(void set_from_icon_name(const Glib::ustring& icon_name, IconSize size), gtk_image_set_from_icon_name)
85
86   _WRAP_METHOD(void clear(), gtk_image_clear)
87
88   _WRAP_METHOD(ImageType get_storage_type() const, gtk_image_get_storage_type)
89
90   void get_pixmap(Glib::RefPtr<Gdk::Pixmap>& pixmap, Glib::RefPtr<Gdk::Bitmap>& mask) const;
91   void get_image(Glib::RefPtr<Gdk::Image>& gdk_image, Glib::RefPtr<Gdk::Bitmap>& mask) const;
92   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(), gtk_image_get_pixbuf, refreturn)
93   _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const, gtk_image_get_pixbuf, refreturn, constversion)
94   void get_stock(Gtk::StockID& stock_id, IconSize& size) const;
95   void get_icon_set(IconSet& icon_set, IconSize& size) const;
96   _WRAP_METHOD(Glib::RefPtr<Gdk::PixbufAnimation> get_animation(), gtk_image_get_animation, refreturn)
97   _WRAP_METHOD(Glib::RefPtr<const Gdk::PixbufAnimation> get_animation() const, gtk_image_get_animation, refreturn, constversion)
98
99   Glib::ustring get_icon_name() const;
100   Glib::ustring get_icon_name(IconSize& size);
101   _IGNORE(gtk_image_get_icon_name)
102
103  _WRAP_METHOD(int get_pixel_size() const, gtk_image_get_pixel_size)
104  _WRAP_METHOD(void set_pixel_size(int pixel_size), gtk_image_set_pixel_size)
105
106   _WRAP_PROPERTY("pixbuf", Glib::RefPtr<Gdk::Pixbuf>)
107   _WRAP_PROPERTY("pixmap", Glib::RefPtr<Gdk::Pixmap>)
108   _WRAP_PROPERTY("image", Glib::RefPtr<Gdk::Image>)
109   _WRAP_PROPERTY("mask", Glib::RefPtr<Gdk::Pixmap>)
110   _WRAP_PROPERTY("file", Glib::ustring)
111   _WRAP_PROPERTY("stock", Glib::ustring)
112   _WRAP_PROPERTY("icon-set", Gtk::IconSet)
113   _WRAP_PROPERTY("icon-size", int)
114   _WRAP_PROPERTY("pixbuf-animation", Glib::RefPtr<Gdk::PixbufAnimation>)
115   _WRAP_PROPERTY("storage-type", ImageType)
116 };
117
118 } /* namespace Gtk */
119