| 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, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 20 | * file for a list of people on the GTK+ Team. See the ChangeLog |
| 21 | * files for a list of changes. These files are distributed with |
| 22 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 23 | */ |
| 24 | |
| 25 | #ifndef __GTK_IMAGE_H__ |
| 26 | #define __GTK_IMAGE_H__ |
| 27 | |
| 28 | |
| 29 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
| 30 | #error "Only <gtk/gtk.h> can be included directly." |
| 31 | #endif |
| 32 | |
| 33 | #include <gio/gio.h> |
| 34 | #include <gtk/deprecated/gtkmisc.h> |
| 35 | |
| 36 | |
| 37 | G_BEGIN_DECLS |
| 38 | |
| 39 | #define GTK_TYPE_IMAGE (gtk_image_get_type ()) |
| 40 | #define GTK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE, GtkImage)) |
| 41 | #define GTK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass)) |
| 42 | #define GTK_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE)) |
| 43 | #define GTK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE)) |
| 44 | #define GTK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE, GtkImageClass)) |
| 45 | |
| 46 | |
| 47 | typedef struct _GtkImage GtkImage; |
| 48 | typedef struct _GtkImagePrivate GtkImagePrivate; |
| 49 | typedef struct _GtkImageClass GtkImageClass; |
| 50 | |
| 51 | /** |
| 52 | * GtkImageType: |
| 53 | * @GTK_IMAGE_EMPTY: there is no image displayed by the widget |
| 54 | * @GTK_IMAGE_PIXBUF: the widget contains a #GdkPixbuf |
| 55 | * @GTK_IMAGE_STOCK: the widget contains a [stock item name][gtkstock] |
| 56 | * @GTK_IMAGE_ICON_SET: the widget contains a #GtkIconSet |
| 57 | * @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation |
| 58 | * @GTK_IMAGE_ICON_NAME: the widget contains a named icon. |
| 59 | * This image type was added in GTK+ 2.6 |
| 60 | * @GTK_IMAGE_GICON: the widget contains a #GIcon. |
| 61 | * This image type was added in GTK+ 2.14 |
| 62 | * @GTK_IMAGE_SURFACE: the widget contains a #cairo_surface_t. |
| 63 | * This image type was added in GTK+ 3.10 |
| 64 | * |
| 65 | * Describes the image data representation used by a #GtkImage. If you |
| 66 | * want to get the image from the widget, you can only get the |
| 67 | * currently-stored representation. e.g. if the |
| 68 | * gtk_image_get_storage_type() returns #GTK_IMAGE_PIXBUF, then you can |
| 69 | * call gtk_image_get_pixbuf() but not gtk_image_get_stock(). For empty |
| 70 | * images, you can request any storage type (call any of the "get" |
| 71 | * functions), but they will all return %NULL values. |
| 72 | */ |
| 73 | typedef enum |
| 74 | { |
| 75 | GTK_IMAGE_EMPTY, |
| 76 | GTK_IMAGE_PIXBUF, |
| 77 | GTK_IMAGE_STOCK, |
| 78 | GTK_IMAGE_ICON_SET, |
| 79 | GTK_IMAGE_ANIMATION, |
| 80 | GTK_IMAGE_ICON_NAME, |
| 81 | GTK_IMAGE_GICON, |
| 82 | GTK_IMAGE_SURFACE |
| 83 | } GtkImageType; |
| 84 | |
| 85 | /** |
| 86 | * GtkImage: |
| 87 | * |
| 88 | * This struct contain private data only and should be accessed by the functions |
| 89 | * below. |
| 90 | */ |
| 91 | struct _GtkImage |
| 92 | { |
| 93 | GtkMisc misc; |
| 94 | |
| 95 | /*< private >*/ |
| 96 | GtkImagePrivate *priv; |
| 97 | }; |
| 98 | |
| 99 | struct _GtkImageClass |
| 100 | { |
| 101 | GtkMiscClass parent_class; |
| 102 | |
| 103 | /* Padding for future expansion */ |
| 104 | void (*_gtk_reserved1) (void); |
| 105 | void (*_gtk_reserved2) (void); |
| 106 | void (*_gtk_reserved3) (void); |
| 107 | void (*_gtk_reserved4) (void); |
| 108 | }; |
| 109 | |
| 110 | GDK_AVAILABLE_IN_ALL |
| 111 | GType gtk_image_get_type (void) G_GNUC_CONST; |
| 112 | |
| 113 | GDK_AVAILABLE_IN_ALL |
| 114 | GtkWidget* gtk_image_new (void); |
| 115 | GDK_AVAILABLE_IN_ALL |
| 116 | GtkWidget* gtk_image_new_from_file (const gchar *filename); |
| 117 | GDK_AVAILABLE_IN_ALL |
| 118 | GtkWidget* gtk_image_new_from_resource (const gchar *resource_path); |
| 119 | GDK_AVAILABLE_IN_ALL |
| 120 | GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf); |
| 121 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name) |
| 122 | GtkWidget* gtk_image_new_from_stock (const gchar *stock_id, |
| 123 | GtkIconSize size); |
| 124 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name) |
| 125 | GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set, |
| 126 | GtkIconSize size); |
| 127 | GDK_AVAILABLE_IN_ALL |
| 128 | GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation); |
| 129 | GDK_AVAILABLE_IN_ALL |
| 130 | GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name, |
| 131 | GtkIconSize size); |
| 132 | GDK_AVAILABLE_IN_ALL |
| 133 | GtkWidget* gtk_image_new_from_gicon (GIcon *icon, |
| 134 | GtkIconSize size); |
| 135 | GDK_AVAILABLE_IN_3_10 |
| 136 | GtkWidget* gtk_image_new_from_surface (cairo_surface_t *surface); |
| 137 | |
| 138 | GDK_AVAILABLE_IN_ALL |
| 139 | void gtk_image_clear (GtkImage *image); |
| 140 | GDK_AVAILABLE_IN_ALL |
| 141 | void gtk_image_set_from_file (GtkImage *image, |
| 142 | const gchar *filename); |
| 143 | GDK_AVAILABLE_IN_ALL |
| 144 | void gtk_image_set_from_resource (GtkImage *image, |
| 145 | const gchar *resource_path); |
| 146 | GDK_AVAILABLE_IN_ALL |
| 147 | void gtk_image_set_from_pixbuf (GtkImage *image, |
| 148 | GdkPixbuf *pixbuf); |
| 149 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name) |
| 150 | void gtk_image_set_from_stock (GtkImage *image, |
| 151 | const gchar *stock_id, |
| 152 | GtkIconSize size); |
| 153 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name) |
| 154 | void gtk_image_set_from_icon_set (GtkImage *image, |
| 155 | GtkIconSet *icon_set, |
| 156 | GtkIconSize size); |
| 157 | GDK_AVAILABLE_IN_ALL |
| 158 | void gtk_image_set_from_animation (GtkImage *image, |
| 159 | GdkPixbufAnimation *animation); |
| 160 | GDK_AVAILABLE_IN_ALL |
| 161 | void gtk_image_set_from_icon_name (GtkImage *image, |
| 162 | const gchar *icon_name, |
| 163 | GtkIconSize size); |
| 164 | GDK_AVAILABLE_IN_ALL |
| 165 | void gtk_image_set_from_gicon (GtkImage *image, |
| 166 | GIcon *icon, |
| 167 | GtkIconSize size); |
| 168 | GDK_AVAILABLE_IN_3_10 |
| 169 | void gtk_image_set_from_surface (GtkImage *image, |
| 170 | cairo_surface_t *surface); |
| 171 | GDK_AVAILABLE_IN_ALL |
| 172 | void gtk_image_set_pixel_size (GtkImage *image, |
| 173 | gint pixel_size); |
| 174 | |
| 175 | GDK_AVAILABLE_IN_ALL |
| 176 | GtkImageType gtk_image_get_storage_type (GtkImage *image); |
| 177 | |
| 178 | GDK_AVAILABLE_IN_ALL |
| 179 | GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image); |
| 180 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_get_icon_name) |
| 181 | void gtk_image_get_stock (GtkImage *image, |
| 182 | gchar **stock_id, |
| 183 | GtkIconSize *size); |
| 184 | GDK_DEPRECATED_IN_3_10_FOR(gtk_image_get_icon_name) |
| 185 | void gtk_image_get_icon_set (GtkImage *image, |
| 186 | GtkIconSet **icon_set, |
| 187 | GtkIconSize *size); |
| 188 | GDK_AVAILABLE_IN_ALL |
| 189 | GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image); |
| 190 | GDK_AVAILABLE_IN_ALL |
| 191 | void gtk_image_get_icon_name (GtkImage *image, |
| 192 | const gchar **icon_name, |
| 193 | GtkIconSize *size); |
| 194 | GDK_AVAILABLE_IN_ALL |
| 195 | void gtk_image_get_gicon (GtkImage *image, |
| 196 | GIcon **gicon, |
| 197 | GtkIconSize *size); |
| 198 | GDK_AVAILABLE_IN_ALL |
| 199 | gint gtk_image_get_pixel_size (GtkImage *image); |
| 200 | |
| 201 | G_END_DECLS |
| 202 | |
| 203 | #endif /* __GTK_IMAGE_H__ */ |
| 204 | |