]> Pileus Git - ~andy/gtk/blob - gtk/gtkimage.h
Fix gtk-doc markup: /* <private> */ should be /*< private >*/
[~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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_IMAGE_H__
32 #define __GTK_IMAGE_H__
33
34
35 #include <gio/gio.h>
36 #include <gtk/gtkmisc.h>
37
38
39 G_BEGIN_DECLS
40
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))
47
48
49 typedef struct _GtkImage              GtkImage;
50 typedef struct _GtkImagePrivate       GtkImagePrivate;
51 typedef struct _GtkImageClass         GtkImageClass;
52
53 typedef struct _GtkImagePixbufData  GtkImagePixbufData;
54 typedef struct _GtkImageStockData   GtkImageStockData;
55 typedef struct _GtkImageIconSetData GtkImageIconSetData;
56 typedef struct _GtkImageAnimationData GtkImageAnimationData;
57 typedef struct _GtkImageIconNameData  GtkImageIconNameData;
58 typedef struct _GtkImageGIconData     GtkImageGIconData;
59
60 struct _GtkImagePixbufData
61 {
62   GdkPixbuf *pixbuf;
63 };
64
65 struct _GtkImageStockData
66 {
67   gchar *stock_id;
68 };
69
70 struct _GtkImageIconSetData
71 {
72   GtkIconSet *icon_set;
73 };
74
75 struct _GtkImageAnimationData
76 {
77   GdkPixbufAnimation *anim;
78   GdkPixbufAnimationIter *iter;
79   guint frame_timeout;
80 };
81
82 struct _GtkImageIconNameData
83 {
84   gchar *icon_name;
85   GdkPixbuf *pixbuf;
86   guint theme_change_id;
87 };
88
89 struct _GtkImageGIconData
90 {
91   GIcon *icon;
92   GdkPixbuf *pixbuf;
93   guint theme_change_id;
94 };
95
96 /**
97  * GtkImageType:
98  * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
99  * @GTK_IMAGE_PIXBUF: the widget contains a #GdkPixbuf
100  * @GTK_IMAGE_STOCK: the widget contains a stock icon name (see
101  *  <xref linkend="gtk3-Stock-Items"/>)
102  * @GTK_IMAGE_ICON_SET: the widget contains a #GtkIconSet
103  * @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation
104  * @GTK_IMAGE_ICON_NAME: the widget contains a named icon.
105  *  This image type was added in GTK+ 2.6
106  * @GTK_IMAGE_GICON: the widget contains a #GIcon.
107  *  This image type was added in GTK+ 2.14
108  *
109  * Describes the image data representation used by a #GtkImage. If you
110  * want to get the image from the widget, you can only get the
111  * currently-stored representation. e.g.  if the
112  * gtk_image_get_storage_type() returns #GTK_IMAGE_PIXBUF, then you can
113  * call gtk_image_get_pixbuf() but not gtk_image_get_stock().  For empty
114  * images, you can request any storage type (call any of the "get"
115  * functions), but they will all return %NULL values.
116  */
117 typedef enum
118 {
119   GTK_IMAGE_EMPTY,
120   GTK_IMAGE_PIXBUF,
121   GTK_IMAGE_STOCK,
122   GTK_IMAGE_ICON_SET,
123   GTK_IMAGE_ANIMATION,
124   GTK_IMAGE_ICON_NAME,
125   GTK_IMAGE_GICON
126 } GtkImageType;
127
128 /**
129  * GtkImage:
130  *
131  * This struct contain private data only and should be accessed by the functions
132  * below.
133  */
134 struct _GtkImage
135 {
136   GtkMisc misc;
137
138   /*< private >*/
139   GtkImagePrivate *priv;
140 };
141
142 struct _GtkImageClass
143 {
144   GtkMiscClass parent_class;
145
146   /* Padding for future expansion */
147   void (*_gtk_reserved1) (void);
148   void (*_gtk_reserved2) (void);
149   void (*_gtk_reserved3) (void);
150   void (*_gtk_reserved4) (void);
151 };
152
153 GType      gtk_image_get_type (void) G_GNUC_CONST;
154
155 GtkWidget* gtk_image_new                (void);
156 GtkWidget* gtk_image_new_from_file      (const gchar     *filename);
157 GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
158 GtkWidget* gtk_image_new_from_stock     (const gchar     *stock_id,
159                                          GtkIconSize      size);
160 GtkWidget* gtk_image_new_from_icon_set  (GtkIconSet      *icon_set,
161                                          GtkIconSize      size);
162 GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
163 GtkWidget* gtk_image_new_from_icon_name (const gchar     *icon_name,
164                                          GtkIconSize      size);
165 GtkWidget* gtk_image_new_from_gicon     (GIcon           *icon,
166                                          GtkIconSize      size);
167
168 void gtk_image_clear              (GtkImage        *image);
169 void gtk_image_set_from_file      (GtkImage        *image,
170                                    const gchar     *filename);
171 void gtk_image_set_from_pixbuf    (GtkImage        *image,
172                                    GdkPixbuf       *pixbuf);
173 void gtk_image_set_from_stock     (GtkImage        *image,
174                                    const gchar     *stock_id,
175                                    GtkIconSize      size);
176 void gtk_image_set_from_icon_set  (GtkImage        *image,
177                                    GtkIconSet      *icon_set,
178                                    GtkIconSize      size);
179 void gtk_image_set_from_animation (GtkImage           *image,
180                                    GdkPixbufAnimation *animation);
181 void gtk_image_set_from_icon_name (GtkImage        *image,
182                                    const gchar     *icon_name,
183                                    GtkIconSize      size);
184 void gtk_image_set_from_gicon     (GtkImage        *image,
185                                    GIcon           *icon,
186                                    GtkIconSize      size);
187 void gtk_image_set_pixel_size     (GtkImage        *image,
188                                    gint             pixel_size);
189
190 GtkImageType gtk_image_get_storage_type (GtkImage   *image);
191
192 GdkPixbuf* gtk_image_get_pixbuf   (GtkImage         *image);
193 void       gtk_image_get_stock    (GtkImage         *image,
194                                    gchar           **stock_id,
195                                    GtkIconSize      *size);
196 void       gtk_image_get_icon_set (GtkImage         *image,
197                                    GtkIconSet      **icon_set,
198                                    GtkIconSize      *size);
199 GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
200 void       gtk_image_get_icon_name (GtkImage              *image,
201                                     G_CONST_RETURN gchar **icon_name,
202                                     GtkIconSize           *size);
203 void       gtk_image_get_gicon     (GtkImage              *image,
204                                     GIcon                **gicon,
205                                     GtkIconSize           *size);
206 gint       gtk_image_get_pixel_size (GtkImage             *image);
207
208 G_END_DECLS
209
210 #endif /* __GTK_IMAGE_H__ */