1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_IMAGE_H__
32 #define __GTK_IMAGE_H__
36 #include <gtk/gtkmisc.h>
41 #define GTK_TYPE_IMAGE (gtk_image_get_type ())
42 #define GTK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE, GtkImage))
43 #define GTK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass))
44 #define GTK_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE))
45 #define GTK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE))
46 #define GTK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE, GtkImageClass))
49 typedef struct _GtkImage GtkImage;
50 typedef struct _GtkImageClass GtkImageClass;
52 typedef struct _GtkImagePixmapData GtkImagePixmapData;
53 typedef struct _GtkImageImageData GtkImageImageData;
54 typedef struct _GtkImagePixbufData GtkImagePixbufData;
55 typedef struct _GtkImageStockData GtkImageStockData;
56 typedef struct _GtkImageIconSetData GtkImageIconSetData;
57 typedef struct _GtkImageAnimationData GtkImageAnimationData;
58 typedef struct _GtkImageIconNameData GtkImageIconNameData;
59 typedef struct _GtkImageGIconData GtkImageGIconData;
61 struct _GtkImagePixmapData
66 struct _GtkImageImageData
71 struct _GtkImagePixbufData
76 struct _GtkImageStockData
81 struct _GtkImageIconSetData
86 struct _GtkImageAnimationData
88 GdkPixbufAnimation *anim;
89 GdkPixbufAnimationIter *iter;
93 struct _GtkImageIconNameData
97 guint theme_change_id;
100 struct _GtkImageGIconData
104 guint theme_change_id;
109 * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
110 * @GTK_IMAGE_PIXMAP: the widget contains a #GdkPixmap
111 * @GTK_IMAGE_IMAGE: the widget contains a #GdkImage
112 * @GTK_IMAGE_PIXBUF: the widget contains a #GdkPixbuf
113 * @GTK_IMAGE_STOCK: the widget contains a stock icon name (see
114 * <xref linkend="gtk3-Stock-Items"/>)
115 * @GTK_IMAGE_ICON_SET: the widget contains a #GtkIconSet
116 * @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation
117 * @GTK_IMAGE_ICON_NAME: the widget contains a named icon.
118 * This image type was added in GTK+ 2.6
119 * @GTK_IMAGE_GICON: the widget contains a #GIcon.
120 * This image type was added in GTK+ 2.14
122 * Describes the image data representation used by a #GtkImage. If you
123 * want to get the image from the widget, you can only get the
124 * currently-stored representation. e.g. if the
125 * gtk_image_get_storage_type() returns #GTK_IMAGE_PIXBUF, then you can
126 * call gtk_image_get_pixbuf() but not gtk_image_get_stock(). For empty
127 * images, you can request any storage type (call any of the "get"
128 * functions), but they will all return %NULL values.
146 * This struct contain private data only and should be accessed by the functions
153 GtkImageType GSEAL (storage_type);
157 GtkImagePixmapData pixmap;
158 GtkImageImageData image;
159 GtkImagePixbufData pixbuf;
160 GtkImageStockData stock;
161 GtkImageIconSetData icon_set;
162 GtkImageAnimationData anim;
163 GtkImageIconNameData name;
164 GtkImageGIconData gicon;
167 /* Only used with GTK_IMAGE_PIXMAP, GTK_IMAGE_IMAGE */
168 GdkBitmap *GSEAL (mask);
170 /* Only used with GTK_IMAGE_STOCK, GTK_IMAGE_ICON_SET, GTK_IMAGE_ICON_NAME */
171 GtkIconSize GSEAL (icon_size);
174 struct _GtkImageClass
176 GtkMiscClass parent_class;
178 /* Padding for future expansion */
179 void (*_gtk_reserved1) (void);
180 void (*_gtk_reserved2) (void);
181 void (*_gtk_reserved3) (void);
182 void (*_gtk_reserved4) (void);
186 /* Reserve old names for DLL ABI backward compatibility */
187 #define gtk_image_new_from_file gtk_image_new_from_file_utf8
188 #define gtk_image_set_from_file gtk_image_set_from_file_utf8
191 GType gtk_image_get_type (void) G_GNUC_CONST;
193 GtkWidget* gtk_image_new (void);
194 GtkWidget* gtk_image_new_from_pixmap (GdkPixmap *pixmap,
196 GtkWidget* gtk_image_new_from_image (GdkImage *image,
198 GtkWidget* gtk_image_new_from_file (const gchar *filename);
199 GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
200 GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,
202 GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set,
204 GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
205 GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name,
207 GtkWidget* gtk_image_new_from_gicon (GIcon *icon,
210 void gtk_image_clear (GtkImage *image);
211 void gtk_image_set_from_pixmap (GtkImage *image,
214 void gtk_image_set_from_image (GtkImage *image,
217 void gtk_image_set_from_file (GtkImage *image,
218 const gchar *filename);
219 void gtk_image_set_from_pixbuf (GtkImage *image,
221 void gtk_image_set_from_stock (GtkImage *image,
222 const gchar *stock_id,
224 void gtk_image_set_from_icon_set (GtkImage *image,
225 GtkIconSet *icon_set,
227 void gtk_image_set_from_animation (GtkImage *image,
228 GdkPixbufAnimation *animation);
229 void gtk_image_set_from_icon_name (GtkImage *image,
230 const gchar *icon_name,
232 void gtk_image_set_from_gicon (GtkImage *image,
235 void gtk_image_set_pixel_size (GtkImage *image,
238 GtkImageType gtk_image_get_storage_type (GtkImage *image);
240 void gtk_image_get_pixmap (GtkImage *image,
243 void gtk_image_get_image (GtkImage *image,
244 GdkImage **gdk_image,
246 GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
247 void gtk_image_get_stock (GtkImage *image,
250 void gtk_image_get_icon_set (GtkImage *image,
251 GtkIconSet **icon_set,
253 GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
254 void gtk_image_get_icon_name (GtkImage *image,
255 G_CONST_RETURN gchar **icon_name,
257 void gtk_image_get_gicon (GtkImage *image,
260 gint gtk_image_get_pixel_size (GtkImage *image);
264 #endif /* __GTK_IMAGE_H__ */