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/gtkwidget.h>
35
36
37G_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_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE))
42
43typedef struct _GtkImage GtkImage;
44
45/**
46 * GtkImageType:
47 * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
48 * @GTK_IMAGE_ICON_NAME: the widget contains a named icon
49 * @GTK_IMAGE_GICON: the widget contains a `GIcon`
50 * @GTK_IMAGE_PAINTABLE: the widget contains a `GdkPaintable`
51 *
52 * Describes the image data representation used by a [class@Gtk.Image].
53 *
54 * If you want to get the image from the widget, you can only get the
55 * currently-stored representation; for instance, if the gtk_image_get_storage_type()
56 * returns %GTK_IMAGE_PAINTABLE, then you can call gtk_image_get_paintable().
57 *
58 * For empty images, you can request any storage type (call any of the "get"
59 * functions), but they will all return %NULL values.
60 */
61typedef enum
62{
63 GTK_IMAGE_EMPTY,
64 GTK_IMAGE_ICON_NAME,
65 GTK_IMAGE_GICON,
66 GTK_IMAGE_PAINTABLE
67} GtkImageType;
68
69GDK_AVAILABLE_IN_ALL
70GType gtk_image_get_type (void) G_GNUC_CONST;
71
72GDK_AVAILABLE_IN_ALL
73GtkWidget* gtk_image_new (void);
74GDK_AVAILABLE_IN_ALL
75GtkWidget* gtk_image_new_from_file (const char *filename);
76GDK_AVAILABLE_IN_ALL
77GtkWidget* gtk_image_new_from_resource (const char *resource_path);
78GDK_AVAILABLE_IN_ALL
79GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
80GDK_AVAILABLE_IN_ALL
81GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
82GDK_AVAILABLE_IN_ALL
83GtkWidget* gtk_image_new_from_icon_name (const char *icon_name);
84GDK_AVAILABLE_IN_ALL
85GtkWidget* gtk_image_new_from_gicon (GIcon *icon);
86
87GDK_AVAILABLE_IN_ALL
88void gtk_image_clear (GtkImage *image);
89GDK_AVAILABLE_IN_ALL
90void gtk_image_set_from_file (GtkImage *image,
91 const char *filename);
92GDK_AVAILABLE_IN_ALL
93void gtk_image_set_from_resource (GtkImage *image,
94 const char *resource_path);
95GDK_AVAILABLE_IN_ALL
96void gtk_image_set_from_pixbuf (GtkImage *image,
97 GdkPixbuf *pixbuf);
98GDK_AVAILABLE_IN_ALL
99void gtk_image_set_from_paintable (GtkImage *image,
100 GdkPaintable *paintable);
101GDK_AVAILABLE_IN_ALL
102void gtk_image_set_from_icon_name (GtkImage *image,
103 const char *icon_name);
104GDK_AVAILABLE_IN_ALL
105void gtk_image_set_from_gicon (GtkImage *image,
106 GIcon *icon);
107GDK_AVAILABLE_IN_ALL
108void gtk_image_set_pixel_size (GtkImage *image,
109 int pixel_size);
110GDK_AVAILABLE_IN_ALL
111void gtk_image_set_icon_size (GtkImage *image,
112 GtkIconSize icon_size);
113
114GDK_AVAILABLE_IN_ALL
115GtkImageType gtk_image_get_storage_type (GtkImage *image);
116
117GDK_AVAILABLE_IN_ALL
118GdkPaintable *gtk_image_get_paintable (GtkImage *image);
119
120GDK_AVAILABLE_IN_ALL
121const char *gtk_image_get_icon_name (GtkImage *image);
122GDK_AVAILABLE_IN_ALL
123GIcon * gtk_image_get_gicon (GtkImage *image);
124GDK_AVAILABLE_IN_ALL
125int gtk_image_get_pixel_size (GtkImage *image);
126GDK_AVAILABLE_IN_ALL
127GtkIconSize gtk_image_get_icon_size (GtkImage *image);
128
129G_END_DECLS
130
131#endif /* __GTK_IMAGE_H__ */
132

source code of gtk/gtk/gtkimage.h