gtkimage.h 6.07 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10 11
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17 18

/*
19
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20 21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

Elliot Lee's avatar
Elliot Lee committed
25 26 27 28
#ifndef __GTK_IMAGE_H__
#define __GTK_IMAGE_H__


29 30 31 32
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

33
#include <gio/gio.h>
34
#include <gtk/gtkwidget.h>
Elliot Lee's avatar
Elliot Lee committed
35 36


37
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
38

39
#define GTK_TYPE_IMAGE                  (gtk_image_get_type ())
Manish Singh's avatar
Manish Singh committed
40 41 42 43 44
#define GTK_IMAGE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE, GtkImage))
#define GTK_IMAGE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass))
#define GTK_IS_IMAGE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE))
#define GTK_IS_IMAGE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE))
#define GTK_IMAGE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE, GtkImageClass))
Elliot Lee's avatar
Elliot Lee committed
45 46


47 48 49
typedef struct _GtkImage              GtkImage;
typedef struct _GtkImagePrivate       GtkImagePrivate;
typedef struct _GtkImageClass         GtkImageClass;
Elliot Lee's avatar
Elliot Lee committed
50

51 52 53 54 55 56 57 58 59
/**
 * GtkImageType:
 * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
 * @GTK_IMAGE_PIXBUF: the widget contains a #GdkPixbuf
 * @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation
 * @GTK_IMAGE_ICON_NAME: the widget contains a named icon.
 *  This image type was added in GTK+ 2.6
 * @GTK_IMAGE_GICON: the widget contains a #GIcon.
 *  This image type was added in GTK+ 2.14
60 61
 * @GTK_IMAGE_SURFACE: the widget contains a #cairo_surface_t.
 *  This image type was added in GTK+ 3.10
62 63 64 65 66
 *
 * Describes the image data representation used by a #GtkImage. If you
 * want to get the image from the widget, you can only get the
 * currently-stored representation. e.g.  if the
 * gtk_image_get_storage_type() returns #GTK_IMAGE_PIXBUF, then you can
67 68 69
 * call gtk_image_get_pixbuf().  For empty images, you can request any
 * storage type (call any of the "get" functions), but they will all
 * return %NULL values.
70
 */
71 72 73 74
typedef enum
{
  GTK_IMAGE_EMPTY,
  GTK_IMAGE_PIXBUF,
75
  GTK_IMAGE_ANIMATION,
76
  GTK_IMAGE_ICON_NAME,
77 78
  GTK_IMAGE_GICON,
  GTK_IMAGE_SURFACE
79 80
} GtkImageType;

81 82 83 84 85 86
/**
 * GtkImage:
 *
 * This struct contain private data only and should be accessed by the functions
 * below.
 */
87 88
struct _GtkImage
{
89
  GtkWidget parent_instance;
90

91
  /*< private >*/
92
  GtkImagePrivate *priv;
93 94
};

Elliot Lee's avatar
Elliot Lee committed
95 96
struct _GtkImageClass
{
97
  GtkWidgetClass parent_class;
98 99 100 101 102 103

  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
Elliot Lee's avatar
Elliot Lee committed
104 105
};

106
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
107
GType      gtk_image_get_type (void) G_GNUC_CONST;
108

109
GDK_AVAILABLE_IN_ALL
110
GtkWidget* gtk_image_new                (void);
111
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
112
GtkWidget* gtk_image_new_from_file      (const gchar     *filename);
113
GDK_AVAILABLE_IN_ALL
114
GtkWidget* gtk_image_new_from_resource  (const gchar     *resource_path);
115
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
116
GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
117
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
118
GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
119
GDK_AVAILABLE_IN_ALL
120 121
GtkWidget* gtk_image_new_from_icon_name (const gchar     *icon_name,
					 GtkIconSize      size);
122
GDK_AVAILABLE_IN_ALL
123 124
GtkWidget* gtk_image_new_from_gicon     (GIcon           *icon,
					 GtkIconSize      size);
125 126
GDK_AVAILABLE_IN_3_10
GtkWidget* gtk_image_new_from_surface   (cairo_surface_t *surface);
Havoc Pennington's avatar
Havoc Pennington committed
127

128
GDK_AVAILABLE_IN_ALL
129
void gtk_image_clear              (GtkImage        *image);
130
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
131 132
void gtk_image_set_from_file      (GtkImage        *image,
                                   const gchar     *filename);
133
GDK_AVAILABLE_IN_ALL
134 135
void gtk_image_set_from_resource  (GtkImage        *image,
                                   const gchar     *resource_path);
136
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
137 138
void gtk_image_set_from_pixbuf    (GtkImage        *image,
                                   GdkPixbuf       *pixbuf);
139
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
140 141
void gtk_image_set_from_animation (GtkImage           *image,
                                   GdkPixbufAnimation *animation);
142
GDK_AVAILABLE_IN_ALL
143 144 145
void gtk_image_set_from_icon_name (GtkImage        *image,
				   const gchar     *icon_name,
				   GtkIconSize      size);
146
GDK_AVAILABLE_IN_ALL
147 148 149
void gtk_image_set_from_gicon     (GtkImage        *image,
				   GIcon           *icon,
				   GtkIconSize      size);
150 151 152
GDK_AVAILABLE_IN_3_10
void gtk_image_set_from_surface   (GtkImage        *image,
				   cairo_surface_t *surface);
153
GDK_AVAILABLE_IN_ALL
154 155
void gtk_image_set_pixel_size     (GtkImage        *image,
				   gint             pixel_size);
156

157
GDK_AVAILABLE_IN_ALL
158 159
GtkImageType gtk_image_get_storage_type (GtkImage   *image);

160
GDK_AVAILABLE_IN_ALL
161
GdkPixbuf* gtk_image_get_pixbuf   (GtkImage         *image);
162
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
163
GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
164
GDK_AVAILABLE_IN_ALL
165 166 167
void       gtk_image_get_icon_name (GtkImage     *image,
				    const gchar **icon_name,
				    GtkIconSize  *size);
168
GDK_AVAILABLE_IN_ALL
169 170 171
void       gtk_image_get_gicon     (GtkImage              *image,
				    GIcon                **gicon,
				    GtkIconSize           *size);
172
GDK_AVAILABLE_IN_ALL
173
gint       gtk_image_get_pixel_size (GtkImage             *image);
174

175
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
176 177

#endif /* __GTK_IMAGE_H__ */