sync; includes some sample stock images, and initial GtkImage hack
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtkstock.c: Code to add sample default stock items.
|
||||
|
||||
* gtk/gtkiconfactory.c: Code to add the sample default stock icons
|
||||
to the default icon factory
|
||||
|
||||
* gtk/stock-icons/Makefile.am: Add stock-icons directory with a
|
||||
Makefile.am and some sample stock icons
|
||||
|
||||
Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: make the current version number 1.3.1 (binary age 0,
|
||||
|
||||
@@ -1002,6 +1002,7 @@ gdk/nanox/Makefile
|
||||
gdk/linux-fb/Makefile
|
||||
gtk/Makefile
|
||||
gtk/gtkcompat.h
|
||||
gtk/stock-icons/Makefile
|
||||
modules/Makefile
|
||||
modules/linux-fb/Makefile
|
||||
], [chmod +x gtk-config])
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2000-06-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk-pixbuf-private.h (GdkPixbufInlineFormat): include an
|
||||
enum here for the known formats of inlined pixbufs.
|
||||
Also, #define our file magic here.
|
||||
|
||||
2000-06-23 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* image-to-inline.c: Small program that creates C variable
|
||||
|
||||
@@ -98,15 +98,47 @@ read_bool (const guchar **p)
|
||||
return val;
|
||||
}
|
||||
|
||||
/* sync with image-to-inline.c */
|
||||
#define MAGIC_NUMBER 1804289383
|
||||
|
||||
static void
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
read_raw_inline (const guchar *data, gboolean copy_pixels)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
const guchar *p = data;
|
||||
|
||||
pixbuf = GDK_PIXBUF (g_type_create_instance (GDK_TYPE_PIXBUF));
|
||||
|
||||
pixbuf->rowstride = read_int (&p);
|
||||
pixbuf->width = read_int (&p);
|
||||
pixbuf->height = read_int (&p);
|
||||
pixbuf->has_alpha = read_bool (&p);
|
||||
pixbuf->colorspace = read_int (&p);
|
||||
pixbuf->n_channels = read_int (&p);
|
||||
pixbuf->bits_per_sample = read_int (&p);
|
||||
|
||||
if (copy_pixels) {
|
||||
pixbuf->pixels = malloc (pixbuf->height * pixbuf->rowstride);
|
||||
|
||||
if (pixbuf->pixels == NULL) {
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf->destroy_fn = free_buffer;
|
||||
pixbuf->destroy_fn_data = NULL;
|
||||
|
||||
memcpy (pixbuf->pixels, p, pixbuf->height * pixbuf->rowstride);
|
||||
} else {
|
||||
pixbuf->pixels = (guchar *) p;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_inline:
|
||||
* @data: An inlined GdkPixbuf
|
||||
@@ -132,40 +164,26 @@ gdk_pixbuf_new_from_inline (const guchar *inline_pixbuf,
|
||||
{
|
||||
const guchar *p;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
GdkPixbufInlineFormat format;
|
||||
|
||||
p = inline_pixbuf;
|
||||
|
||||
if (read_int (&p) != MAGIC_NUMBER) {
|
||||
if (read_int (&p) != GDK_PIXBUF_INLINE_MAGIC_NUMBER) {
|
||||
g_warning ("Bad inline data; wrong magic number");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf = GDK_PIXBUF (g_type_create_instance (GDK_TYPE_PIXBUF));
|
||||
format = read_int (&p);
|
||||
|
||||
pixbuf->rowstride = read_int (&p);
|
||||
pixbuf->width = read_int (&p);
|
||||
pixbuf->height = read_int (&p);
|
||||
pixbuf->has_alpha = read_bool (&p);
|
||||
pixbuf->colorspace = read_int (&p);
|
||||
pixbuf->n_channels = read_int (&p);
|
||||
pixbuf->bits_per_sample = read_int (&p);
|
||||
|
||||
if (copy_pixels) {
|
||||
pixbuf->pixels = malloc (pixbuf->height * pixbuf->rowstride);
|
||||
switch (format)
|
||||
{
|
||||
case GDK_PIXBUF_INLINE_RAW:
|
||||
pixbuf = read_raw_inline (p, copy_pixels);
|
||||
break;
|
||||
|
||||
if (pixbuf->pixels == NULL) {
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf->destroy_fn = free_buffer;
|
||||
pixbuf->destroy_fn_data = NULL;
|
||||
|
||||
memcpy (pixbuf->pixels, p, pixbuf->height * pixbuf->rowstride);
|
||||
} else {
|
||||
pixbuf->pixels = (guchar *) p;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
@@ -117,4 +117,14 @@ struct _GdkPixbufAnimationClass {
|
||||
|
||||
|
||||
|
||||
#define GDK_PIXBUF_INLINE_MAGIC_NUMBER 1804289383
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_PIXBUF_INLINE_RAW = 0,
|
||||
GDK_PIXBUF_INLINE_RLE = 1
|
||||
} GdkPixbufInlineFormat;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,14 +21,11 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* sync with gdk-pixbuf-data.c */
|
||||
#define MAGIC_NUMBER 1804289383
|
||||
|
||||
void
|
||||
output_int (FILE *outfile, int number, const char *comment)
|
||||
{
|
||||
@@ -81,7 +78,8 @@ output_pixbuf (FILE *outfile, gboolean ext_symbols,
|
||||
/* Sync the order of writing with the order of reading in
|
||||
* gdk-pixbuf-data.c
|
||||
*/
|
||||
output_int (outfile, MAGIC_NUMBER, "File magic");
|
||||
output_int (outfile, GDK_PIXBUF_INLINE_MAGIC_NUMBER, "File magic");
|
||||
output_int (outfile, GDK_PIXBUF_INLINE_RAW, "Format of following stuff");
|
||||
output_int (outfile, gdk_pixbuf_get_rowstride (pixbuf), "Rowstride");
|
||||
output_int (outfile, gdk_pixbuf_get_width (pixbuf), "Width");
|
||||
output_int (outfile, gdk_pixbuf_get_height (pixbuf), "Height");
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
*/
|
||||
|
||||
#include "gtkiconfactory.h"
|
||||
#include "stock-icons/gtkstockpixbufs.h"
|
||||
#include "gtkstock.h"
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
static void gtk_icon_factory_init (GtkIconFactory *icon_factory);
|
||||
static void gtk_icon_factory_class_init (GtkIconFactoryClass *klass);
|
||||
static void gtk_icon_factory_finalize (GObject *object);
|
||||
static void get_default_icons (GtkIconFactory *icon_factory);
|
||||
|
||||
GType
|
||||
gtk_icon_factory_get_type (void)
|
||||
@@ -175,16 +178,109 @@ gtk_default_icon_lookup (const gchar *stock_id)
|
||||
|
||||
if (gtk_default_icons == NULL)
|
||||
{
|
||||
/* FIXME create our default icons, should be kept
|
||||
* in sync with the default stock items.
|
||||
*/
|
||||
gtk_default_icons = gtk_icon_factory_new ();
|
||||
|
||||
|
||||
get_default_icons (gtk_default_icons);
|
||||
}
|
||||
|
||||
return gtk_icon_factory_lookup (gtk_default_icons, stock_id);
|
||||
}
|
||||
|
||||
static GtkIconSet *
|
||||
sized_icon_set_from_inline (const guchar *inline_data,
|
||||
GtkIconSizeType size)
|
||||
{
|
||||
GtkIconSet *set;
|
||||
|
||||
GtkIconSource source = { NULL, NULL, 0, 0, size,
|
||||
TRUE, TRUE, FALSE };
|
||||
|
||||
set = gtk_icon_set_new ();
|
||||
|
||||
source.pixbuf = gdk_pixbuf_new_from_inline (inline_data, FALSE);
|
||||
|
||||
g_assert (source.pixbuf);
|
||||
|
||||
gtk_icon_set_add_source (set, &source);
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
static GtkIconSet *
|
||||
unsized_icon_set_from_inline (const guchar *inline_data)
|
||||
{
|
||||
GtkIconSet *set;
|
||||
|
||||
/* This icon can be used for any direction/state/size */
|
||||
GtkIconSource source = { NULL, NULL, 0, 0, 0,
|
||||
TRUE, TRUE, TRUE };
|
||||
|
||||
set = gtk_icon_set_new ();
|
||||
|
||||
source.pixbuf = gdk_pixbuf_new_from_inline (inline_data, FALSE);
|
||||
|
||||
g_assert (source.pixbuf);
|
||||
|
||||
gtk_icon_set_add_source (set, &source);
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
static void
|
||||
add_sized (GtkIconFactory *factory,
|
||||
const guchar *inline_data,
|
||||
GtkIconSizeType size,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
GtkIconSet *set;
|
||||
|
||||
set = sized_icon_set_from_inline (inline_data, size);
|
||||
|
||||
gtk_icon_factory_add (factory, stock_id, set);
|
||||
|
||||
g_object_unref (G_OBJECT (set));
|
||||
}
|
||||
|
||||
static void
|
||||
add_unsized (GtkIconFactory *factory,
|
||||
const guchar *inline_data,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
GtkIconSet *set;
|
||||
|
||||
set = unsized_icon_set_from_inline (inline_data);
|
||||
|
||||
gtk_icon_factory_add (factory, stock_id, set);
|
||||
|
||||
g_object_unref (G_OBJECT (set));
|
||||
}
|
||||
|
||||
static void
|
||||
get_default_icons (GtkIconFactory *factory)
|
||||
{
|
||||
/* KEEP IN SYNC with gtkstock.c */
|
||||
|
||||
add_sized (factory, dialog_default, GTK_ICON_DIALOG, GTK_STOCK_DIALOG_GENERIC);
|
||||
add_sized (factory, dialog_error, GTK_ICON_DIALOG, GTK_STOCK_DIALOG_ERROR);
|
||||
add_sized (factory, dialog_info, GTK_ICON_DIALOG, GTK_STOCK_DIALOG_INFO);
|
||||
add_sized (factory, dialog_question, GTK_ICON_DIALOG, GTK_STOCK_DIALOG_QUESTION);
|
||||
add_sized (factory, dialog_warning, GTK_ICON_DIALOG, GTK_STOCK_DIALOG_WARNING);
|
||||
|
||||
add_sized (factory, stock_button_apply, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_APPLY);
|
||||
add_sized (factory, stock_button_ok, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_OK);
|
||||
add_sized (factory, stock_button_cancel, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_CANCEL);
|
||||
add_sized (factory, stock_button_close, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_CLOSE);
|
||||
add_sized (factory, stock_button_yes, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_YES);
|
||||
add_sized (factory, stock_button_no, GTK_ICON_BUTTON, GTK_STOCK_BUTTON_NO);
|
||||
|
||||
add_unsized (factory, stock_close, GTK_STOCK_CLOSE);
|
||||
add_unsized (factory, stock_exit, GTK_STOCK_QUIT);
|
||||
add_unsized (factory, stock_help, GTK_STOCK_HELP);
|
||||
add_unsized (factory, stock_new, GTK_STOCK_NEW);
|
||||
add_unsized (factory, stock_open, GTK_STOCK_OPEN);
|
||||
add_unsized (factory, stock_save, GTK_STOCK_SAVE);
|
||||
}
|
||||
|
||||
/* Sizes */
|
||||
|
||||
|
||||
@@ -197,7 +293,8 @@ static gint widths[] =
|
||||
16, /* menu */
|
||||
24, /* button */
|
||||
18, /* small toolbar */
|
||||
24 /* large toolbar */
|
||||
24, /* large toolbar */
|
||||
48 /* dialog */
|
||||
};
|
||||
|
||||
static gint heights[] =
|
||||
@@ -205,7 +302,8 @@ static gint heights[] =
|
||||
16, /* menu */
|
||||
24, /* button */
|
||||
18, /* small toolbar */
|
||||
24 /* large toolbar */
|
||||
24, /* large toolbar */
|
||||
48 /* dialog */
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
486
gtk/gtkimage.c
@@ -33,6 +33,10 @@ static void gtk_image_init (GtkImage *image);
|
||||
static gint gtk_image_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
static void gtk_image_clear (GtkImage *image);
|
||||
static void gtk_image_update_size (GtkImage *image,
|
||||
gint image_width,
|
||||
gint image_height);
|
||||
|
||||
GtkType
|
||||
gtk_image_get_type (void)
|
||||
@@ -74,8 +78,258 @@ gtk_image_init (GtkImage *image)
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW);
|
||||
|
||||
image->image = NULL;
|
||||
image->mask = NULL;
|
||||
image->representation_type = GTK_IMAGE_EMPTY;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_image_new_from_pixmap (GdkPixmap *pixmap,
|
||||
GdkBitmap *mask)
|
||||
{
|
||||
GtkImage *image;
|
||||
|
||||
image = gtk_type_new (GTK_TYPE_IMAGE);
|
||||
|
||||
gtk_image_set_from_pixmap (image, pixmap, mask);
|
||||
|
||||
return GTK_WIDGET (image);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_image_new_from_image (GdkImage *gdk_image,
|
||||
GdkBitmap *mask)
|
||||
{
|
||||
GtkImage *image;
|
||||
|
||||
image = gtk_type_new (GTK_TYPE_IMAGE);
|
||||
|
||||
gtk_image_set_from_image (image, gdk_image, mask);
|
||||
|
||||
return GTK_WIDGET (image);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_image_new_from_file (const gchar *filename)
|
||||
{
|
||||
GtkImage *image;
|
||||
|
||||
image = gtk_type_new (GTK_TYPE_IMAGE);
|
||||
|
||||
gtk_image_set_from_file (image, filename);
|
||||
|
||||
return GTK_WIDGET (image);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
||||
{
|
||||
GtkImage *image;
|
||||
|
||||
image = gtk_type_new (GTK_TYPE_IMAGE);
|
||||
|
||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||
|
||||
return GTK_WIDGET (image);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_image_new_from_stock (const gchar *stock_id,
|
||||
GtkIconSizeType size)
|
||||
{
|
||||
GtkImage *image;
|
||||
|
||||
image = gtk_type_new (GTK_TYPE_IMAGE);
|
||||
|
||||
gtk_image_set_from_stock (image, stock_id, size);
|
||||
|
||||
return GTK_WIDGET (image);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_set_from_pixmap (GtkImage *image,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
if (pixmap)
|
||||
g_object_ref (G_OBJECT (pixmap));
|
||||
|
||||
if (mask)
|
||||
g_object_ref (G_OBJECT (mask));
|
||||
|
||||
gtk_image_clear (image);
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
||||
image->representation_type = GTK_IMAGE_PIXMAP;
|
||||
|
||||
image->data.pixmap.pixmap = pixmap;
|
||||
image->data.pixmap.mask = mask;
|
||||
|
||||
gdk_drawable_get_size (GDK_DRAWABLE (pixmap), &width, &height);
|
||||
|
||||
gtk_image_update_size (image, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clean up the mask if pixmap was NULL */
|
||||
if (mask)
|
||||
g_object_unref (G_OBJECT (mask));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_set_from_image (GtkImage *image,
|
||||
GdkImage *gdk_image,
|
||||
GdkBitmap *mask)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
if (gdk_image)
|
||||
g_object_ref (G_OBJECT (gdk_image));
|
||||
|
||||
if (mask)
|
||||
g_object_ref (G_OBJECT (mask));
|
||||
|
||||
gtk_image_clear (image);
|
||||
|
||||
if (gdk_image)
|
||||
{
|
||||
image->representation_type = GTK_IMAGE_IMAGE;
|
||||
|
||||
image->data.image.image = gdk_image;
|
||||
image->data.image.mask = mask;
|
||||
|
||||
gtk_image_update_size (image, gdk_image->width, gdk_image->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clean up the mask if gdk_image was NULL */
|
||||
if (mask)
|
||||
g_object_unref (G_OBJECT (mask));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_set_from_file (GtkImage *image,
|
||||
const gchar *filename)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
gtk_image_clear (image);
|
||||
|
||||
if (filename == NULL)
|
||||
return;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename);
|
||||
|
||||
if (pixbuf == NULL)
|
||||
return;
|
||||
|
||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_set_from_pixbuf (GtkImage *image,
|
||||
GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
if (pixbuf)
|
||||
g_object_ref (G_OBJECT (pixbuf));
|
||||
|
||||
gtk_image_clear (image);
|
||||
|
||||
if (pixbuf != NULL)
|
||||
{
|
||||
image->representation_type = GTK_IMAGE_PIXBUF;
|
||||
|
||||
image->data.pixbuf.pixbuf = pixbuf;
|
||||
|
||||
gtk_image_update_size (image,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_set_from_stock (GtkImage *image,
|
||||
const gchar *stock_id,
|
||||
GtkIconSizeType size)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
gtk_image_clear (image);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
image->representation_type = GTK_IMAGE_STOCK;
|
||||
|
||||
image->data.stock.stock_id = g_strdup (stock_id);
|
||||
image->data.stock.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_get_pixmap (GtkImage *image,
|
||||
GdkPixmap **pixmap,
|
||||
GdkBitmap **mask)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
g_return_if_fail (image->representation_type == GTK_IMAGE_PIXMAP);
|
||||
|
||||
if (pixmap)
|
||||
*pixmap = image->data.pixmap.pixmap;
|
||||
|
||||
if (mask)
|
||||
*mask = image->data.pixmap.mask;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_get_image (GtkImage *image,
|
||||
GdkImage **gdk_image,
|
||||
GdkBitmap **mask)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
g_return_if_fail (image->representation_type == GTK_IMAGE_IMAGE);
|
||||
|
||||
if (gdk_image)
|
||||
*gdk_image = image->data.image.image;
|
||||
|
||||
if (mask)
|
||||
*mask = image->data.image.mask;
|
||||
}
|
||||
|
||||
GdkPixbuf*
|
||||
gtk_image_get_pixbuf (GtkImage *image)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (image->representation_type == GTK_IMAGE_PIXBUF, NULL);
|
||||
|
||||
return image->data.pixbuf.pixbuf;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_image_get_stock (GtkImage *image,
|
||||
gchar **stock_id,
|
||||
GtkIconSizeType *size)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
g_return_if_fail (image->representation_type == GTK_IMAGE_STOCK);
|
||||
|
||||
|
||||
if (stock_id)
|
||||
*stock_id = g_strdup (image->data.stock.stock_id);
|
||||
|
||||
if (size)
|
||||
*size = image->data.stock.size;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
@@ -98,25 +352,9 @@ gtk_image_set (GtkImage *image,
|
||||
GdkImage *val,
|
||||
GdkBitmap *mask)
|
||||
{
|
||||
g_return_if_fail (image != NULL);
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
image->image = val;
|
||||
image->mask = mask;
|
||||
|
||||
if (image->image)
|
||||
{
|
||||
GTK_WIDGET (image)->requisition.width = image->image->width + GTK_MISC (image)->xpad * 2;
|
||||
GTK_WIDGET (image)->requisition.height = image->image->height + GTK_MISC (image)->ypad * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
GTK_WIDGET (image)->requisition.width = 0;
|
||||
GTK_WIDGET (image)->requisition.height = 0;
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (image))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (image));
|
||||
gtk_image_set_from_image (image, val, mask);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -124,13 +362,9 @@ gtk_image_get (GtkImage *image,
|
||||
GdkImage **val,
|
||||
GdkBitmap **mask)
|
||||
{
|
||||
g_return_if_fail (image != NULL);
|
||||
g_return_if_fail (GTK_IS_IMAGE (image));
|
||||
|
||||
if (val)
|
||||
*val = image->image;
|
||||
if (mask)
|
||||
*mask = image->mask;
|
||||
gtk_image_get_image (image, val, mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,13 +375,16 @@ gtk_image_expose (GtkWidget *widget,
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_IMAGE (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
|
||||
GTK_IMAGE (widget)->representation_type != GTK_IMAGE_EMPTY)
|
||||
{
|
||||
GtkImage *image;
|
||||
GtkMisc *misc;
|
||||
GdkRectangle area, image_bound, intersection;
|
||||
gint x, y;
|
||||
GdkBitmap *mask = NULL;
|
||||
GdkPixbuf *stock_pixbuf = NULL;
|
||||
|
||||
image = GTK_IMAGE (widget);
|
||||
misc = GTK_MISC (widget);
|
||||
@@ -161,35 +398,190 @@ gtk_image_expose (GtkWidget *widget,
|
||||
- (widget->requisition.height - misc->ypad * 2)) *
|
||||
misc->yalign) + 0.5;
|
||||
|
||||
if (image->mask)
|
||||
image_bound.x = x;
|
||||
image_bound.y = y;
|
||||
|
||||
switch (image->representation_type)
|
||||
{
|
||||
case GTK_IMAGE_PIXMAP:
|
||||
mask = image->data.pixmap.mask;
|
||||
gdk_drawable_get_size (image->data.pixmap.pixmap,
|
||||
&image_bound.width,
|
||||
&image_bound.height);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_IMAGE:
|
||||
mask = image->data.image.mask;
|
||||
image_bound.width = image->data.image.image->width;
|
||||
image_bound.height = image->data.image.image->height;
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_PIXBUF:
|
||||
image_bound.width = gdk_pixbuf_get_width (image->data.pixbuf.pixbuf);
|
||||
image_bound.height = gdk_pixbuf_get_height (image->data.pixbuf.pixbuf);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_STOCK:
|
||||
stock_pixbuf = gtk_widget_get_icon (widget,
|
||||
image->data.stock.stock_id,
|
||||
image->data.stock.size,
|
||||
NULL);
|
||||
|
||||
if (stock_pixbuf)
|
||||
{
|
||||
image_bound.width = gdk_pixbuf_get_width (stock_pixbuf);
|
||||
image_bound.height = gdk_pixbuf_get_height (stock_pixbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (widget->style->black_gc, image->mask);
|
||||
gdk_gc_set_clip_mask (widget->style->black_gc, mask);
|
||||
gdk_gc_set_clip_origin (widget->style->black_gc, x, y);
|
||||
}
|
||||
|
||||
image_bound.x = x;
|
||||
image_bound.y = y;
|
||||
image_bound.width = image->image->width;
|
||||
image_bound.height = image->image->height;
|
||||
|
||||
area = event->area;
|
||||
|
||||
if(gdk_rectangle_intersect(&image_bound, &area, &intersection))
|
||||
if (gdk_rectangle_intersect (&image_bound, &area, &intersection))
|
||||
{
|
||||
gdk_draw_image (widget->window,
|
||||
widget->style->black_gc,
|
||||
image->image,
|
||||
image_bound.x - x, image_bound.y - y,
|
||||
image_bound.x, image_bound.y,
|
||||
image_bound.width, image_bound.height);
|
||||
|
||||
switch (image->representation_type)
|
||||
{
|
||||
case GTK_IMAGE_PIXMAP:
|
||||
gdk_draw_drawable (widget->window,
|
||||
widget->style->black_gc,
|
||||
image->data.pixmap.pixmap,
|
||||
image_bound.x - x, image_bound.y - y,
|
||||
image_bound.x, image_bound.y,
|
||||
image_bound.width, image_bound.height);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_IMAGE:
|
||||
gdk_draw_image (widget->window,
|
||||
widget->style->black_gc,
|
||||
image->data.image.image,
|
||||
image_bound.x - x, image_bound.y - y,
|
||||
image_bound.x, image_bound.y,
|
||||
image_bound.width, image_bound.height);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_PIXBUF:
|
||||
gdk_pixbuf_render_to_drawable_alpha (image->data.pixbuf.pixbuf,
|
||||
widget->window,
|
||||
image_bound.x - x, image_bound.y - y,
|
||||
image_bound.x, image_bound.y,
|
||||
image_bound.width, image_bound.height,
|
||||
GDK_PIXBUF_ALPHA_FULL,
|
||||
128,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_STOCK:
|
||||
if (stock_pixbuf)
|
||||
{
|
||||
gdk_pixbuf_render_to_drawable_alpha (image->data.pixbuf.pixbuf,
|
||||
widget->window,
|
||||
image_bound.x - x, image_bound.y - y,
|
||||
image_bound.x, image_bound.y,
|
||||
image_bound.width, image_bound.height,
|
||||
GDK_PIXBUF_ALPHA_FULL,
|
||||
128,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
|
||||
g_object_unref (G_OBJECT (stock_pixbuf));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} /* if rectangle intersects */
|
||||
if (mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (widget->style->black_gc, NULL);
|
||||
gdk_gc_set_clip_origin (widget->style->black_gc, 0, 0);
|
||||
}
|
||||
|
||||
if (image->mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (widget->style->black_gc, NULL);
|
||||
gdk_gc_set_clip_origin (widget->style->black_gc, 0, 0);
|
||||
}
|
||||
}
|
||||
} /* if widget is drawable */
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_clear (GtkImage *image)
|
||||
{
|
||||
switch (image->representation_type)
|
||||
{
|
||||
case GTK_IMAGE_PIXMAP:
|
||||
|
||||
if (image->data.pixmap.pixmap)
|
||||
g_object_unref (G_OBJECT (image->data.pixmap.pixmap));
|
||||
|
||||
if (image->data.pixmap.mask)
|
||||
g_object_unref (G_OBJECT (image->data.pixmap.mask));
|
||||
|
||||
image->data.pixmap.pixmap = NULL;
|
||||
image->data.pixmap.mask = NULL;
|
||||
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_IMAGE:
|
||||
|
||||
if (image->data.image.image)
|
||||
g_object_unref (G_OBJECT (image->data.image.image));
|
||||
|
||||
if (image->data.image.mask)
|
||||
g_object_unref (G_OBJECT (image->data.image.mask));
|
||||
|
||||
image->data.image.image = NULL;
|
||||
image->data.image.mask = NULL;
|
||||
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_PIXBUF:
|
||||
|
||||
if (image->data.pixbuf.pixbuf)
|
||||
g_object_unref (G_OBJECT (image->data.pixbuf.pixbuf));
|
||||
|
||||
image->data.pixbuf.pixbuf = NULL;
|
||||
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_STOCK:
|
||||
|
||||
if (image->data.stock.stock_id)
|
||||
g_free (image->data.stock.stock_id);
|
||||
|
||||
image->data.stock.stock_id = NULL;
|
||||
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_EMPTY:
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
image->representation_type = GTK_IMAGE_EMPTY;
|
||||
|
||||
GTK_WIDGET (image)->requisition.width = 0;
|
||||
GTK_WIDGET (image)->requisition.height = 0;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (image))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (image));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_update_size (GtkImage *image,
|
||||
gint image_width,
|
||||
gint image_height)
|
||||
{
|
||||
GTK_WIDGET (image)->requisition.width = image_width + GTK_MISC (image)->xpad * 2;
|
||||
GTK_WIDGET (image)->requisition.height = image_height + GTK_MISC (image)->ypad * 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_TYPE_IMAGE (gtk_image_get_type ())
|
||||
#define GTK_IMAGE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMAGE, GtkImage))
|
||||
#define GTK_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass))
|
||||
@@ -48,12 +47,56 @@ extern "C" {
|
||||
typedef struct _GtkImage GtkImage;
|
||||
typedef struct _GtkImageClass GtkImageClass;
|
||||
|
||||
typedef struct _GtkImagePixmapData GtkImagePixmapData;
|
||||
typedef struct _GtkImageImageData GtkImageImageData;
|
||||
typedef struct _GtkImagePixbufData GtkImagePixbufData;
|
||||
typedef struct _GtkImageStockData GtkImageStockData;
|
||||
|
||||
struct _GtkImagePixmapData
|
||||
{
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
};
|
||||
|
||||
struct _GtkImageImageData
|
||||
{
|
||||
GdkImage *image;
|
||||
GdkBitmap *mask;
|
||||
};
|
||||
|
||||
struct _GtkImagePixbufData
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
};
|
||||
|
||||
struct _GtkImageStockData
|
||||
{
|
||||
gchar *stock_id;
|
||||
GtkIconSizeType size;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_IMAGE_EMPTY,
|
||||
GTK_IMAGE_PIXMAP,
|
||||
GTK_IMAGE_IMAGE,
|
||||
GTK_IMAGE_PIXBUF,
|
||||
GTK_IMAGE_STOCK
|
||||
} GtkImageType;
|
||||
|
||||
struct _GtkImage
|
||||
{
|
||||
GtkMisc misc;
|
||||
|
||||
GdkImage *image;
|
||||
GdkBitmap *mask;
|
||||
GtkImageType representation_type;
|
||||
|
||||
union
|
||||
{
|
||||
GtkImagePixmapData pixmap;
|
||||
GtkImageImageData image;
|
||||
GtkImagePixbufData pixbuf;
|
||||
GtkImageStockData stock;
|
||||
} data;
|
||||
};
|
||||
|
||||
struct _GtkImageClass
|
||||
@@ -63,6 +106,43 @@ struct _GtkImageClass
|
||||
|
||||
|
||||
GtkType gtk_image_get_type (void);
|
||||
|
||||
GtkWidget* gtk_image_new_from_pixmap (GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
GtkWidget* gtk_image_new_from_image (GdkImage *image,
|
||||
GdkBitmap *mask);
|
||||
GtkWidget* gtk_image_new_from_file (const gchar *filename);
|
||||
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
||||
GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,
|
||||
GtkIconSizeType size);
|
||||
|
||||
void gtk_image_set_from_pixmap (GtkImage *image,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
void gtk_image_set_from_image (GtkImage *image,
|
||||
GdkImage *gdk_image,
|
||||
GdkBitmap *mask);
|
||||
void gtk_image_set_from_file (GtkImage *image,
|
||||
const gchar *filename);
|
||||
void gtk_image_set_from_pixbuf (GtkImage *image,
|
||||
GdkPixbuf *pixbuf);
|
||||
void gtk_image_set_from_stock (GtkImage *image,
|
||||
const gchar *stock_id,
|
||||
GtkIconSizeType size);
|
||||
|
||||
void gtk_image_get_pixmap (GtkImage *image,
|
||||
GdkPixmap **pixmap,
|
||||
GdkBitmap **mask);
|
||||
void gtk_image_get_image (GtkImage *image,
|
||||
GdkImage **gdk_image,
|
||||
GdkBitmap **mask);
|
||||
GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
|
||||
void gtk_image_get_stock (GtkImage *image,
|
||||
gchar **stock_id,
|
||||
GtkIconSizeType *size);
|
||||
|
||||
|
||||
/* These three are deprecated */
|
||||
GtkWidget* gtk_image_new (GdkImage *val,
|
||||
GdkBitmap *mask);
|
||||
void gtk_image_set (GtkImage *image,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "gtkstock.h"
|
||||
@@ -37,22 +37,22 @@ real_add (const GtkStockItem *items,
|
||||
gboolean copy)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
init_stock_hash ();
|
||||
|
||||
if (n_items == 0)
|
||||
return;
|
||||
|
||||
|
||||
i = 0;
|
||||
while (i < n_items)
|
||||
{
|
||||
const GtkStockItem * item = &items[i];
|
||||
if (copy)
|
||||
item = gtk_stock_item_copy (item);
|
||||
|
||||
|
||||
g_hash_table_insert (stock_hash,
|
||||
(gchar*)item->stock_id, (GtkStockItem*)item);
|
||||
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ gtk_stock_add_static (const GtkStockItem *items,
|
||||
guint n_items)
|
||||
{
|
||||
g_return_if_fail (items != NULL);
|
||||
|
||||
|
||||
real_add (items, n_items, FALSE);
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ gtk_stock_lookup (const gchar *stock_id,
|
||||
|
||||
g_return_val_if_fail (stock_id != NULL, FALSE);
|
||||
g_return_val_if_fail (item != NULL, FALSE);
|
||||
|
||||
|
||||
init_stock_hash ();
|
||||
|
||||
|
||||
found = g_hash_table_lookup (stock_hash, stock_id);
|
||||
|
||||
if (found)
|
||||
@@ -100,11 +100,11 @@ gtk_stock_item_copy (const GtkStockItem *item)
|
||||
GtkStockItem *copy;
|
||||
|
||||
g_return_val_if_fail (item != NULL, NULL);
|
||||
|
||||
|
||||
copy = g_new (GtkStockItem, 1);
|
||||
|
||||
*copy = *item;
|
||||
|
||||
|
||||
copy->stock_id = g_strdup (item->stock_id);
|
||||
copy->label = g_strdup (item->label);
|
||||
copy->translation_domain = g_strdup (item->translation_domain);
|
||||
@@ -124,22 +124,40 @@ gtk_stock_item_free (GtkStockItem *item)
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
#define GTK_DOMAIN "gtk+"
|
||||
|
||||
static GtkStockItem builtin_items [] =
|
||||
{
|
||||
/* FIXME these are just examples */
|
||||
/* and the OK accelerator is wrong, Return means default button,
|
||||
OK should have its own accelerator */
|
||||
{ GTK_STOCK_OK, N_("OK"), 0, GDK_Return, "gtk+" },
|
||||
{ GTK_STOCK_EXIT, N_("Exit"), GDK_CONTROL_MASK, GDK_x, "gtk+" }
|
||||
};
|
||||
/* KEEP IN SYNC with gtkiconfactory.c stock icons */
|
||||
|
||||
{ GTK_STOCK_DIALOG_GENERIC, N_("Message"), 0, 0, GTK_DOMAIN },
|
||||
{ GTK_STOCK_DIALOG_INFO, N_("Information"), 0, 0, GTK_DOMAIN },
|
||||
{ GTK_STOCK_DIALOG_WARNING, N_("Warning"), 0, 0, GTK_DOMAIN },
|
||||
{ GTK_STOCK_DIALOG_ERROR, N_("Error"), 0, 0, GTK_DOMAIN },
|
||||
{ GTK_STOCK_DIALOG_QUESTION, N_("Question"), 0, 0, GTK_DOMAIN },
|
||||
|
||||
{ GTK_STOCK_BUTTON_APPLY, N_("Apply"), GDK_CONTROL_MASK, 'a', GTK_DOMAIN },
|
||||
{ GTK_STOCK_BUTTON_OK, N_("OK"), GDK_CONTROL_MASK, 'o', GTK_DOMAIN },
|
||||
{ GTK_STOCK_BUTTON_CANCEL, N_("Cancel"), GDK_CONTROL_MASK, 'c', GTK_DOMAIN },
|
||||
{ GTK_STOCK_BUTTON_CLOSE, N_("Close"), GDK_CONTROL_MASK, 'c', GTK_DOMAIN },
|
||||
{ GTK_STOCK_BUTTON_YES, N_("Yes"), GDK_CONTROL_MASK, 'y', GTK_DOMAIN },
|
||||
{ GTK_STOCK_BUTTON_NO, N_("No"), GDK_CONTROL_MASK, 'n', GTK_DOMAIN },
|
||||
|
||||
{ GTK_STOCK_CLOSE, N_("Close"), GDK_CONTROL_MASK, 'w', GTK_DOMAIN },
|
||||
{ GTK_STOCK_QUIT, N_("Quit"), GDK_CONTROL_MASK, 'q', GTK_DOMAIN },
|
||||
{ GTK_STOCK_HELP, N_("Help"), GDK_CONTROL_MASK, 'h', GTK_DOMAIN },
|
||||
{ GTK_STOCK_NEW, N_("New"), GDK_CONTROL_MASK, 'n', GTK_DOMAIN },
|
||||
{ GTK_STOCK_OPEN, N_("Open"), GDK_CONTROL_MASK, 'o', GTK_DOMAIN },
|
||||
{ GTK_STOCK_SAVE, N_("Save"), GDK_CONTROL_MASK, 's', GTK_DOMAIN }
|
||||
};
|
||||
|
||||
static void
|
||||
init_stock_hash (void)
|
||||
{
|
||||
if (stock_hash == NULL)
|
||||
{
|
||||
stock_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
|
||||
gtk_stock_add_static (builtin_items, G_N_ELEMENTS (builtin_items));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,25 @@ void gtk_stock_item_free (GtkStockItem *item);
|
||||
|
||||
|
||||
/* Stock IDs */
|
||||
#define GTK_STOCK_OK "OK"
|
||||
#define GTK_STOCK_CANCEL "Cancel"
|
||||
#define GTK_STOCK_EXIT "Exit"
|
||||
#define GTK_STOCK_DIALOG_GENERIC "Gtk_Message_Dialog"
|
||||
#define GTK_STOCK_DIALOG_INFO "Gtk_Info_Dialog"
|
||||
#define GTK_STOCK_DIALOG_WARNING "Gtk_Warning_Dialog"
|
||||
#define GTK_STOCK_DIALOG_ERROR "Gtk_Error_Dialog"
|
||||
#define GTK_STOCK_DIALOG_QUESTION "Gtk_Question_Dialog"
|
||||
|
||||
#define GTK_STOCK_BUTTON_APPLY "Gtk_Apply_Button"
|
||||
#define GTK_STOCK_BUTTON_OK "Gtk_OK_Button"
|
||||
#define GTK_STOCK_BUTTON_CANCEL "Gtk_Cancel_Button"
|
||||
#define GTK_STOCK_BUTTON_CLOSE "Gtk_Close_Button"
|
||||
#define GTK_STOCK_BUTTON_YES "Gtk_Yes_Button"
|
||||
#define GTK_STOCK_BUTTON_NO "Gtk_No_Button"
|
||||
|
||||
#define GTK_STOCK_CLOSE "Gtk_Close"
|
||||
#define GTK_STOCK_QUIT "Gtk_Quit"
|
||||
#define GTK_STOCK_HELP "Gtk_Help"
|
||||
#define GTK_STOCK_NEW "Gtk_New"
|
||||
#define GTK_STOCK_OPEN "Gtk_Open"
|
||||
#define GTK_STOCK_SAVE "Gtk_Save"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ typedef enum
|
||||
GTK_ICON_MENU,
|
||||
GTK_ICON_BUTTON,
|
||||
GTK_ICON_SMALL_TOOLBAR,
|
||||
GTK_ICON_LARGE_TOOLBAR
|
||||
GTK_ICON_LARGE_TOOLBAR,
|
||||
GTK_ICON_DIALOG
|
||||
} GtkIconSizeType;
|
||||
|
||||
/* We make this forward declaration here, since we pass
|
||||
|
||||
24
gtk/stock-icons/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
BUILT_SOURCES=gtkstockpixbufs.h
|
||||
|
||||
IMAGES=dialog_default.png dialog_error.png dialog_info.png dialog_question.png dialog_warning.png stock_button_apply.png stock_button_cancel.png stock_button_close.png stock_button_no.png stock_button_ok.png stock_button_yes.png stock_close.png stock_exit.png stock_help.png stock_new.png stock_open.png stock_save.png
|
||||
|
||||
VARIABLES= dialog_default dialog_default.png \
|
||||
dialog_error dialog_error.png \
|
||||
dialog_info dialog_info.png \
|
||||
dialog_question dialog_question.png \
|
||||
dialog_warning dialog_warning.png \
|
||||
stock_button_apply stock_button_apply.png \
|
||||
stock_button_cancel stock_button_cancel.png \
|
||||
stock_button_close stock_button_close.png \
|
||||
stock_button_no stock_button_no.png \
|
||||
stock_button_ok stock_button_ok.png \
|
||||
stock_button_yes stock_button_yes.png \
|
||||
stock_close stock_close.png \
|
||||
stock_exit stock_exit.png \
|
||||
stock_help stock_help.png \
|
||||
stock_new stock_new.png \
|
||||
stock_open stock_open.png \
|
||||
stock_save stock_save.png
|
||||
|
||||
gtkstockpixbufs.h: $(top_builddir)/gdk-pixbuf/make-inline-pixbuf $(IMAGES)
|
||||
GDK_PIXBUF_MODULEDIR=$(top_builddir)/gdk-pixbuf/.libs $(top_builddir)/gdk-pixbuf/make-inline-pixbuf gtkstockpixbufs.h $(VARIABLES)
|
||||
BIN
gtk/stock-icons/dialog_default.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
gtk/stock-icons/dialog_error.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
gtk/stock-icons/dialog_error_48.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
gtk/stock-icons/dialog_info.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
gtk/stock-icons/dialog_info_48.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
gtk/stock-icons/dialog_question.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
gtk/stock-icons/dialog_question_48.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
gtk/stock-icons/dialog_warning.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
gtk/stock-icons/dialog_warning_48.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
gtk/stock-icons/stock_apply_20.png
Normal file
|
After Width: | Height: | Size: 452 B |
BIN
gtk/stock-icons/stock_button_apply.png
Normal file
|
After Width: | Height: | Size: 452 B |
BIN
gtk/stock-icons/stock_button_apply_24.png
Normal file
|
After Width: | Height: | Size: 452 B |
BIN
gtk/stock-icons/stock_button_cancel.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
gtk/stock-icons/stock_button_cancel_24.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
gtk/stock-icons/stock_button_close.png
Normal file
|
After Width: | Height: | Size: 286 B |
BIN
gtk/stock-icons/stock_button_close_24.png
Normal file
|
After Width: | Height: | Size: 286 B |
BIN
gtk/stock-icons/stock_button_no.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
gtk/stock-icons/stock_button_no_24.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
gtk/stock-icons/stock_button_ok.png
Normal file
|
After Width: | Height: | Size: 661 B |
BIN
gtk/stock-icons/stock_button_ok_24.png
Normal file
|
After Width: | Height: | Size: 661 B |
BIN
gtk/stock-icons/stock_button_yes.png
Normal file
|
After Width: | Height: | Size: 806 B |
BIN
gtk/stock-icons/stock_button_yes_24.png
Normal file
|
After Width: | Height: | Size: 806 B |
BIN
gtk/stock-icons/stock_cancel_20.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
gtk/stock-icons/stock_close.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
gtk/stock-icons/stock_close_20.png
Normal file
|
After Width: | Height: | Size: 286 B |
BIN
gtk/stock-icons/stock_close_24.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
gtk/stock-icons/stock_dialog_error_48.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
gtk/stock-icons/stock_dialog_info_48.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
gtk/stock-icons/stock_dialog_question_48.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
gtk/stock-icons/stock_dialog_warning_48.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
gtk/stock-icons/stock_exit.png
Normal file
|
After Width: | Height: | Size: 413 B |
BIN
gtk/stock-icons/stock_exit_24.png
Normal file
|
After Width: | Height: | Size: 413 B |
BIN
gtk/stock-icons/stock_help.png
Normal file
|
After Width: | Height: | Size: 480 B |
BIN
gtk/stock-icons/stock_help_24.png
Normal file
|
After Width: | Height: | Size: 480 B |
BIN
gtk/stock-icons/stock_new.png
Normal file
|
After Width: | Height: | Size: 771 B |
BIN
gtk/stock-icons/stock_new_24.png
Normal file
|
After Width: | Height: | Size: 771 B |
BIN
gtk/stock-icons/stock_no_20.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
gtk/stock-icons/stock_ok_20.png
Normal file
|
After Width: | Height: | Size: 661 B |
BIN
gtk/stock-icons/stock_open.png
Normal file
|
After Width: | Height: | Size: 393 B |
BIN
gtk/stock-icons/stock_open_24.png
Normal file
|
After Width: | Height: | Size: 393 B |
BIN
gtk/stock-icons/stock_save.png
Normal file
|
After Width: | Height: | Size: 849 B |
BIN
gtk/stock-icons/stock_save_24.png
Normal file
|
After Width: | Height: | Size: 849 B |
BIN
gtk/stock-icons/stock_yes_20.png
Normal file
|
After Width: | Height: | Size: 806 B |