30
32
#include "gimppixmap.h"
33
static void gimp_pixmap_class_init (GimpPixmapClass *klass);
34
static void gimp_pixmap_init (GimpPixmap *pixmap);
36
static void gimp_pixmap_realize (GtkWidget *widget);
37
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
40
static GtkImageClass *parent_class = NULL;
44
gimp_pixmap_get_type (void)
46
static GType pixmap_type = 0;
50
static const GTypeInfo pixmap_info =
52
sizeof (GimpPixmapClass),
54
(GBaseFinalizeFunc) NULL,
55
(GClassInitFunc) gimp_pixmap_class_init,
56
NULL, /* class_finalize */
57
NULL, /* class_data */
60
(GInstanceInitFunc) gimp_pixmap_init,
63
pixmap_type = g_type_register_static (GTK_TYPE_IMAGE,
35
static void gimp_pixmap_realize (GtkWidget *widget);
36
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
39
G_DEFINE_TYPE (GimpPixmap, gimp_pixmap, GTK_TYPE_IMAGE)
41
#define parent_class gimp_pixmap_parent_class
72
45
gimp_pixmap_class_init (GimpPixmapClass *klass)
74
47
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
76
parent_class = g_type_class_peek_parent (klass);
78
49
widget_class->realize = gimp_pixmap_realize;
123
94
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
129
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
131
g_warning ("%s: passed pointer is no XPM data", G_STRFUNC);
135
GTK_WIDGET (pixmap)->requisition.width =
136
width + GTK_MISC (pixmap)->xpad * 2;
137
GTK_WIDGET (pixmap)->requisition.height =
138
height + GTK_MISC (pixmap)->ypad * 2;
100
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
102
g_warning ("%s: passed pointer is no XPM data", G_STRFUNC);
106
GTK_WIDGET (pixmap)->requisition.width =
107
width + GTK_MISC (pixmap)->xpad * 2;
108
GTK_WIDGET (pixmap)->requisition.height =
109
height + GTK_MISC (pixmap)->ypad * 2;
170
141
style = gtk_widget_get_style (widget);
172
143
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
174
&style->bg[GTK_STATE_NORMAL],
145
&style->bg[GTK_STATE_NORMAL],
178
149
gtk_image_set_from_pixmap (GTK_IMAGE (pixmap), gdk_pixmap, mask);