]> Pileus Git - ~andy/gtk/blob - gtk/gtkimage.h
fix some shell typos
[~andy/gtk] / gtk / gtkimage.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GTK_IMAGE_H__
28 #define __GTK_IMAGE_H__
29
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtkmisc.h>
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38
39 #define GTK_TYPE_IMAGE                  (gtk_image_get_type ())
40 #define GTK_IMAGE(obj)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_IMAGE, GtkImage))
41 #define GTK_IMAGE_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass))
42 #define GTK_IS_IMAGE(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMAGE))
43 #define GTK_IS_IMAGE_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE))
44 #define GTK_IMAGE_GET_CLASS(obj)        (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IMAGE, GtkImageClass))
45
46
47 typedef struct _GtkImage       GtkImage;
48 typedef struct _GtkImageClass  GtkImageClass;
49
50 typedef struct _GtkImagePixmapData  GtkImagePixmapData;
51 typedef struct _GtkImageImageData   GtkImageImageData;
52 typedef struct _GtkImagePixbufData  GtkImagePixbufData;
53 typedef struct _GtkImageStockData   GtkImageStockData;
54 typedef struct _GtkImageIconSetData GtkImageIconSetData;
55 typedef struct _GtkImageAnimationData GtkImageAnimationData;
56
57 struct _GtkImagePixmapData
58 {
59   GdkPixmap *pixmap;
60   GdkBitmap *mask;
61 };
62
63 struct _GtkImageImageData
64 {
65   GdkImage *image;
66   GdkBitmap *mask;
67 };
68
69 struct _GtkImagePixbufData
70 {
71   GdkPixbuf *pixbuf;
72 };
73
74 struct _GtkImageStockData
75 {
76   gchar *stock_id;
77   GtkIconSize size;
78 };
79
80 struct _GtkImageIconSetData
81 {
82   GtkIconSet *icon_set;
83   GtkIconSize size;
84 };
85
86 struct _GtkImageAnimationData
87 {
88   GdkPixbufAnimation *anim;
89   GdkPixbufAnimationIter *iter;
90   guint frame_timeout;
91 };
92
93 typedef enum
94 {
95   GTK_IMAGE_EMPTY,
96   GTK_IMAGE_PIXMAP,
97   GTK_IMAGE_IMAGE,
98   GTK_IMAGE_PIXBUF,
99   GTK_IMAGE_STOCK,
100   GTK_IMAGE_ICON_SET,
101   GTK_IMAGE_ANIMATION
102 } GtkImageType;
103
104 struct _GtkImage
105 {
106   GtkMisc misc;
107
108   GtkImageType storage_type;
109   
110   union
111   {
112     GtkImagePixmapData pixmap;
113     GtkImageImageData image;
114     GtkImagePixbufData pixbuf;
115     GtkImageStockData stock;
116     GtkImageIconSetData icon_set;
117     GtkImageAnimationData anim;
118   } data;
119 };
120
121 struct _GtkImageClass
122 {
123   GtkMiscClass parent_class;
124 };
125
126 GtkType    gtk_image_get_type (void) G_GNUC_CONST;
127
128 GtkWidget* gtk_image_new_from_pixmap    (GdkPixmap       *pixmap,
129                                          GdkBitmap       *mask);
130 GtkWidget* gtk_image_new_from_image     (GdkImage        *image,
131                                          GdkBitmap       *mask);
132 GtkWidget* gtk_image_new_from_file      (const gchar     *filename);
133 GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
134 GtkWidget* gtk_image_new_from_stock     (const gchar     *stock_id,
135                                          GtkIconSize      size);
136 GtkWidget* gtk_image_new_from_icon_set  (GtkIconSet      *icon_set,
137                                          GtkIconSize      size);
138 GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
139
140 void gtk_image_set_from_pixmap    (GtkImage        *image,
141                                    GdkPixmap       *pixmap,
142                                    GdkBitmap       *mask);
143 void gtk_image_set_from_image     (GtkImage        *image,
144                                    GdkImage        *gdk_image,
145                                    GdkBitmap       *mask);
146 void gtk_image_set_from_file      (GtkImage        *image,
147                                    const gchar     *filename);
148 void gtk_image_set_from_pixbuf    (GtkImage        *image,
149                                    GdkPixbuf       *pixbuf);
150 void gtk_image_set_from_stock     (GtkImage        *image,
151                                    const gchar     *stock_id,
152                                    GtkIconSize      size);
153 void gtk_image_set_from_icon_set  (GtkImage        *image,
154                                    GtkIconSet      *icon_set,
155                                    GtkIconSize      size);
156 void gtk_image_set_from_animation (GtkImage           *image,
157                                    GdkPixbufAnimation *animation);
158
159 GtkImageType gtk_image_get_storage_type (GtkImage   *image);
160
161 void       gtk_image_get_pixmap   (GtkImage         *image,
162                                    GdkPixmap       **pixmap,
163                                    GdkBitmap       **mask);
164 void       gtk_image_get_image    (GtkImage         *image,
165                                    GdkImage        **gdk_image,
166                                    GdkBitmap       **mask);
167 GdkPixbuf* gtk_image_get_pixbuf   (GtkImage         *image);
168 void       gtk_image_get_stock    (GtkImage         *image,
169                                    gchar           **stock_id,
170                                    GtkIconSize      *size);
171 void       gtk_image_get_icon_set (GtkImage         *image,
172                                    GtkIconSet      **icon_set,
173                                    GtkIconSize      *size);
174 GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
175
176
177 #ifndef GTK_DISABLE_DEPRECATED
178 /* These three are deprecated */
179
180 GtkWidget* gtk_image_new      (GdkImage   *val,
181                                GdkBitmap  *mask);
182 void       gtk_image_set      (GtkImage   *image,
183                                GdkImage   *val,
184                                GdkBitmap  *mask);
185 void       gtk_image_get      (GtkImage   *image,
186                                GdkImage  **val,
187                                GdkBitmap **mask);
188 #endif /* GTK_DISABLE_DEPRECATED */
189
190 #ifdef __cplusplus
191 }
192 #endif /* __cplusplus */
193
194
195 #endif /* __GTK_IMAGE_H__ */