From 502e5a8859b87b141f6f45b657769a77edea8493 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 4 Oct 2000 16:39:44 +0000 Subject: [PATCH] Fix copyrights 2000-10-04 Havoc Pennington * gtk/gtkstock.h, gtk/gtkstock.c, gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Fix copyrights * demos/testpixbuf.c: add inline pixbuf test --- demos/Makefile.am | 5 +++ demos/testpixbuf.c | 11 ++++- docs/reference/ChangeLog | 4 ++ docs/reference/gtk/tmpl/gtkrc.sgml | 72 ++++++++++++++++++++++++++++++ gtk/gtkiconfactory.c | 2 +- gtk/gtkiconfactory.h | 2 +- gtk/gtkstock.c | 2 +- gtk/gtkstock.h | 2 +- 8 files changed, 95 insertions(+), 5 deletions(-) diff --git a/demos/Makefile.am b/demos/Makefile.am index eefb30f09..13d3b2636 100644 --- a/demos/Makefile.am +++ b/demos/Makefile.am @@ -37,6 +37,11 @@ noinst_PROGRAMS = \ testpixbuf-scale \ pixbuf-demo +BUILT_SOURCES=test-inline-pixbufs.h + +test-inline-pixbufs.h: $(top_builddir)/gdk-pixbuf/make-inline-pixbuf apple-red.png gnome-foot.png + GDK_PIXBUF_MODULEDIR=$(top_builddir)/gdk-pixbuf/.libs $(top_builddir)/gdk-pixbuf/make-inline-pixbuf test-inline-pixbufs.h apple_red apple-red.png gnome_foot gnome-foot.png + testpixbuf_DEPENDENCIES = $(DEPS) testpixbuf_drawable_DEPENDENCIES = $(DEPS) testpixbuf_scale_DEPENDENCIES = $(DEPS) diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c index fe96bd390..c6d5a45c5 100644 --- a/demos/testpixbuf.c +++ b/demos/testpixbuf.c @@ -25,6 +25,8 @@ #include #include +#include "test-inline-pixbufs.h" + typedef struct { FILE *imagefile; GdkPixbufLoader *loader; @@ -375,7 +377,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title) window = gtk_widget_new (gtk_window_get_type (), "GtkObject::user_data", NULL, "GtkWindow::type", GTK_WINDOW_TOPLEVEL, - "GtkWindow::title", "testrgb", + "GtkWindow::title", title ? title : "testrgb", "GtkWindow::allow_shrink", TRUE, NULL); gtk_signal_connect (GTK_OBJECT (window), "destroy", @@ -535,6 +537,13 @@ main (int argc, char **argv) new_testrgb_window (pixbuf, NULL); ++xpmp; } + + /* Test loading from inline data. */ + pixbuf = gdk_pixbuf_new_from_inline (apple_red, FALSE, -1); + new_testrgb_window (pixbuf, "Red apple from inline data"); + + pixbuf = gdk_pixbuf_new_from_inline (gnome_foot, TRUE, sizeof (gnome_foot)); + new_testrgb_window (pixbuf, "Foot from inline data"); found_valid = TRUE; } else { diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 8e2332f8f..7021e4b4f 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2000-09-26 Havoc Pennington + + * gtk/tmpl/gtkrc.sgml: Document stock icon stuff + Thu Sep 7 14:15:03 2000 Owen Taylor * gdk/* gtk/*: Move gtk-reference files into GTK+ tree proper. diff --git a/docs/reference/gtk/tmpl/gtkrc.sgml b/docs/reference/gtk/tmpl/gtkrc.sgml index df392bf6f..08a457665 100644 --- a/docs/reference/gtk/tmpl/gtkrc.sgml +++ b/docs/reference/gtk/tmpl/gtkrc.sgml @@ -265,6 +265,14 @@ elements are: + + stock["stock-id"] = { icon source specifications } + + + Defines the icon for a stock item. + + + @@ -335,6 +343,70 @@ hex digits, or they can be specified as a triplet of floats { r, g, b}. + + +In a stock definition, icon sources are specified as a +4-tuple of image filename, text direction, widget state, and size, in that +order. Each icon source specifies an image filename to use with a given +direction, state, and size. The * character can be used as a +wildcard, and if direction/state/size are omitted they default to +*. So for example, the following specifies different icons to +use for left-to-right and right-to-left languages: + +stock["my-stock-item"] = +{ + { "itemltr.png", LTR, *, * }, + { "itemrtl.png", RTL, *, * } +} + +This could be abbreviated as follows: + +stock["my-stock-item"] = +{ + { "itemltr.png", LTR }, + { "itemrtl.png", RTL } +} + + + + +You can specify custom icons for specific sizes, as follows: + +stock["my-stock-item"] = +{ + { "itemmenusize.png", *, *, "gtk-menu" }, + { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" } + { "itemgeneric.png" } /* implicit *, *, * as a fallback */ +} + +The sizes that come with GTK+ itself are "gtk-menu", +"gtk-small-toolbar", "gtk-large-toolbar", +"gtk-button", "gtk-dialog". Applications +can define other sizes. + + + +It's also possible to use custom icons for a given state, for example: +You can specify custom icons for specific sizes, as follows: + +stock["my-stock-item"] = +{ + { "itemprelight.png", *, PRELIGHT }, + { "iteminsensitive.png", *, INSENSITIVE }, + { "itemgeneric.png" } /* implicit *, *, * as a fallback */ +} + + + + +When selecting an icon source to use, GTK+ will consider text direction most +important, state second, and size third. It will select the best match based on +those criteria. If an attribute matches exactly (e.g. you specified +PRELIGHT or specified the size), GTK+ won't modify the image; +if the attribute matches with a wildcard, GTK+ will scale or modify the image to +match the state and size the user requested. + + Key bindings diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c index a7de61d2c..249568ce5 100644 --- a/gtk/gtkiconfactory.c +++ b/gtk/gtkiconfactory.c @@ -1,5 +1,5 @@ /* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/gtk/gtkiconfactory.h b/gtk/gtkiconfactory.h index 357e37eb7..23f605986 100644 --- a/gtk/gtkiconfactory.h +++ b/gtk/gtkiconfactory.h @@ -1,5 +1,5 @@ /* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/gtk/gtkstock.c b/gtk/gtkstock.c index ecb307973..64700232a 100644 --- a/gtk/gtkstock.c +++ b/gtk/gtkstock.c @@ -1,5 +1,5 @@ /* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/gtk/gtkstock.h b/gtk/gtkstock.h index 02b51ff97..a11fa9515 100644 --- a/gtk/gtkstock.h +++ b/gtk/gtkstock.h @@ -1,5 +1,5 @@ /* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public -- 2.43.2