Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# image.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00024
    00025 #ifndef INTI_GTK_IMAGE_H
    00026 #define INTI_GTK_IMAGE_H
    00027
    00028 #ifndef INTI_GTK_MISC_H
    00029 #include <inti/gtk/misc.h>
    00030 #endif
    00031
    00032 #ifndef __GTK_IMAGE_H__
    00033 #include <gtk/gtkimage.h>
    00034 #endif
    00035
    00036 #ifndef __GTK_STOCK_H__
    00037 #include <gtk/gtkstock.h>
    00038 #endif
    00039
    00040 #ifndef __GTK_ICON_FACTORY_H__
    00041 #include <gtk/gtkiconfactory.h>
    00042 #endif
    00043
    00044 namespace Inti {
    00045
    00046 namespace Gdk {
    00047 class Image;
    00048 class Pixbuf;
    00049 class PixbufAnimation;
    00050 class Pixmap;
    00051 }
    00052
    00053 namespace Gtk {
    00054
    00055 class IconSet;
    00056 class ImageClass;
    00057
    00058 // @enum Gtk::ImageType
    00064
    00065 enum ImageType
    00066 {
    00067         IMAGE_EMPTY = GTK_IMAGE_EMPTY,
    00068         IMAGE_PIXMAP = GTK_IMAGE_PIXMAP,
    00069         IMAGE_IMAGE = GTK_IMAGE_IMAGE,
    00070         IMAGE_PIXBUF = GTK_IMAGE_PIXBUF,
    00071         IMAGE_STOCK = GTK_IMAGE_STOCK,
    00072         IMAGE_ICON_SET = GTK_IMAGE_ICON_SET,
    00073         IMAGE_ANIMATION = GTK_IMAGE_ANIMATION
    00074 };
    00075
    00186
    00187 class Image : public Misc
    00188 {
    00189         friend class G::Object;
    00190         friend class ImageClass;
    00191
    00192         Image(const Image&);
    00193         Image& operator=(const Image&);
    00194
    00195 protected:
    00198
    00199         explicit Image(GtkImage *image, bool reference = false);
    00206
    00208 //  Properties
    00209
    00210         typedef G::Property<Gdk::Pixbuf*, G::Object*> PixbufPropertyType;
    00211         typedef G::PropertyProxy<G::Object, PixbufPropertyType> PixbufPropertyProxy;
    00212         static const PixbufPropertyType pixbuf_property;
    00213
    00214         typedef G::Property<Gdk::Pixmap*, G::Object*> PixmapPropertyType;
    00215         typedef G::PropertyProxy<G::Object, PixmapPropertyType> PixmapPropertyProxy;
    00216         static const PixmapPropertyType pixmap_property;
    00217
    00218         typedef G::Property<Gdk::Image*, G::Object*> ImagePropertyType;
    00219         typedef G::PropertyProxy<G::Object, ImagePropertyType> ImagePropertyProxy;
    00220         static const ImagePropertyType image_property;
    00221
    00222         typedef G::Property<Gdk::Bitmap*, G::Object*> MaskPropertyType;
    00223         typedef G::PropertyProxy<G::Object, MaskPropertyType> MaskPropertyProxy;
    00224         static const MaskPropertyType mask_property;
    00225
    00226         typedef G::WritableProperty<String> FilePropertyType;
    00227         typedef G::PropertyProxy<G::Object, FilePropertyType> FilePropertyProxy;
    00228         static const FilePropertyType file_property;
    00229
    00230         typedef G::Property<String> StockPropertyType;
    00231         typedef G::PropertyProxy<G::Object, StockPropertyType> StockPropertyProxy;
    00232         static const StockPropertyType stock_property;
    00233
    00234         typedef G::Property<Pointer<IconSet> > IconSetPropertyType;
    00235         typedef G::PropertyProxy<G::Object, IconSetPropertyType> IconSetPropertyProxy;
    00236         static const IconSetPropertyType icon_set_property;
    00237
    00238         typedef G::Property<int> IconSizePropertyType;
    00239         typedef G::PropertyProxy<G::Object, IconSizePropertyType> IconSizePropertyProxy;
    00240         static const IconSizePropertyType icon_size_property;
    00241
    00242         typedef G::Property<Gdk::PixbufAnimation*, G::Object*> PixbufAnimationPropertyType;
    00243         typedef G::PropertyProxy<G::Object, PixbufAnimationPropertyType> PixbufAnimationPropertyProxy;
    00244         static const PixbufAnimationPropertyType pixbuf_animation_property;
    00245
    00246         typedef G::ReadableProperty<ImageType, int> StorageTypePropertyType;
    00247         typedef G::PropertyProxy<G::Object, StorageTypePropertyType> StorageTypePropertyProxy;
    00248         static const StorageTypePropertyType storage_type_property;
    00249
    00250 public:
    00253
    00254         Image();
    00256
    00257         Image(Gdk::Pixmap *pixmap, Gdk::Bitmap *mask);
    00265
    00266         Image(Gdk::Image *image, Gdk::Bitmap *mask);
    00274
    00275         explicit Image(const String& filename);
    00286
    00287         explicit Image(Gdk::Pixbuf *pixbuf);
    00295
    00296         explicit Image(const char **xpm_data);
    00303
    00304         Image(const char *stock_id, IconSize size);
    00313
    00314         Image(IconSet *icon_set, IconSize size) ;
    00327
    00328         explicit Image(Gdk::PixbufAnimation& animation);
    00334
    00335         virtual ~Image();
    00337
    00341
    00342         GtkImage* gtk_image() const { return (GtkImage*)instance; }
    00344
    00345         GtkImageClass* gtk_image_class() const;
    00347
    00348         operator GtkImage* () const;
    00350
    00351         ImageType get_storage_type() const;
    00356
    00357         void get_pixmap(Gdk::Pixmap **pixmap, Gdk::Bitmap **mask) const;
    00365
    00366         void get_image(Gdk::Image **gdk_image, Gdk::Bitmap **mask) const;
    00374
    00375         Gdk::Pixbuf* get_pixbuf() const;
    00382
    00383         void get_stock(char **stock_id, IconSize *size) const;
    00391
    00392         void get_icon_set(Pointer<IconSet> *icon_set, IconSize *size) const;
    00398
    00399         Gdk::PixbufAnimation* get_animation() const;
    00406
    00410
    00411         void set(Gdk::Pixmap *pixmap, Gdk::Bitmap *mask);
    00419
    00420         void set(Gdk::Image *image, Gdk::Bitmap *mask);
    00428
    00429         void set(const String& filename);
    00440
    00441         void set(Gdk::Pixbuf *pixbuf);
    00449
    00450         void set(const char *stock_id, IconSize size);
    00457
    00458         void set(Gtk::IconSet *icon_set, IconSize size);
    00471
    00472         void set(Gdk::PixbufAnimation& animation);
    00478
    00482
    00483         const PixbufPropertyProxy prop_pixbuf()
    00484         {
    00485                 return PixbufPropertyProxy(this, &pixbuf_property);
    00486         }
    00488
    00489         const PixmapPropertyProxy prop_pixmap()
    00490         {
    00491                 return PixmapPropertyProxy(this, &pixmap_property);
    00492         }
    00494
    00495         const ImagePropertyProxy prop_image()
    00496         {
    00497                 return ImagePropertyProxy(this, &image_property);
    00498         }
    00500
    00501         const MaskPropertyProxy prop_mask()
    00502         {
    00503                 return MaskPropertyProxy(this, &mask_property);
    00504         }
    00506
    00507         const FilePropertyProxy prop_file()
    00508         {
    00509                 return FilePropertyProxy(this, &file_property);
    00510         }
    00512
    00513         const StockPropertyProxy prop_stock()
    00514         {
    00515                 return StockPropertyProxy(this, &stock_property);
    00516         }
    00518
    00519         const IconSetPropertyProxy prop_icon_set()
    00520         {
    00521                 return IconSetPropertyProxy(this, &icon_set_property);
    00522         }
    00524
    00525         const IconSizePropertyProxy prop_icon_size()
    00526         {
    00527                 return IconSizePropertyProxy(this, &icon_size_property);
    00528         }
    00530
    00531         const PixbufAnimationPropertyProxy prop_pixbuf_animation()
    00532         {
    00533                 return PixbufAnimationPropertyProxy(this, &pixbuf_animation_property);
    00534         }
    00536
    00537         const StorageTypePropertyProxy prop_storage_type()
    00538         {
    00539                 return StorageTypePropertyProxy(this, &storage_type_property);
    00540         }
    00542
    00544 };
    00545
    00546 } // namespace Gtk
    00547
    00548 } // namespace Inti
    00549
    00550 #endif // INTI_GTK_IMAGE_H
    00551

Main Page - Footer