gtkimage.h 4.72 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
#define GTK_IMAGE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE, GtkImage))
#define GTK_IS_IMAGE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE))
Elliot Lee's avatar
Elliot Lee committed
42

43
typedef struct _GtkImage              GtkImage;
Elliot Lee's avatar
Elliot Lee committed
44

45
46
47
/**
 * GtkImageType:
 * @GTK_IMAGE_EMPTY: there is no image displayed by the widget
Matthias Clasen's avatar
Matthias Clasen committed
48
 * @GTK_IMAGE_ICON_NAME: the widget contains a named icon
Matthias Clasen's avatar
Matthias Clasen committed
49
50
 * @GTK_IMAGE_GICON: the widget contains a `GIcon`
 * @GTK_IMAGE_PAINTABLE: the widget contains a `GdkPaintable`
51
 *
52
53
54
55
56
57
58
59
 * Describes the image data representation used by a [class@Gtk.Image].
 *
 * If you want to get the image from the widget, you can only get the
 * currently-stored representation; for instance, if the gtk_image_get_storage_type()
 * returns %GTK_IMAGE_PAINTABLE, then you can call gtk_image_get_paintable().
 *
 * For empty images, you can request any storage type (call any of the "get"
 * functions), but they will all return %NULL values.
60
 */
61
62
63
typedef enum
{
  GTK_IMAGE_EMPTY,
64
  GTK_IMAGE_ICON_NAME,
65
  GTK_IMAGE_GICON,
66
  GTK_IMAGE_PAINTABLE
67
68
} GtkImageType;

69
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
70
GType      gtk_image_get_type (void) G_GNUC_CONST;
71

72
GDK_AVAILABLE_IN_ALL
73
GtkWidget* gtk_image_new                (void);
74
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
75
GtkWidget* gtk_image_new_from_file      (const char      *filename);
76
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
77
GtkWidget* gtk_image_new_from_resource  (const char      *resource_path);
78
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
79
GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
Matthias Clasen's avatar
Matthias Clasen committed
80
GDK_AVAILABLE_IN_ALL
81
82
GtkWidget* gtk_image_new_from_paintable (GdkPaintable    *paintable);
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
83
GtkWidget* gtk_image_new_from_icon_name (const char      *icon_name);
84
GDK_AVAILABLE_IN_ALL
85
GtkWidget* gtk_image_new_from_gicon     (GIcon           *icon);
Havoc Pennington's avatar
Havoc Pennington committed
86

87
GDK_AVAILABLE_IN_ALL
88
void gtk_image_clear              (GtkImage        *image);
89
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
90
void gtk_image_set_from_file      (GtkImage        *image,
Benjamin Otte's avatar
Benjamin Otte committed
91
                                   const char      *filename);
92
GDK_AVAILABLE_IN_ALL
93
void gtk_image_set_from_resource  (GtkImage        *image,
Benjamin Otte's avatar
Benjamin Otte committed
94
                                   const char      *resource_path);
95
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
96
97
void gtk_image_set_from_pixbuf    (GtkImage        *image,
                                   GdkPixbuf       *pixbuf);
Matthias Clasen's avatar
Matthias Clasen committed
98
GDK_AVAILABLE_IN_ALL
99
100
101
void gtk_image_set_from_paintable (GtkImage        *image,
                                   GdkPaintable    *paintable);
GDK_AVAILABLE_IN_ALL
102
void gtk_image_set_from_icon_name (GtkImage        *image,
Benjamin Otte's avatar
Benjamin Otte committed
103
				   const char      *icon_name);
104
GDK_AVAILABLE_IN_ALL
105
void gtk_image_set_from_gicon     (GtkImage        *image,
106
				   GIcon           *icon);
Matthias Clasen's avatar
Matthias Clasen committed
107
GDK_AVAILABLE_IN_ALL
108
void gtk_image_set_pixel_size     (GtkImage        *image,
Benjamin Otte's avatar
Benjamin Otte committed
109
				   int              pixel_size);
Matthias Clasen's avatar
Matthias Clasen committed
110
GDK_AVAILABLE_IN_ALL
111
112
void gtk_image_set_icon_size      (GtkImage        *image,
                                   GtkIconSize      icon_size);
113

114
GDK_AVAILABLE_IN_ALL
115
116
GtkImageType gtk_image_get_storage_type (GtkImage   *image);

117
118
GDK_AVAILABLE_IN_ALL
GdkPaintable *gtk_image_get_paintable (GtkImage       *image);
119

120
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
121
const char *gtk_image_get_icon_name (GtkImage     *image);
122
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
123
GIcon *    gtk_image_get_gicon     (GtkImage              *image);
124
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
125
int        gtk_image_get_pixel_size (GtkImage             *image);
Matthias Clasen's avatar
Matthias Clasen committed
126
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
127
GtkIconSize gtk_image_get_icon_size (GtkImage             *image);
128

129
130
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkImage, g_object_unref)

131
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
132
133

#endif /* __GTK_IMAGE_H__ */