]> Pileus Git - ~andy/gtk/blob - gtk/gtkimage.h
CVS is doing its broken pipe thing, this is more of the previous commit
[~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
56 struct _GtkImagePixmapData
57 {
58   GdkPixmap *pixmap;
59   GdkBitmap *mask;
60 };
61
62 struct _GtkImageImageData
63 {
64   GdkImage *image;
65   GdkBitmap *mask;
66 };
67
68 struct _GtkImagePixbufData
69 {
70   GdkPixbuf *pixbuf;
71 };
72
73 struct _GtkImageStockData
74 {
75   gchar *stock_id;
76   gchar *size;
77 };
78
79 struct _GtkImageIconSetData
80 {
81   GtkIconSet *icon_set;
82   gchar      *size;
83 };
84
85 typedef enum
86 {
87   GTK_IMAGE_EMPTY,
88   GTK_IMAGE_PIXMAP,
89   GTK_IMAGE_IMAGE,
90   GTK_IMAGE_PIXBUF,
91   GTK_IMAGE_STOCK,
92   GTK_IMAGE_ICON_SET
93 } GtkImageType;
94
95 struct _GtkImage
96 {
97   GtkMisc misc;
98
99   GtkImageType storage_type;
100   
101   union
102   {
103     GtkImagePixmapData pixmap;
104     GtkImageImageData image;
105     GtkImagePixbufData pixbuf;
106     GtkImageStockData stock;
107     GtkImageIconSetData icon_set;
108   } data;
109 };
110
111 struct _GtkImageClass
112 {
113   GtkMiscClass parent_class;
114 };
115
116 GtkType    gtk_image_get_type (void) G_GNUC_CONST;
117
118 GtkWidget* gtk_image_new_from_pixmap   (GdkPixmap       *pixmap,
119                                         GdkBitmap       *mask);
120 GtkWidget* gtk_image_new_from_image    (GdkImage        *image,
121                                         GdkBitmap       *mask);
122 GtkWidget* gtk_image_new_from_file     (const gchar     *filename);
123 GtkWidget* gtk_image_new_from_pixbuf   (GdkPixbuf       *pixbuf);
124 GtkWidget* gtk_image_new_from_stock    (const gchar     *stock_id,
125                                         const gchar     *size);
126 GtkWidget* gtk_image_new_from_icon_set (GtkIconSet      *icon_set,
127                                         const gchar     *size);
128
129 void gtk_image_set_from_pixmap   (GtkImage        *image,
130                                   GdkPixmap       *pixmap,
131                                   GdkBitmap       *mask);
132 void gtk_image_set_from_image    (GtkImage        *image,
133                                   GdkImage        *gdk_image,
134                                   GdkBitmap       *mask);
135 void gtk_image_set_from_file     (GtkImage        *image,
136                                   const gchar     *filename);
137 void gtk_image_set_from_pixbuf   (GtkImage        *image,
138                                   GdkPixbuf       *pixbuf);
139 void gtk_image_set_from_stock    (GtkImage        *image,
140                                   const gchar     *stock_id,
141                                   const gchar     *size);
142 void gtk_image_set_from_icon_set (GtkImage        *image,
143                                   GtkIconSet      *icon_set,
144                                   const gchar     *size);
145
146 GtkImageType gtk_image_get_storage_type (GtkImage   *image);
147
148 void       gtk_image_get_pixmap   (GtkImage         *image,
149                                    GdkPixmap       **pixmap,
150                                    GdkBitmap       **mask);
151 void       gtk_image_get_image    (GtkImage         *image,
152                                    GdkImage        **gdk_image,
153                                    GdkBitmap       **mask);
154 GdkPixbuf* gtk_image_get_pixbuf   (GtkImage         *image);
155 void       gtk_image_get_stock    (GtkImage         *image,
156                                    gchar           **stock_id,
157                                    gchar           **size);
158 void       gtk_image_get_icon_set (GtkImage         *image,
159                                    GtkIconSet      **icon_set,
160                                    gchar           **size);
161
162
163 #ifndef GTK_DISABLE_DEPRECATED
164 /* These three are deprecated */
165
166 GtkWidget* gtk_image_new      (GdkImage   *val,
167                                GdkBitmap  *mask);
168 void       gtk_image_set      (GtkImage   *image,
169                                GdkImage   *val,
170                                GdkBitmap  *mask);
171 void       gtk_image_get      (GtkImage   *image,
172                                GdkImage  **val,
173                                GdkBitmap **mask);
174 #endif /* GTK_DISABLE_DEPRECATED */
175
176 #ifdef __cplusplus
177 }
178 #endif /* __cplusplus */
179
180
181 #endif /* __GTK_IMAGE_H__ */