Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
2000-10-04 16:39:44 +00:00
|
|
|
* Copyright (C) 2000 Red Hat, Inc.
|
2008-03-07 00:08:16 +00:00
|
|
|
* 2008 Johan Dahlin
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. 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/.
|
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
2002-10-10 22:00:09 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
#include "gtkiconfactory.h"
|
2005-11-04 15:43:40 +00:00
|
|
|
#include "gtkiconcache.h"
|
2002-09-24 21:03:58 +00:00
|
|
|
#include "gtkdebug.h"
|
2003-07-02 22:44:09 +00:00
|
|
|
#include "gtkicontheme.h"
|
2002-09-24 21:03:58 +00:00
|
|
|
#include "gtksettings.h"
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
#include "gtkstock.h"
|
2003-07-02 22:44:09 +00:00
|
|
|
#include "gtkwidget.h"
|
2000-10-18 18:42:54 +00:00
|
|
|
#include "gtkintl.h"
|
2008-03-07 00:08:16 +00:00
|
|
|
#include "gtkbuildable.h"
|
|
|
|
#include "gtkbuilderprivate.h"
|
2005-03-20 07:01:23 +00:00
|
|
|
#include "gtkalias.h"
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2004-08-09 16:59:53 +00:00
|
|
|
|
2001-05-25 20:41:46 +00:00
|
|
|
static GSList *all_icon_factories = NULL;
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_ICON_SOURCE_EMPTY,
|
|
|
|
GTK_ICON_SOURCE_ICON_NAME,
|
2005-11-04 15:43:40 +00:00
|
|
|
GTK_ICON_SOURCE_STATIC_ICON_NAME,
|
2003-07-02 22:44:09 +00:00
|
|
|
GTK_ICON_SOURCE_FILENAME,
|
|
|
|
GTK_ICON_SOURCE_PIXBUF
|
|
|
|
} GtkIconSourceType;
|
|
|
|
|
2001-03-19 22:40:35 +00:00
|
|
|
struct _GtkIconSource
|
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
GtkIconSourceType type;
|
|
|
|
|
|
|
|
union {
|
|
|
|
gchar *icon_name;
|
|
|
|
gchar *filename;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
} source;
|
2004-12-12 21:09:13 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
GdkPixbuf *filename_pixbuf;
|
2001-03-19 22:40:35 +00:00
|
|
|
|
|
|
|
GtkTextDirection direction;
|
|
|
|
GtkStateType state;
|
|
|
|
GtkIconSize size;
|
|
|
|
|
|
|
|
/* If TRUE, then the parameter is wildcarded, and the above
|
|
|
|
* fields should be ignored. If FALSE, the parameter is
|
|
|
|
* specified, and the above fields should be valid.
|
|
|
|
*/
|
|
|
|
guint any_direction : 1;
|
|
|
|
guint any_state : 1;
|
|
|
|
guint any_size : 1;
|
2004-12-12 21:09:13 +00:00
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* System codepage version of filename, for DLL ABI backward
|
|
|
|
* compatibility functions.
|
|
|
|
*/
|
|
|
|
gchar *cp_filename;
|
|
|
|
#endif
|
2001-03-19 22:40:35 +00:00
|
|
|
};
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2008-03-07 00:08:16 +00:00
|
|
|
static void
|
|
|
|
gtk_icon_factory_buildable_init (GtkBuildableIface *iface);
|
|
|
|
|
|
|
|
static gboolean gtk_icon_factory_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
GMarkupParser *parser,
|
|
|
|
gpointer *data);
|
|
|
|
static void gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
gpointer *user_data);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
static void gtk_icon_factory_finalize (GObject *object);
|
|
|
|
static void get_default_icons (GtkIconFactory *icon_factory);
|
2003-07-02 22:44:09 +00:00
|
|
|
static void icon_source_clear (GtkIconSource *source);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
static GtkIconSize icon_size_register_intern (const gchar *name,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
#define GTK_ICON_SOURCE_INIT(any_direction, any_state, any_size) \
|
|
|
|
{ GTK_ICON_SOURCE_EMPTY, { NULL }, NULL, \
|
|
|
|
0, 0, 0, \
|
|
|
|
any_direction, any_state, any_size }
|
|
|
|
|
2008-03-07 00:08:16 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkIconFactory, gtk_icon_factory, G_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
|
|
gtk_icon_factory_buildable_init))
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_icon_factory_init (GtkIconFactory *factory)
|
|
|
|
{
|
|
|
|
factory->icons = g_hash_table_new (g_str_hash, g_str_equal);
|
2001-05-25 20:41:46 +00:00
|
|
|
all_icon_factories = g_slist_prepend (all_icon_factories, factory);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_icon_factory_class_init (GtkIconFactoryClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gtk_icon_factory_finalize;
|
|
|
|
}
|
|
|
|
|
2008-03-07 00:08:16 +00:00
|
|
|
static void
|
|
|
|
gtk_icon_factory_buildable_init (GtkBuildableIface *iface)
|
|
|
|
{
|
|
|
|
iface->custom_tag_start = gtk_icon_factory_buildable_custom_tag_start;
|
|
|
|
iface->custom_tag_end = gtk_icon_factory_buildable_custom_tag_end;
|
|
|
|
}
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
static void
|
|
|
|
free_icon_set (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
|
|
|
g_free (key);
|
|
|
|
gtk_icon_set_unref (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_icon_factory_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkIconFactory *factory = GTK_ICON_FACTORY (object);
|
|
|
|
|
2001-05-25 20:41:46 +00:00
|
|
|
all_icon_factories = g_slist_remove (all_icon_factories, factory);
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
g_hash_table_foreach (factory->icons, free_icon_set, NULL);
|
|
|
|
|
|
|
|
g_hash_table_destroy (factory->icons);
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
G_OBJECT_CLASS (gtk_icon_factory_parent_class)->finalize (object);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkIconFactory. An icon factory manages a collection
|
2002-04-18 22:04:46 +00:00
|
|
|
* of #GtkIconSet<!-- -->s; a #GtkIconSet manages a set of variants of a
|
2001-02-03 01:09:41 +00:00
|
|
|
* particular icon (i.e. a #GtkIconSet contains variants for different
|
|
|
|
* sizes and widget states). Icons in an icon factory are named by a
|
|
|
|
* stock ID, which is a simple string identifying the icon. Each
|
2002-04-18 22:04:46 +00:00
|
|
|
* #GtkStyle has a list of #GtkIconFactory<!-- -->s derived from the current
|
2001-02-03 01:09:41 +00:00
|
|
|
* theme; those icon factories are consulted first when searching for
|
|
|
|
* an icon. If the theme doesn't set a particular icon, GTK+ looks for
|
|
|
|
* the icon in a list of default icon factories, maintained by
|
|
|
|
* gtk_icon_factory_add_default() and
|
|
|
|
* gtk_icon_factory_remove_default(). Applications with icons should
|
|
|
|
* add a default icon factory with their icons, which will allow
|
|
|
|
* themes to override the icons for the application.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconFactory
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconFactory*
|
|
|
|
gtk_icon_factory_new (void)
|
|
|
|
{
|
2002-10-10 22:00:09 +00:00
|
|
|
return g_object_new (GTK_TYPE_ICON_FACTORY, NULL);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_add:
|
|
|
|
* @factory: a #GtkIconFactory
|
|
|
|
* @stock_id: icon name
|
|
|
|
* @icon_set: icon set
|
|
|
|
*
|
|
|
|
* Adds the given @icon_set to the icon factory, under the name
|
|
|
|
* @stock_id. @stock_id should be namespaced for your application,
|
|
|
|
* e.g. "myapp-whatever-icon". Normally applications create a
|
|
|
|
* #GtkIconFactory, then add it to the list of default factories with
|
|
|
|
* gtk_icon_factory_add_default(). Then they pass the @stock_id to
|
|
|
|
* widgets such as #GtkImage to display the icon. Themes can provide
|
|
|
|
* an icon with the same name (such as "myapp-whatever-icon") to
|
|
|
|
* override your application's default icons. If an icon already
|
|
|
|
* existed in @factory for @stock_id, it is unreferenced and replaced
|
|
|
|
* with the new @icon_set.
|
|
|
|
*
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_factory_add (GtkIconFactory *factory,
|
|
|
|
const gchar *stock_id,
|
|
|
|
GtkIconSet *icon_set)
|
|
|
|
{
|
|
|
|
gpointer old_key = NULL;
|
|
|
|
gpointer old_value = NULL;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ICON_FACTORY (factory));
|
|
|
|
g_return_if_fail (stock_id != NULL);
|
|
|
|
g_return_if_fail (icon_set != NULL);
|
|
|
|
|
|
|
|
g_hash_table_lookup_extended (factory->icons, stock_id,
|
|
|
|
&old_key, &old_value);
|
|
|
|
|
|
|
|
if (old_value == icon_set)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gtk_icon_set_ref (icon_set);
|
|
|
|
|
|
|
|
/* GHashTable key memory management is so fantastically broken. */
|
|
|
|
if (old_key)
|
|
|
|
g_hash_table_insert (factory->icons, old_key, icon_set);
|
|
|
|
else
|
|
|
|
g_hash_table_insert (factory->icons, g_strdup (stock_id), icon_set);
|
|
|
|
|
|
|
|
if (old_value)
|
|
|
|
gtk_icon_set_unref (old_value);
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_lookup:
|
|
|
|
* @factory: a #GtkIconFactory
|
|
|
|
* @stock_id: an icon name
|
|
|
|
*
|
|
|
|
* Looks up @stock_id in the icon factory, returning an icon set
|
|
|
|
* if found, otherwise %NULL. For display to the user, you should
|
|
|
|
* use gtk_style_lookup_icon_set() on the #GtkStyle for the
|
|
|
|
* widget that will display the icon, instead of using this
|
|
|
|
* function directly, so that themes are taken into account.
|
|
|
|
*
|
|
|
|
* Return value: icon set of @stock_id.
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconSet *
|
|
|
|
gtk_icon_factory_lookup (GtkIconFactory *factory,
|
|
|
|
const gchar *stock_id)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ICON_FACTORY (factory), NULL);
|
|
|
|
g_return_val_if_fail (stock_id != NULL, NULL);
|
|
|
|
|
|
|
|
return g_hash_table_lookup (factory->icons, stock_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkIconFactory *gtk_default_icons = NULL;
|
|
|
|
static GSList *default_factories = NULL;
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_add_default:
|
|
|
|
* @factory: a #GtkIconFactory
|
|
|
|
*
|
|
|
|
* Adds an icon factory to the list of icon factories searched by
|
|
|
|
* gtk_style_lookup_icon_set(). This means that, for example,
|
|
|
|
* gtk_image_new_from_stock() will be able to find icons in @factory.
|
|
|
|
* There will normally be an icon factory added for each library or
|
|
|
|
* application that comes with icons. The default icon factories
|
|
|
|
* can be overridden by themes.
|
|
|
|
*
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_factory_add_default (GtkIconFactory *factory)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ICON_FACTORY (factory));
|
|
|
|
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_ref (factory);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
default_factories = g_slist_prepend (default_factories, factory);
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_remove_default:
|
|
|
|
* @factory: a #GtkIconFactory previously added with gtk_icon_factory_add_default()
|
|
|
|
*
|
|
|
|
* Removes an icon factory from the list of default icon
|
|
|
|
* factories. Not normally used; you might use it for a library that
|
|
|
|
* can be unloaded or shut down.
|
|
|
|
*
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_factory_remove_default (GtkIconFactory *factory)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ICON_FACTORY (factory));
|
|
|
|
|
|
|
|
default_factories = g_slist_remove (default_factories, factory);
|
|
|
|
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_unref (factory);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2005-01-03 14:44:33 +00:00
|
|
|
void
|
|
|
|
_gtk_icon_factory_ensure_default_icons (void)
|
2001-05-25 22:08:53 +00:00
|
|
|
{
|
|
|
|
if (gtk_default_icons == NULL)
|
|
|
|
{
|
|
|
|
gtk_default_icons = gtk_icon_factory_new ();
|
|
|
|
|
|
|
|
get_default_icons (gtk_default_icons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_factory_lookup_default:
|
|
|
|
* @stock_id: an icon name
|
|
|
|
*
|
|
|
|
* Looks for an icon in the list of default icon factories. For
|
|
|
|
* display to the user, you should use gtk_style_lookup_icon_set() on
|
|
|
|
* the #GtkStyle for the widget that will display the icon, instead of
|
|
|
|
* using this function directly, so that themes are taken into
|
|
|
|
* account.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value: a #GtkIconSet, or %NULL
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconSet *
|
|
|
|
gtk_icon_factory_lookup_default (const gchar *stock_id)
|
|
|
|
{
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (stock_id != NULL, NULL);
|
|
|
|
|
|
|
|
tmp_list = default_factories;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
GtkIconSet *icon_set =
|
|
|
|
gtk_icon_factory_lookup (GTK_ICON_FACTORY (tmp_list->data),
|
|
|
|
stock_id);
|
|
|
|
|
|
|
|
if (icon_set)
|
|
|
|
return icon_set;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
2005-01-03 14:44:33 +00:00
|
|
|
_gtk_icon_factory_ensure_default_icons ();
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
return gtk_icon_factory_lookup (gtk_default_icons, stock_id);
|
|
|
|
}
|
|
|
|
|
2002-10-09 21:38:43 +00:00
|
|
|
static void
|
2003-07-02 22:44:09 +00:00
|
|
|
register_stock_icon (GtkIconFactory *factory,
|
|
|
|
const gchar *stock_id)
|
2002-10-09 21:38:43 +00:00
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
GtkIconSet *set = gtk_icon_set_new ();
|
|
|
|
GtkIconSource source = GTK_ICON_SOURCE_INIT (TRUE, TRUE, TRUE);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
source.type = GTK_ICON_SOURCE_STATIC_ICON_NAME;
|
2003-07-02 22:44:09 +00:00
|
|
|
source.source.icon_name = (gchar *)stock_id;
|
|
|
|
gtk_icon_set_add_source (set, &source);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_factory_add (factory, stock_id, set);
|
|
|
|
gtk_icon_set_unref (set);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
2001-05-25 20:41:46 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
static void
|
|
|
|
register_bidi_stock_icon (GtkIconFactory *factory,
|
|
|
|
const gchar *stock_id,
|
|
|
|
const gchar *stock_id_ltr,
|
|
|
|
const gchar *stock_id_rtl)
|
2001-05-25 20:41:46 +00:00
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
GtkIconSet *set = gtk_icon_set_new ();
|
|
|
|
GtkIconSource source = GTK_ICON_SOURCE_INIT (FALSE, TRUE, TRUE);
|
2001-05-25 20:41:46 +00:00
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
source.type = GTK_ICON_SOURCE_STATIC_ICON_NAME;
|
2003-07-02 22:44:09 +00:00
|
|
|
source.source.icon_name = (gchar *)stock_id_ltr;
|
2002-10-09 21:38:43 +00:00
|
|
|
source.direction = GTK_TEXT_DIR_LTR;
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_set_add_source (set, &source);
|
2001-05-25 20:41:46 +00:00
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
source.type = GTK_ICON_SOURCE_STATIC_ICON_NAME;
|
2003-07-02 22:44:09 +00:00
|
|
|
source.source.icon_name = (gchar *)stock_id_rtl;
|
|
|
|
source.direction = GTK_TEXT_DIR_RTL;
|
|
|
|
gtk_icon_set_add_source (set, &source);
|
2001-05-25 20:41:46 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_factory_add (factory, stock_id, set);
|
|
|
|
gtk_icon_set_unref (set);
|
2001-05-25 20:41:46 +00:00
|
|
|
}
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
static void
|
|
|
|
get_default_icons (GtkIconFactory *factory)
|
|
|
|
{
|
|
|
|
/* KEEP IN SYNC with gtkstock.c */
|
2002-02-27 17:35:58 +00:00
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_DIALOG_AUTHENTICATION);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DIALOG_ERROR);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DIALOG_INFO);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DIALOG_QUESTION);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DIALOG_WARNING);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DND);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DND_MULTIPLE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_APPLY);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CANCEL);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_NO);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_OK);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_YES);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CLOSE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ADD);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_JUSTIFY_CENTER);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_JUSTIFY_FILL);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_JUSTIFY_LEFT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_JUSTIFY_RIGHT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_GOTO_BOTTOM);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CDROM);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CONVERT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_COPY);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CUT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_GO_DOWN);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_EXECUTE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_QUIT);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_GOTO_FIRST,
|
|
|
|
GTK_STOCK_GOTO_FIRST "-ltr",
|
|
|
|
GTK_STOCK_GOTO_FIRST "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SELECT_FONT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_FULLSCREEN);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_LEAVE_FULLSCREEN);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_HARDDISK);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_HELP);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_HOME);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_INFO);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_JUMP_TO,
|
|
|
|
GTK_STOCK_JUMP_TO "-ltr",
|
|
|
|
GTK_STOCK_JUMP_TO "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_GOTO_LAST,
|
|
|
|
GTK_STOCK_GOTO_LAST "-ltr",
|
|
|
|
GTK_STOCK_GOTO_LAST "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_GO_BACK,
|
|
|
|
GTK_STOCK_GO_BACK "-ltr",
|
|
|
|
GTK_STOCK_GO_BACK "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_MISSING_IMAGE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_NETWORK);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_NEW);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_OPEN);
|
2006-04-21 15:09:32 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_ORIENTATION_PORTRAIT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ORIENTATION_LANDSCAPE);
|
2006-05-19 19:04:26 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT);
|
2006-04-21 15:09:32 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE);
|
2008-04-17 12:46:38 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PAGE_SETUP);
|
2005-11-04 15:43:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PASTE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_PREFERENCES);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_PRINT);
|
2008-05-06 22:47:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PRINT_ERROR);
|
2005-11-04 15:43:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PRINT_PREVIEW);
|
2008-05-06 22:47:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PRINT_REPORT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_PRINT_WARNING);
|
2005-11-04 15:43:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_PROPERTIES);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_REDO,
|
|
|
|
GTK_STOCK_REDO "-ltr",
|
|
|
|
GTK_STOCK_REDO "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_REMOVE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_REFRESH);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_REVERT_TO_SAVED,
|
|
|
|
GTK_STOCK_REVERT_TO_SAVED "-ltr",
|
|
|
|
GTK_STOCK_REVERT_TO_SAVED "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_GO_FORWARD,
|
|
|
|
GTK_STOCK_GO_FORWARD "-ltr",
|
|
|
|
GTK_STOCK_GO_FORWARD "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SAVE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_FLOPPY);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SAVE_AS);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_FIND);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_FIND_AND_REPLACE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SORT_DESCENDING);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SORT_ASCENDING);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SPELL_CHECK);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_STOP);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_BOLD);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ITALIC);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_STRIKETHROUGH);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_UNDERLINE);
|
2006-01-15 04:33:30 +00:00
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_INDENT,
|
|
|
|
GTK_STOCK_INDENT "-ltr",
|
|
|
|
GTK_STOCK_INDENT "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_UNINDENT,
|
|
|
|
GTK_STOCK_UNINDENT "-ltr",
|
|
|
|
GTK_STOCK_UNINDENT "-rtl");
|
2005-11-04 15:43:40 +00:00
|
|
|
register_stock_icon (factory, GTK_STOCK_GOTO_TOP);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DELETE);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_UNDELETE,
|
|
|
|
GTK_STOCK_UNDELETE "-ltr",
|
|
|
|
GTK_STOCK_UNDELETE "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_UNDO,
|
|
|
|
GTK_STOCK_UNDO "-ltr",
|
|
|
|
GTK_STOCK_UNDO "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_GO_UP);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_FILE);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DIRECTORY);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ABOUT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CONNECT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_DISCONNECT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_EDIT);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_MEDIA_FORWARD,
|
|
|
|
GTK_STOCK_MEDIA_FORWARD "-ltr",
|
|
|
|
GTK_STOCK_MEDIA_FORWARD "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_MEDIA_NEXT,
|
|
|
|
GTK_STOCK_MEDIA_NEXT "-ltr",
|
|
|
|
GTK_STOCK_MEDIA_NEXT "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_MEDIA_PAUSE);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_MEDIA_PLAY,
|
|
|
|
GTK_STOCK_MEDIA_PLAY "-ltr",
|
|
|
|
GTK_STOCK_MEDIA_PLAY "-rtl");
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_MEDIA_PREVIOUS,
|
|
|
|
GTK_STOCK_MEDIA_PREVIOUS "-ltr",
|
|
|
|
GTK_STOCK_MEDIA_PREVIOUS "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_MEDIA_RECORD);
|
|
|
|
register_bidi_stock_icon (factory,
|
|
|
|
GTK_STOCK_MEDIA_REWIND,
|
|
|
|
GTK_STOCK_MEDIA_REWIND "-ltr",
|
|
|
|
GTK_STOCK_MEDIA_REWIND "-rtl");
|
|
|
|
register_stock_icon (factory, GTK_STOCK_MEDIA_STOP);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_INDEX);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ZOOM_100);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ZOOM_IN);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ZOOM_OUT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_ZOOM_FIT);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SELECT_ALL);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_CLEAR);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_SELECT_COLOR);
|
|
|
|
register_stock_icon (factory, GTK_STOCK_COLOR_PICKER);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
/************************************************************
|
|
|
|
* Icon size handling *
|
|
|
|
************************************************************/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
typedef struct _IconSize IconSize;
|
|
|
|
|
|
|
|
struct _IconSize
|
|
|
|
{
|
2001-03-12 18:46:53 +00:00
|
|
|
gint size;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gchar *name;
|
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
gint width;
|
|
|
|
gint height;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
};
|
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
typedef struct _IconAlias IconAlias;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
struct _IconAlias
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2001-03-12 18:46:53 +00:00
|
|
|
gchar *name;
|
|
|
|
gint target;
|
|
|
|
};
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
typedef struct _SettingsIconSize SettingsIconSize;
|
|
|
|
|
|
|
|
struct _SettingsIconSize
|
|
|
|
{
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
};
|
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
static GHashTable *icon_aliases = NULL;
|
|
|
|
static IconSize *icon_sizes = NULL;
|
|
|
|
static gint icon_sizes_allocated = 0;
|
|
|
|
static gint icon_sizes_used = 0;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
static void
|
2001-03-12 18:46:53 +00:00
|
|
|
init_icon_sizes (void)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2001-03-12 18:46:53 +00:00
|
|
|
if (icon_sizes == NULL)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2001-06-25 01:51:58 +00:00
|
|
|
#define NUM_BUILTIN_SIZES 7
|
2001-03-12 18:46:53 +00:00
|
|
|
gint i;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
icon_aliases = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
|
|
|
|
icon_sizes = g_new (IconSize, NUM_BUILTIN_SIZES);
|
|
|
|
icon_sizes_allocated = NUM_BUILTIN_SIZES;
|
|
|
|
icon_sizes_used = NUM_BUILTIN_SIZES;
|
|
|
|
|
|
|
|
icon_sizes[GTK_ICON_SIZE_INVALID].size = 0;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_INVALID].name = NULL;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_INVALID].width = 0;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_INVALID].height = 0;
|
|
|
|
|
|
|
|
/* the name strings aren't copied since we don't ever remove
|
|
|
|
* icon sizes, so we don't need to know whether they're static.
|
|
|
|
* Even if we did I suppose removing the builtin sizes would be
|
|
|
|
* disallowed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
icon_sizes[GTK_ICON_SIZE_MENU].size = GTK_ICON_SIZE_MENU;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_MENU].name = "gtk-menu";
|
|
|
|
icon_sizes[GTK_ICON_SIZE_MENU].width = 16;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_MENU].height = 16;
|
|
|
|
|
|
|
|
icon_sizes[GTK_ICON_SIZE_BUTTON].size = GTK_ICON_SIZE_BUTTON;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_BUTTON].name = "gtk-button";
|
2002-02-22 21:48:06 +00:00
|
|
|
icon_sizes[GTK_ICON_SIZE_BUTTON].width = 20;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_BUTTON].height = 20;
|
2001-03-12 18:46:53 +00:00
|
|
|
|
|
|
|
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].name = "gtk-small-toolbar";
|
|
|
|
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = 18;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = 18;
|
|
|
|
|
|
|
|
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].name = "gtk-large-toolbar";
|
|
|
|
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = 24;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].height = 24;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-06-25 01:51:58 +00:00
|
|
|
icon_sizes[GTK_ICON_SIZE_DND].size = GTK_ICON_SIZE_DND;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DND].name = "gtk-dnd";
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DND].width = 32;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DND].height = 32;
|
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
icon_sizes[GTK_ICON_SIZE_DIALOG].size = GTK_ICON_SIZE_DIALOG;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DIALOG].name = "gtk-dialog";
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DIALOG].width = 48;
|
|
|
|
icon_sizes[GTK_ICON_SIZE_DIALOG].height = 48;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
g_assert ((GTK_ICON_SIZE_DIALOG + 1) == NUM_BUILTIN_SIZES);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
/* Alias everything to itself. */
|
|
|
|
i = 1; /* skip invalid size */
|
|
|
|
while (i < NUM_BUILTIN_SIZES)
|
|
|
|
{
|
|
|
|
gtk_icon_size_register_alias (icon_sizes[i].name, icon_sizes[i].size);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NUM_BUILTIN_SIZES
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
static void
|
|
|
|
free_settings_sizes (gpointer data)
|
|
|
|
{
|
|
|
|
g_array_free (data, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GArray *
|
|
|
|
get_settings_sizes (GtkSettings *settings,
|
|
|
|
gboolean *created)
|
|
|
|
{
|
|
|
|
GArray *settings_sizes;
|
|
|
|
static GQuark sizes_quark = 0;
|
|
|
|
|
|
|
|
if (!sizes_quark)
|
|
|
|
sizes_quark = g_quark_from_static_string ("gtk-icon-sizes");
|
|
|
|
|
|
|
|
settings_sizes = g_object_get_qdata (G_OBJECT (settings), sizes_quark);
|
|
|
|
if (!settings_sizes)
|
|
|
|
{
|
|
|
|
settings_sizes = g_array_new (FALSE, FALSE, sizeof (SettingsIconSize));
|
|
|
|
g_object_set_qdata_full (G_OBJECT (settings), sizes_quark,
|
|
|
|
settings_sizes, free_settings_sizes);
|
|
|
|
if (created)
|
|
|
|
*created = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return settings_sizes;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_size_set_for_settings (GtkSettings *settings,
|
|
|
|
const gchar *size_name,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
GtkIconSize size;
|
|
|
|
GArray *settings_sizes;
|
|
|
|
SettingsIconSize *settings_size;
|
|
|
|
|
|
|
|
g_return_if_fail (size_name != NULL);
|
|
|
|
|
|
|
|
size = gtk_icon_size_from_name (size_name);
|
|
|
|
if (size == GTK_ICON_SIZE_INVALID)
|
|
|
|
/* Reserve a place */
|
|
|
|
size = icon_size_register_intern (size_name, -1, -1);
|
|
|
|
|
|
|
|
settings_sizes = get_settings_sizes (settings, NULL);
|
|
|
|
if (size >= settings_sizes->len)
|
|
|
|
{
|
|
|
|
SettingsIconSize unset = { -1, -1 };
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = settings_sizes->len; i <= size; i++)
|
|
|
|
g_array_append_val (settings_sizes, unset);
|
|
|
|
}
|
|
|
|
|
|
|
|
settings_size = &g_array_index (settings_sizes, SettingsIconSize, size);
|
|
|
|
|
|
|
|
settings_size->width = width;
|
|
|
|
settings_size->height = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Like pango_parse_word, but accept - as well
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
scan_icon_size_name (const char **pos, GString *out)
|
|
|
|
{
|
|
|
|
const char *p = *pos;
|
|
|
|
|
|
|
|
while (g_ascii_isspace (*p))
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (!((*p >= 'A' && *p <= 'Z') ||
|
|
|
|
(*p >= 'a' && *p <= 'z') ||
|
|
|
|
*p == '_' || *p == '-'))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_string_truncate (out, 0);
|
|
|
|
g_string_append_c (out, *p);
|
|
|
|
p++;
|
|
|
|
|
|
|
|
while ((*p >= 'A' && *p <= 'Z') ||
|
|
|
|
(*p >= 'a' && *p <= 'z') ||
|
|
|
|
(*p >= '0' && *p <= '9') ||
|
|
|
|
*p == '_' || *p == '-')
|
|
|
|
{
|
|
|
|
g_string_append_c (out, *p);
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pos = p;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_size_setting_parse (GtkSettings *settings,
|
|
|
|
const gchar *icon_size_string)
|
|
|
|
{
|
|
|
|
GString *name_buf = g_string_new (NULL);
|
|
|
|
const gchar *p = icon_size_string;
|
|
|
|
|
|
|
|
while (pango_skip_space (&p))
|
|
|
|
{
|
|
|
|
gint width, height;
|
|
|
|
|
|
|
|
if (!scan_icon_size_name (&p, name_buf))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (!pango_skip_space (&p))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (*p != '=')
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (!pango_scan_int (&p, &width))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (!pango_skip_space (&p))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (*p != ',')
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (!pango_scan_int (&p, &height))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (width > 0 && height > 0)
|
|
|
|
{
|
|
|
|
icon_size_set_for_settings (settings, name_buf->str,
|
|
|
|
width, height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Invalid size in gtk-icon-sizes: %d,%d\n", width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
pango_skip_space (&p);
|
|
|
|
if (*p == '\0')
|
|
|
|
break;
|
|
|
|
if (*p == ':')
|
|
|
|
p++;
|
|
|
|
else
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_string_free (name_buf, TRUE);
|
|
|
|
return;
|
|
|
|
|
|
|
|
err:
|
|
|
|
g_warning ("Error parsing gtk-icon-sizes string:\n\t'%s'", icon_size_string);
|
|
|
|
g_string_free (name_buf, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_size_set_all_from_settings (GtkSettings *settings)
|
|
|
|
{
|
|
|
|
GArray *settings_sizes;
|
|
|
|
gchar *icon_size_string;
|
|
|
|
|
|
|
|
/* Reset old settings */
|
|
|
|
settings_sizes = get_settings_sizes (settings, NULL);
|
|
|
|
g_array_set_size (settings_sizes, 0);
|
|
|
|
|
|
|
|
g_object_get (settings,
|
|
|
|
"gtk-icon-sizes", &icon_size_string,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (icon_size_string)
|
|
|
|
{
|
|
|
|
icon_size_setting_parse (settings, icon_size_string);
|
|
|
|
g_free (icon_size_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_size_settings_changed (GtkSettings *settings,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
icon_size_set_all_from_settings (settings);
|
|
|
|
|
2004-02-26 20:59:01 +00:00
|
|
|
gtk_rc_reset_styles (settings);
|
2002-09-24 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_sizes_init_for_settings (GtkSettings *settings)
|
|
|
|
{
|
|
|
|
g_signal_connect (settings,
|
|
|
|
"notify::gtk-icon-sizes",
|
|
|
|
G_CALLBACK (icon_size_settings_changed),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
icon_size_set_all_from_settings (settings);
|
|
|
|
}
|
|
|
|
|
2003-07-20 15:50:14 +00:00
|
|
|
static gboolean
|
2002-09-24 21:03:58 +00:00
|
|
|
icon_size_lookup_intern (GtkSettings *settings,
|
|
|
|
GtkIconSize size,
|
|
|
|
gint *widthp,
|
|
|
|
gint *heightp)
|
|
|
|
{
|
|
|
|
GArray *settings_sizes;
|
|
|
|
gint width_for_settings = -1;
|
|
|
|
gint height_for_settings = -1;
|
|
|
|
|
|
|
|
init_icon_sizes ();
|
|
|
|
|
2007-10-16 20:08:31 +00:00
|
|
|
if (size == (GtkIconSize)-1)
|
2007-10-16 22:35:26 +00:00
|
|
|
return FALSE;
|
2007-10-16 20:08:31 +00:00
|
|
|
|
2002-12-09 22:34:23 +00:00
|
|
|
if (size >= icon_sizes_used)
|
2002-09-24 21:03:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (size == GTK_ICON_SIZE_INVALID)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (settings)
|
|
|
|
{
|
|
|
|
gboolean initial = FALSE;
|
|
|
|
|
|
|
|
settings_sizes = get_settings_sizes (settings, &initial);
|
|
|
|
if (initial)
|
|
|
|
icon_sizes_init_for_settings (settings);
|
|
|
|
|
|
|
|
if (size < settings_sizes->len)
|
|
|
|
{
|
|
|
|
SettingsIconSize *settings_size;
|
|
|
|
|
|
|
|
settings_size = &g_array_index (settings_sizes, SettingsIconSize, size);
|
|
|
|
|
|
|
|
width_for_settings = settings_size->width;
|
|
|
|
height_for_settings = settings_size->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widthp)
|
|
|
|
*widthp = width_for_settings >= 0 ? width_for_settings : icon_sizes[size].width;
|
|
|
|
|
|
|
|
if (heightp)
|
|
|
|
*heightp = height_for_settings >= 0 ? height_for_settings : icon_sizes[size].height;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_size_lookup_for_settings:
|
2002-10-10 23:42:57 +00:00
|
|
|
* @settings: a #GtkSettings object, used to determine
|
2002-09-24 21:03:58 +00:00
|
|
|
* which set of user preferences to used.
|
|
|
|
* @size: an icon size
|
|
|
|
* @width: location to store icon width
|
|
|
|
* @height: location to store icon height
|
|
|
|
*
|
|
|
|
* Obtains the pixel size of a semantic icon size, possibly
|
2002-10-29 19:55:44 +00:00
|
|
|
* modified by user preferences for a particular
|
|
|
|
* #GtkSettings. Normally @size would be
|
2002-09-24 21:03:58 +00:00
|
|
|
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
|
|
|
* isn't normally needed, gtk_widget_render_icon() is the usual
|
|
|
|
* way to get an icon for rendering, then just look at the size of
|
|
|
|
* the rendered pixbuf. The rendered pixbuf may not even correspond to
|
|
|
|
* the width/height returned by gtk_icon_size_lookup(), because themes
|
|
|
|
* are free to render the pixbuf however they like, including changing
|
|
|
|
* the usual size.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if @size was a valid size
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-09-24 21:03:58 +00:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_icon_size_lookup_for_settings (GtkSettings *settings,
|
|
|
|
GtkIconSize size,
|
2002-10-10 23:42:57 +00:00
|
|
|
gint *width,
|
|
|
|
gint *height)
|
2002-09-24 21:03:58 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
|
|
|
|
|
2002-10-10 23:42:57 +00:00
|
|
|
return icon_size_lookup_intern (settings, size, width, height);
|
2002-09-24 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_size_lookup:
|
2001-03-12 18:46:53 +00:00
|
|
|
* @size: an icon size
|
2001-02-03 01:09:41 +00:00
|
|
|
* @width: location to store icon width
|
|
|
|
* @height: location to store icon height
|
|
|
|
*
|
2002-09-24 21:03:58 +00:00
|
|
|
* Obtains the pixel size of a semantic icon size, possibly
|
|
|
|
* modified by user preferences for the default #GtkSettings.
|
|
|
|
* (See gtk_icon_size_lookup_for_settings().)
|
|
|
|
* Normally @size would be
|
2001-02-03 01:09:41 +00:00
|
|
|
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
|
|
|
* isn't normally needed, gtk_widget_render_icon() is the usual
|
|
|
|
* way to get an icon for rendering, then just look at the size of
|
|
|
|
* the rendered pixbuf. The rendered pixbuf may not even correspond to
|
|
|
|
* the width/height returned by gtk_icon_size_lookup(), because themes
|
2001-03-12 18:46:53 +00:00
|
|
|
* are free to render the pixbuf however they like, including changing
|
|
|
|
* the usual size.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
2001-03-12 18:46:53 +00:00
|
|
|
* Return value: %TRUE if @size was a valid size
|
2001-02-03 01:09:41 +00:00
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gboolean
|
2001-03-12 18:46:53 +00:00
|
|
|
gtk_icon_size_lookup (GtkIconSize size,
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gint *widthp,
|
|
|
|
gint *heightp)
|
|
|
|
{
|
2002-09-24 21:03:58 +00:00
|
|
|
GTK_NOTE (MULTIHEAD,
|
|
|
|
g_warning ("gtk_icon_size_lookup ()) is not multihead safe"));
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
return gtk_icon_size_lookup_for_settings (gtk_settings_get_default (),
|
|
|
|
size, widthp, heightp);
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
static GtkIconSize
|
|
|
|
icon_size_register_intern (const gchar *name,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
IconAlias *old_alias;
|
|
|
|
GtkIconSize size;
|
2001-03-12 18:46:53 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
init_icon_sizes ();
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
old_alias = g_hash_table_lookup (icon_aliases, name);
|
|
|
|
if (old_alias && icon_sizes[old_alias->target].width > 0)
|
|
|
|
{
|
|
|
|
g_warning ("Icon size name '%s' already exists", name);
|
|
|
|
return GTK_ICON_SIZE_INVALID;
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
if (old_alias)
|
|
|
|
{
|
|
|
|
size = old_alias->target;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (icon_sizes_used == icon_sizes_allocated)
|
|
|
|
{
|
|
|
|
icon_sizes_allocated *= 2;
|
|
|
|
icon_sizes = g_renew (IconSize, icon_sizes, icon_sizes_allocated);
|
|
|
|
}
|
|
|
|
|
|
|
|
size = icon_sizes_used++;
|
|
|
|
|
|
|
|
/* alias to self. */
|
|
|
|
gtk_icon_size_register_alias (name, size);
|
|
|
|
|
|
|
|
icon_sizes[size].size = size;
|
|
|
|
icon_sizes[size].name = g_strdup (name);
|
|
|
|
}
|
|
|
|
|
|
|
|
icon_sizes[size].width = width;
|
|
|
|
icon_sizes[size].height = height;
|
|
|
|
|
|
|
|
return size;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_size_register:
|
2001-03-12 18:46:53 +00:00
|
|
|
* @name: name of the icon size
|
2001-02-03 01:09:41 +00:00
|
|
|
* @width: the icon width
|
|
|
|
* @height: the icon height
|
|
|
|
*
|
|
|
|
* Registers a new icon size, along the same lines as #GTK_ICON_SIZE_MENU,
|
2001-03-12 18:46:53 +00:00
|
|
|
* etc. Returns the integer value for the size.
|
|
|
|
*
|
|
|
|
* Returns: integer value representing the size
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
|
|
|
**/
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize
|
|
|
|
gtk_icon_size_register (const gchar *name,
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
2001-03-12 18:46:53 +00:00
|
|
|
g_return_val_if_fail (name != NULL, 0);
|
|
|
|
g_return_val_if_fail (width > 0, 0);
|
|
|
|
g_return_val_if_fail (height > 0, 0);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
return icon_size_register_intern (name, width, height);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_size_register_alias:
|
|
|
|
* @alias: an alias for @target
|
2001-03-12 18:46:53 +00:00
|
|
|
* @target: an existing icon size
|
|
|
|
*
|
|
|
|
* Registers @alias as another name for @target.
|
|
|
|
* So calling gtk_icon_size_from_name() with @alias as argument
|
|
|
|
* will return @target.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_size_register_alias (const gchar *alias,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize target)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2001-03-12 18:46:53 +00:00
|
|
|
IconAlias *ia;
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
g_return_if_fail (alias != NULL);
|
|
|
|
|
|
|
|
init_icon_sizes ();
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
if (!icon_size_lookup_intern (NULL, target, NULL, NULL))
|
2006-10-08 05:07:55 +00:00
|
|
|
g_warning ("gtk_icon_size_register_alias: Icon size %u does not exist", target);
|
2001-03-12 18:46:53 +00:00
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
ia = g_hash_table_lookup (icon_aliases, alias);
|
|
|
|
if (ia)
|
|
|
|
{
|
|
|
|
if (icon_sizes[ia->target].width > 0)
|
|
|
|
{
|
|
|
|
g_warning ("gtk_icon_size_register_alias: Icon size name '%s' already exists", alias);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ia->target = target;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ia)
|
|
|
|
{
|
|
|
|
ia = g_new (IconAlias, 1);
|
|
|
|
ia->name = g_strdup (alias);
|
|
|
|
ia->target = target;
|
|
|
|
|
|
|
|
g_hash_table_insert (icon_aliases, ia->name, ia);
|
|
|
|
}
|
2001-03-12 18:46:53 +00:00
|
|
|
}
|
|
|
|
|
2001-10-28 21:15:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_size_from_name:
|
|
|
|
* @name: the name to look up.
|
|
|
|
* @returns: the icon size with the given name.
|
|
|
|
*
|
|
|
|
* Looks up the icon size associated with @name.
|
|
|
|
**/
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize
|
|
|
|
gtk_icon_size_from_name (const gchar *name)
|
|
|
|
{
|
|
|
|
IconAlias *ia;
|
|
|
|
|
|
|
|
init_icon_sizes ();
|
|
|
|
|
|
|
|
ia = g_hash_table_lookup (icon_aliases, name);
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
if (ia && icon_sizes[ia->target].width > 0)
|
2001-03-12 18:46:53 +00:00
|
|
|
return ia->target;
|
|
|
|
else
|
|
|
|
return GTK_ICON_SIZE_INVALID;
|
|
|
|
}
|
|
|
|
|
2001-10-28 21:15:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_size_get_name:
|
|
|
|
* @size: a #GtkIconSize.
|
|
|
|
* @returns: the name of the given icon size.
|
|
|
|
*
|
|
|
|
* Gets the canonical name of the given icon size. The returned string
|
|
|
|
* is statically allocated and should not be freed.
|
|
|
|
**/
|
2001-03-12 18:46:53 +00:00
|
|
|
G_CONST_RETURN gchar*
|
|
|
|
gtk_icon_size_get_name (GtkIconSize size)
|
|
|
|
{
|
|
|
|
if (size >= icon_sizes_used)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return icon_sizes[size].name;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
/************************************************************/
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
/* Icon Set */
|
|
|
|
|
|
|
|
|
|
|
|
static GdkPixbuf *find_in_cache (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
static void add_to_cache (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size,
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GdkPixbuf *pixbuf);
|
2003-07-02 22:44:09 +00:00
|
|
|
/* Clear icon set contents, drop references to all contained
|
|
|
|
* GdkPixbuf objects and forget all GtkIconSources. Used to
|
|
|
|
* recycle an icon set.
|
|
|
|
*/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
static void clear_cache (GtkIconSet *icon_set,
|
|
|
|
gboolean style_detach);
|
|
|
|
static GSList* copy_cache (GtkIconSet *icon_set,
|
|
|
|
GtkIconSet *copy_recipient);
|
|
|
|
static void attach_to_style (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style);
|
|
|
|
static void detach_from_style (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style);
|
|
|
|
static void style_dnotify (gpointer data);
|
|
|
|
|
|
|
|
struct _GtkIconSet
|
|
|
|
{
|
|
|
|
guint ref_count;
|
|
|
|
|
|
|
|
GSList *sources;
|
|
|
|
|
|
|
|
/* Cache of the last few rendered versions of the icon. */
|
|
|
|
GSList *cache;
|
|
|
|
|
|
|
|
guint cache_size;
|
|
|
|
|
|
|
|
guint cache_serial;
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint cache_serial = 0;
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkIconSet. A #GtkIconSet represents a single icon
|
|
|
|
* in various sizes and widget states. It can provide a #GdkPixbuf
|
|
|
|
* for a given size and state on request, and automatically caches
|
|
|
|
* some of the rendered #GdkPixbuf objects.
|
|
|
|
*
|
|
|
|
* Normally you would use gtk_widget_render_icon() instead of
|
|
|
|
* using #GtkIconSet directly. The one case where you'd use
|
|
|
|
* #GtkIconSet is to create application-specific icon sets to place in
|
|
|
|
* a #GtkIconFactory.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconSet
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconSet*
|
|
|
|
gtk_icon_set_new (void)
|
|
|
|
{
|
|
|
|
GtkIconSet *icon_set;
|
|
|
|
|
|
|
|
icon_set = g_new (GtkIconSet, 1);
|
|
|
|
|
|
|
|
icon_set->ref_count = 1;
|
|
|
|
icon_set->sources = NULL;
|
|
|
|
icon_set->cache = NULL;
|
|
|
|
icon_set->cache_size = 0;
|
|
|
|
icon_set->cache_serial = cache_serial;
|
|
|
|
|
|
|
|
return icon_set;
|
|
|
|
}
|
|
|
|
|
2001-02-20 19:07:15 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_new_from_pixbuf:
|
|
|
|
* @pixbuf: a #GdkPixbuf
|
|
|
|
*
|
2001-03-19 22:40:35 +00:00
|
|
|
* Creates a new #GtkIconSet with @pixbuf as the default/fallback
|
|
|
|
* source image. If you don't add any additional #GtkIconSource to the
|
|
|
|
* icon set, all variants of the icon will be created from @pixbuf,
|
|
|
|
* using scaling, pixelation, etc. as required to adjust the icon size
|
|
|
|
* or make the icon look insensitive/prelighted.
|
2001-02-20 19:07:15 +00:00
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconSet
|
|
|
|
**/
|
|
|
|
GtkIconSet *
|
|
|
|
gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf)
|
|
|
|
{
|
|
|
|
GtkIconSet *set;
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
GtkIconSource source = GTK_ICON_SOURCE_INIT (TRUE, TRUE, TRUE);
|
2001-02-20 19:07:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, NULL);
|
|
|
|
|
|
|
|
set = gtk_icon_set_new ();
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_source_set_pixbuf (&source, pixbuf);
|
2001-02-20 19:07:15 +00:00
|
|
|
gtk_icon_set_add_source (set, &source);
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_source_set_pixbuf (&source, NULL);
|
2001-02-20 19:07:15 +00:00
|
|
|
|
|
|
|
return set;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_ref:
|
Mass fixing of trivial doc bugs. (#63544, #57007, #64141, #63472, #57108,
* gtk/gtkiconfactory.c, gtk/gtktextbuffer.c, gtk/gtktreemodel.c,
gtk/gtkwindow.c, gtk/gtknotebook.c, gtk/gtkradiobutton.c,
gtk/gtktextiter.c, gtk/gtkdialog.c: Mass fixing of trivial doc bugs.
(#63544, #57007, #64141, #63472, #57108, #60818, #61562)
* gtk/tmpl/gtkaccellabel.sgml, gtk/tmpl/gtkcombo.sgml,
gtk/tmpl/gtkentry.sgml, gtk/tmpl/gtkhscrollbar.sgml,
gtk/tmpl/gtkvscrollbar.sgml, gtk/tmpl/gtktoolbar.sgml,
gtk/tmpl/gtkdialog.sgml, gtk/tmpl/gtkstatusbar.sgml:
Mass fixing of trivial doc bugs. (#55579, #56760, #58769, #55918,
#64154, #60422, #54697)
2001-11-10 22:06:44 +00:00
|
|
|
* @icon_set: a #GtkIconSet.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
Mass fixing of trivial doc bugs. (#63544, #57007, #64141, #63472, #57108,
* gtk/gtkiconfactory.c, gtk/gtktextbuffer.c, gtk/gtktreemodel.c,
gtk/gtkwindow.c, gtk/gtknotebook.c, gtk/gtkradiobutton.c,
gtk/gtktextiter.c, gtk/gtkdialog.c: Mass fixing of trivial doc bugs.
(#63544, #57007, #64141, #63472, #57108, #60818, #61562)
* gtk/tmpl/gtkaccellabel.sgml, gtk/tmpl/gtkcombo.sgml,
gtk/tmpl/gtkentry.sgml, gtk/tmpl/gtkhscrollbar.sgml,
gtk/tmpl/gtkvscrollbar.sgml, gtk/tmpl/gtktoolbar.sgml,
gtk/tmpl/gtkdialog.sgml, gtk/tmpl/gtkstatusbar.sgml:
Mass fixing of trivial doc bugs. (#55579, #56760, #58769, #55918,
#64154, #60422, #54697)
2001-11-10 22:06:44 +00:00
|
|
|
* Increments the reference count on @icon_set.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
Mass fixing of trivial doc bugs. (#63544, #57007, #64141, #63472, #57108,
* gtk/gtkiconfactory.c, gtk/gtktextbuffer.c, gtk/gtktreemodel.c,
gtk/gtkwindow.c, gtk/gtknotebook.c, gtk/gtkradiobutton.c,
gtk/gtktextiter.c, gtk/gtkdialog.c: Mass fixing of trivial doc bugs.
(#63544, #57007, #64141, #63472, #57108, #60818, #61562)
* gtk/tmpl/gtkaccellabel.sgml, gtk/tmpl/gtkcombo.sgml,
gtk/tmpl/gtkentry.sgml, gtk/tmpl/gtkhscrollbar.sgml,
gtk/tmpl/gtkvscrollbar.sgml, gtk/tmpl/gtktoolbar.sgml,
gtk/tmpl/gtkdialog.sgml, gtk/tmpl/gtkstatusbar.sgml:
Mass fixing of trivial doc bugs. (#55579, #56760, #58769, #55918,
#64154, #60422, #54697)
2001-11-10 22:06:44 +00:00
|
|
|
* Return value: @icon_set.
|
2001-02-03 01:09:41 +00:00
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconSet*
|
|
|
|
gtk_icon_set_ref (GtkIconSet *icon_set)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (icon_set != NULL, NULL);
|
|
|
|
g_return_val_if_fail (icon_set->ref_count > 0, NULL);
|
|
|
|
|
|
|
|
icon_set->ref_count += 1;
|
|
|
|
|
|
|
|
return icon_set;
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_unref:
|
|
|
|
* @icon_set: a #GtkIconSet
|
|
|
|
*
|
|
|
|
* Decrements the reference count on @icon_set, and frees memory
|
|
|
|
* if the reference count reaches 0.
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_set_unref (GtkIconSet *icon_set)
|
|
|
|
{
|
|
|
|
g_return_if_fail (icon_set != NULL);
|
|
|
|
g_return_if_fail (icon_set->ref_count > 0);
|
|
|
|
|
|
|
|
icon_set->ref_count -= 1;
|
|
|
|
|
|
|
|
if (icon_set->ref_count == 0)
|
|
|
|
{
|
|
|
|
GSList *tmp_list = icon_set->sources;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
gtk_icon_source_free (tmp_list->data);
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
2003-04-21 22:33:03 +00:00
|
|
|
g_slist_free (icon_set->sources);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
clear_cache (icon_set, TRUE);
|
|
|
|
|
|
|
|
g_free (icon_set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-02 19:11:47 +00:00
|
|
|
GType
|
|
|
|
gtk_icon_set_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (our_type == 0)
|
2005-09-01 05:11:46 +00:00
|
|
|
our_type = g_boxed_type_register_static (I_("GtkIconSet"),
|
2002-03-02 19:11:47 +00:00
|
|
|
(GBoxedCopyFunc) gtk_icon_set_ref,
|
|
|
|
(GBoxedFreeFunc) gtk_icon_set_unref);
|
|
|
|
|
|
|
|
return our_type;
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_copy:
|
|
|
|
* @icon_set: a #GtkIconSet
|
|
|
|
*
|
|
|
|
* Copies @icon_set by value.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconSet identical to the first.
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkIconSet*
|
|
|
|
gtk_icon_set_copy (GtkIconSet *icon_set)
|
|
|
|
{
|
|
|
|
GtkIconSet *copy;
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
|
|
|
copy = gtk_icon_set_new ();
|
|
|
|
|
|
|
|
tmp_list = icon_set->sources;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
copy->sources = g_slist_prepend (copy->sources,
|
|
|
|
gtk_icon_source_copy (tmp_list->data));
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
copy->sources = g_slist_reverse (copy->sources);
|
|
|
|
|
|
|
|
copy->cache = copy_cache (icon_set, copy);
|
|
|
|
copy->cache_size = icon_set->cache_size;
|
|
|
|
copy->cache_serial = icon_set->cache_serial;
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2001-03-12 18:46:53 +00:00
|
|
|
sizes_equivalent (GtkIconSize lhs,
|
|
|
|
GtkIconSize rhs)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2002-09-24 21:03:58 +00:00
|
|
|
/* We used to consider sizes equivalent if they were
|
|
|
|
* the same pixel size, but we don't have the GtkSettings
|
|
|
|
* here, so we can't do that. Plus, it's not clear that
|
|
|
|
* it is right... it was just a workaround for the fact
|
|
|
|
* that we register icons by logical size, not pixel size.
|
|
|
|
*/
|
|
|
|
#if 1
|
|
|
|
return lhs == rhs;
|
|
|
|
#else
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gint r_w, r_h, l_w, l_h;
|
|
|
|
|
2002-09-24 21:03:58 +00:00
|
|
|
icon_size_lookup_intern (NULL, rhs, &r_w, &r_h);
|
|
|
|
icon_size_lookup_intern (NULL, lhs, &l_w, &l_h);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
return r_w == l_w && r_h == l_h;
|
2002-09-24 21:03:58 +00:00
|
|
|
#endif
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
static GtkIconSource *
|
|
|
|
find_best_matching_source (GtkIconSet *icon_set,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
|
|
|
GtkIconSize size,
|
|
|
|
GSList *failed)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
|
|
|
GtkIconSource *source;
|
|
|
|
GSList *tmp_list;
|
2003-07-02 22:44:09 +00:00
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
/* We need to find the best icon source. Direction matters more
|
|
|
|
* than state, state matters more than size. icon_set->sources
|
|
|
|
* is sorted according to wildness, so if we take the first
|
|
|
|
* match we find it will be the least-wild match (if there are
|
|
|
|
* multiple matches for a given "wildness" then the RC file contained
|
|
|
|
* dumb stuff, and we end up with an arbitrary matching source)
|
|
|
|
*/
|
|
|
|
|
|
|
|
source = NULL;
|
|
|
|
tmp_list = icon_set->sources;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
GtkIconSource *s = tmp_list->data;
|
|
|
|
|
|
|
|
if ((s->any_direction || (s->direction == direction)) &&
|
|
|
|
(s->any_state || (s->state == state)) &&
|
2007-10-16 20:08:31 +00:00
|
|
|
(s->any_size || size == (GtkIconSize)-1 || (sizes_equivalent (size, s->size))))
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
if (!g_slist_find (failed, s))
|
|
|
|
{
|
|
|
|
source = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
return source;
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
static gboolean
|
|
|
|
ensure_filename_pixbuf (GtkIconSet *icon_set,
|
|
|
|
GtkIconSource *source)
|
|
|
|
{
|
|
|
|
if (source->filename_pixbuf == NULL)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2001-07-20 18:05:33 +00:00
|
|
|
GError *error = NULL;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
source->filename_pixbuf = gdk_pixbuf_new_from_file (source->source.filename, &error);
|
|
|
|
|
|
|
|
if (source->filename_pixbuf == NULL)
|
|
|
|
{
|
|
|
|
/* Remove this icon source so we don't keep trying to
|
|
|
|
* load it.
|
|
|
|
*/
|
|
|
|
g_warning (_("Error loading icon: %s"), error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
icon_set->sources = g_slist_remove (icon_set->sources, source);
|
|
|
|
|
|
|
|
gtk_icon_source_free (source);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbuf *
|
|
|
|
render_icon_name_pixbuf (GtkIconSource *icon_source,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
|
|
|
GtkIconSize size,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *detail)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GdkPixbuf *tmp_pixbuf;
|
|
|
|
GtkIconSource tmp_source;
|
|
|
|
GdkScreen *screen;
|
|
|
|
GtkIconTheme *icon_theme;
|
|
|
|
GtkSettings *settings;
|
|
|
|
gint width, height, pixel_size;
|
2004-08-16 18:38:55 +00:00
|
|
|
gint *sizes, *s, dist;
|
2003-07-02 22:44:09 +00:00
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
if (widget && gtk_widget_has_screen (widget))
|
|
|
|
screen = gtk_widget_get_screen (widget);
|
2004-06-26 04:58:33 +00:00
|
|
|
else if (style && style->colormap)
|
2003-07-02 22:44:09 +00:00
|
|
|
screen = gdk_colormap_get_screen (style->colormap);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
screen = gdk_screen_get_default ();
|
|
|
|
GTK_NOTE (MULTIHEAD,
|
|
|
|
g_warning ("Using the default screen for gtk_icon_source_render_icon()"));
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
icon_theme = gtk_icon_theme_get_for_screen (screen);
|
|
|
|
settings = gtk_settings_get_for_screen (screen);
|
|
|
|
|
|
|
|
if (!gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
|
|
|
|
{
|
2007-10-16 20:08:31 +00:00
|
|
|
if (size == (GtkIconSize)-1)
|
2004-08-16 18:38:55 +00:00
|
|
|
{
|
|
|
|
/* Find an available size close to 48
|
|
|
|
*/
|
|
|
|
sizes = gtk_icon_theme_get_icon_sizes (icon_theme, icon_source->source.icon_name);
|
|
|
|
dist = 1000;
|
|
|
|
width = height = 48;
|
|
|
|
for (s = sizes; *s; s++)
|
|
|
|
{
|
|
|
|
if (*s == -1)
|
|
|
|
{
|
|
|
|
width = height = 48;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*s < 48)
|
|
|
|
{
|
|
|
|
if (48 - *s < dist)
|
|
|
|
{
|
|
|
|
width = height = *s;
|
|
|
|
dist = 48 - *s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*s - 48 < dist)
|
|
|
|
{
|
|
|
|
width = height = *s;
|
|
|
|
dist = *s - 48;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (sizes);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-10-08 05:07:55 +00:00
|
|
|
g_warning ("Invalid icon size %u\n", size);
|
2004-08-16 18:38:55 +00:00
|
|
|
width = height = 24;
|
|
|
|
}
|
2003-07-02 22:44:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pixel_size = MIN (width, height);
|
|
|
|
|
|
|
|
tmp_pixbuf = gtk_icon_theme_load_icon (icon_theme,
|
|
|
|
icon_source->source.icon_name,
|
|
|
|
pixel_size, 0,
|
|
|
|
&error);
|
|
|
|
|
|
|
|
if (!tmp_pixbuf)
|
|
|
|
{
|
2007-05-25 15:31:28 +00:00
|
|
|
g_warning ("Error loading theme icon '%s' for stock: %s",
|
|
|
|
icon_source->source.icon_name, error->message);
|
2004-01-29 17:55:48 +00:00
|
|
|
g_error_free (error);
|
2003-07-02 22:44:09 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_source = *icon_source;
|
|
|
|
tmp_source.type = GTK_ICON_SOURCE_PIXBUF;
|
|
|
|
tmp_source.source.pixbuf = tmp_pixbuf;
|
|
|
|
|
|
|
|
pixbuf = gtk_style_render_icon (style, &tmp_source,
|
|
|
|
direction, state, -1,
|
|
|
|
widget, detail);
|
|
|
|
|
|
|
|
if (!pixbuf)
|
|
|
|
g_warning ("Failed to render icon");
|
|
|
|
|
|
|
|
g_object_unref (tmp_pixbuf);
|
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbuf *
|
|
|
|
find_and_render_icon_source (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
|
|
|
GtkIconSize size,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *detail)
|
|
|
|
{
|
|
|
|
GSList *failed = NULL;
|
|
|
|
GdkPixbuf *pixbuf = NULL;
|
|
|
|
|
|
|
|
/* We treat failure in two different ways:
|
|
|
|
*
|
|
|
|
* A) If loading a source that specifies a filename fails,
|
|
|
|
* we treat that as permanent, and remove the source
|
|
|
|
* from the GtkIconSet. (in ensure_filename_pixbuf ()
|
|
|
|
* B) If loading a themed icon fails, or scaling an icon
|
|
|
|
* fails, we treat that as transient and will try
|
|
|
|
* again next time the icon falls out of the cache
|
|
|
|
* and we need to recreate it.
|
|
|
|
*/
|
|
|
|
while (pixbuf == NULL)
|
|
|
|
{
|
|
|
|
GtkIconSource *source = find_best_matching_source (icon_set, direction, state, size, failed);
|
|
|
|
|
|
|
|
if (source == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (source->type)
|
|
|
|
{
|
|
|
|
case GTK_ICON_SOURCE_FILENAME:
|
|
|
|
if (!ensure_filename_pixbuf (icon_set, source))
|
|
|
|
break;
|
|
|
|
/* Fall through */
|
|
|
|
case GTK_ICON_SOURCE_PIXBUF:
|
|
|
|
pixbuf = gtk_style_render_icon (style, source,
|
|
|
|
direction, state, size,
|
|
|
|
widget, detail);
|
|
|
|
if (!pixbuf)
|
|
|
|
{
|
|
|
|
g_warning ("Failed to render icon");
|
|
|
|
failed = g_slist_prepend (failed, source);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_ICON_NAME:
|
2005-11-04 15:43:40 +00:00
|
|
|
case GTK_ICON_SOURCE_STATIC_ICON_NAME:
|
2003-07-02 22:44:09 +00:00
|
|
|
pixbuf = render_icon_name_pixbuf (source, style,
|
|
|
|
direction, state, size,
|
|
|
|
widget, detail);
|
|
|
|
if (!pixbuf)
|
|
|
|
failed = g_slist_prepend (failed, source);
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_EMPTY:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (failed);
|
|
|
|
|
|
|
|
return pixbuf;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
extern GtkIconCache *_builtin_cache;
|
|
|
|
|
2001-03-07 21:10:44 +00:00
|
|
|
static GdkPixbuf*
|
2001-05-25 20:41:46 +00:00
|
|
|
render_fallback_image (GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
|
|
|
GtkIconSize size,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *detail)
|
2001-03-07 21:10:44 +00:00
|
|
|
{
|
|
|
|
/* This icon can be used for any direction/state/size */
|
2003-07-02 22:44:09 +00:00
|
|
|
static GtkIconSource fallback_source = GTK_ICON_SOURCE_INIT (TRUE, TRUE, TRUE);
|
2001-03-07 21:10:44 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (fallback_source.type == GTK_ICON_SOURCE_EMPTY)
|
|
|
|
{
|
2007-12-29 00:14:30 +00:00
|
|
|
gint index;
|
2006-07-20 18:07:21 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
_gtk_icon_theme_ensure_builtin_cache ();
|
|
|
|
|
2007-12-29 00:14:30 +00:00
|
|
|
index = _gtk_icon_cache_get_directory_index (_builtin_cache, "24");
|
2006-07-20 18:07:21 +00:00
|
|
|
pixbuf = _gtk_icon_cache_get_icon (_builtin_cache,
|
|
|
|
GTK_STOCK_MISSING_IMAGE,
|
2007-12-29 00:14:30 +00:00
|
|
|
index);
|
2003-07-02 22:44:09 +00:00
|
|
|
gtk_icon_source_set_pixbuf (&fallback_source, pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
return gtk_style_render_icon (style,
|
|
|
|
&fallback_source,
|
|
|
|
direction,
|
|
|
|
state,
|
|
|
|
size,
|
|
|
|
widget,
|
|
|
|
detail);
|
2001-03-07 21:10:44 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_render_icon:
|
|
|
|
* @icon_set: a #GtkIconSet
|
|
|
|
* @style: a #GtkStyle associated with @widget, or %NULL
|
|
|
|
* @direction: text direction
|
|
|
|
* @state: widget state
|
2004-04-14 21:04:29 +00:00
|
|
|
* @size: icon size. A size of (GtkIconSize)-1
|
|
|
|
* means render at the size of the source and don't scale.
|
2003-07-02 22:44:09 +00:00
|
|
|
* @widget: widget that will display the icon, or %NULL.
|
|
|
|
* The only use that is typically made of this
|
|
|
|
* is to determine the appropriate #GdkScreen.
|
|
|
|
* @detail: detail to pass to the theme engine, or %NULL.
|
|
|
|
* Note that passing a detail of anything but %NULL
|
|
|
|
* will disable caching.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
|
|
|
* Renders an icon using gtk_style_render_icon(). In most cases,
|
2001-03-19 22:40:35 +00:00
|
|
|
* gtk_widget_render_icon() is better, since it automatically provides
|
|
|
|
* most of the arguments from the current widget settings. This
|
|
|
|
* function never returns %NULL; if the icon can't be rendered
|
|
|
|
* (perhaps because an image file fails to load), a default "missing
|
|
|
|
* image" icon will be returned instead.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
2001-03-19 22:40:35 +00:00
|
|
|
* Return value: a #GdkPixbuf to be displayed
|
2001-02-03 01:09:41 +00:00
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GdkPixbuf*
|
|
|
|
gtk_icon_set_render_icon (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size,
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkWidget *widget,
|
|
|
|
const char *detail)
|
|
|
|
{
|
|
|
|
GdkPixbuf *icon;
|
|
|
|
|
|
|
|
g_return_val_if_fail (icon_set != NULL, NULL);
|
2004-06-26 04:58:33 +00:00
|
|
|
g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
if (icon_set->sources == NULL)
|
2001-05-25 20:41:46 +00:00
|
|
|
return render_fallback_image (style, direction, state, size, widget, detail);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (detail == NULL)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
icon = find_in_cache (icon_set, style, direction,
|
|
|
|
state, size);
|
|
|
|
|
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
g_object_ref (icon);
|
|
|
|
return icon;
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
icon = find_and_render_icon_source (icon_set, style, direction, state, size,
|
|
|
|
widget, detail);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
if (icon == NULL)
|
2003-07-02 22:44:09 +00:00
|
|
|
icon = render_fallback_image (style, direction, state, size, widget, detail);
|
|
|
|
|
|
|
|
if (detail == NULL)
|
|
|
|
add_to_cache (icon_set, style, direction, state, size, icon);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Order sources by their "wildness", so that "wilder" sources are
|
|
|
|
* greater than "specific" sources; for determining ordering,
|
|
|
|
* direction beats state beats size.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
icon_source_compare (gconstpointer ap, gconstpointer bp)
|
|
|
|
{
|
|
|
|
const GtkIconSource *a = ap;
|
|
|
|
const GtkIconSource *b = bp;
|
|
|
|
|
|
|
|
if (!a->any_direction && b->any_direction)
|
|
|
|
return -1;
|
|
|
|
else if (a->any_direction && !b->any_direction)
|
|
|
|
return 1;
|
|
|
|
else if (!a->any_state && b->any_state)
|
|
|
|
return -1;
|
|
|
|
else if (a->any_state && !b->any_state)
|
|
|
|
return 1;
|
|
|
|
else if (!a->any_size && b->any_size)
|
|
|
|
return -1;
|
|
|
|
else if (a->any_size && !b->any_size)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_add_source:
|
|
|
|
* @icon_set: a #GtkIconSet
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Icon sets have a list of #GtkIconSource, which they use as base
|
|
|
|
* icons for rendering icons in different states and sizes. Icons are
|
|
|
|
* scaled, made to look insensitive, etc. in
|
|
|
|
* gtk_icon_set_render_icon(), but #GtkIconSet needs base images to
|
|
|
|
* work with. The base images and when to use them are described by
|
2001-03-19 22:40:35 +00:00
|
|
|
* a #GtkIconSource.
|
|
|
|
*
|
|
|
|
* This function copies @source, so you can reuse the same source immediately
|
|
|
|
* without affecting the icon set.
|
|
|
|
*
|
|
|
|
* An example of when you'd use this function: a web browser's "Back
|
|
|
|
* to Previous Page" icon might point in a different direction in
|
|
|
|
* Hebrew and in English; it might look different when insensitive;
|
|
|
|
* and it might change size depending on toolbar mode (small/large
|
|
|
|
* icons). So a single icon set would contain all those variants of
|
|
|
|
* the icon, and you might add a separate source for each one.
|
|
|
|
*
|
|
|
|
* You should nearly always add a "default" icon source with all
|
|
|
|
* fields wildcarded, which will be used as a fallback if no more
|
|
|
|
* specific source matches. #GtkIconSet always prefers more specific
|
|
|
|
* icon sources to more generic icon sources. The order in which you
|
|
|
|
* add the sources to the icon set does not matter.
|
|
|
|
*
|
|
|
|
* gtk_icon_set_new_from_pixbuf() creates a new icon set with a
|
|
|
|
* default icon source based on the given pixbuf.
|
2001-02-03 01:09:41 +00:00
|
|
|
*
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_set_add_source (GtkIconSet *icon_set,
|
|
|
|
const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_if_fail (icon_set != NULL);
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (source->type == GTK_ICON_SOURCE_EMPTY)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
2003-07-02 22:44:09 +00:00
|
|
|
g_warning ("Useless empty GtkIconSource");
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
icon_set->sources = g_slist_insert_sorted (icon_set->sources,
|
|
|
|
gtk_icon_source_copy (source),
|
|
|
|
icon_source_compare);
|
|
|
|
}
|
|
|
|
|
2001-05-25 20:41:46 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_set_get_sizes:
|
|
|
|
* @icon_set: a #GtkIconSet
|
|
|
|
* @sizes: return location for array of sizes
|
|
|
|
* @n_sizes: location to store number of elements in returned array
|
|
|
|
*
|
|
|
|
* Obtains a list of icon sizes this icon set can render. The returned
|
|
|
|
* array must be freed with g_free().
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_set_get_sizes (GtkIconSet *icon_set,
|
|
|
|
GtkIconSize **sizes,
|
|
|
|
gint *n_sizes)
|
|
|
|
{
|
|
|
|
GSList *tmp_list;
|
|
|
|
gboolean all_sizes = FALSE;
|
|
|
|
GSList *specifics = NULL;
|
|
|
|
|
|
|
|
g_return_if_fail (icon_set != NULL);
|
|
|
|
g_return_if_fail (sizes != NULL);
|
|
|
|
g_return_if_fail (n_sizes != NULL);
|
|
|
|
|
|
|
|
tmp_list = icon_set->sources;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
GtkIconSource *source;
|
|
|
|
|
|
|
|
source = tmp_list->data;
|
|
|
|
|
|
|
|
if (source->any_size)
|
|
|
|
{
|
|
|
|
all_sizes = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
specifics = g_slist_prepend (specifics, GINT_TO_POINTER (source->size));
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (all_sizes)
|
|
|
|
{
|
|
|
|
/* Need to find out what sizes exist */
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
init_icon_sizes ();
|
|
|
|
|
|
|
|
*sizes = g_new (GtkIconSize, icon_sizes_used);
|
2001-11-02 00:25:14 +00:00
|
|
|
*n_sizes = icon_sizes_used - 1;
|
2001-05-25 20:41:46 +00:00
|
|
|
|
2001-11-02 00:25:14 +00:00
|
|
|
i = 1;
|
2001-05-25 20:41:46 +00:00
|
|
|
while (i < icon_sizes_used)
|
|
|
|
{
|
2001-11-02 00:25:14 +00:00
|
|
|
(*sizes)[i - 1] = icon_sizes[i].size;
|
2001-05-25 20:41:46 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
*n_sizes = g_slist_length (specifics);
|
|
|
|
*sizes = g_new (GtkIconSize, *n_sizes);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
tmp_list = specifics;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
(*sizes)[i] = GPOINTER_TO_INT (tmp_list->data);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (specifics);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-19 22:40:35 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_source_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkIconSource. A #GtkIconSource contains a #GdkPixbuf (or
|
|
|
|
* image filename) that serves as the base image for one or more of the
|
|
|
|
* icons in a #GtkIconSet, along with a specification for which icons in the
|
|
|
|
* icon set will be based on that pixbuf or image file. An icon set contains
|
|
|
|
* a set of icons that represent "the same" logical concept in different states,
|
|
|
|
* different global text directions, and different sizes.
|
|
|
|
*
|
|
|
|
* So for example a web browser's "Back to Previous Page" icon might
|
|
|
|
* point in a different direction in Hebrew and in English; it might
|
|
|
|
* look different when insensitive; and it might change size depending
|
|
|
|
* on toolbar mode (small/large icons). So a single icon set would
|
|
|
|
* contain all those variants of the icon. #GtkIconSet contains a list
|
|
|
|
* of #GtkIconSource from which it can derive specific icon variants in
|
|
|
|
* the set.
|
|
|
|
*
|
|
|
|
* In the simplest case, #GtkIconSet contains one source pixbuf from
|
|
|
|
* which it derives all variants. The convenience function
|
|
|
|
* gtk_icon_set_new_from_pixbuf() handles this case; if you only have
|
|
|
|
* one source pixbuf, just use that function.
|
|
|
|
*
|
|
|
|
* If you want to use a different base pixbuf for different icon
|
|
|
|
* variants, you create multiple icon sources, mark which variants
|
|
|
|
* they'll be used to create, and add them to the icon set with
|
|
|
|
* gtk_icon_set_add_source().
|
|
|
|
*
|
|
|
|
* By default, the icon source has all parameters wildcarded. That is,
|
|
|
|
* the icon source will be used as the base icon for any desired text
|
|
|
|
* direction, widget state, or icon size.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconSource
|
|
|
|
**/
|
|
|
|
GtkIconSource*
|
|
|
|
gtk_icon_source_new (void)
|
|
|
|
{
|
|
|
|
GtkIconSource *src;
|
|
|
|
|
|
|
|
src = g_new0 (GtkIconSource, 1);
|
|
|
|
|
|
|
|
src->direction = GTK_TEXT_DIR_NONE;
|
|
|
|
src->size = GTK_ICON_SIZE_INVALID;
|
|
|
|
src->state = GTK_STATE_NORMAL;
|
|
|
|
|
|
|
|
src->any_direction = TRUE;
|
|
|
|
src->any_state = TRUE;
|
|
|
|
src->any_size = TRUE;
|
|
|
|
|
|
|
|
return src;
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_source_copy:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Creates a copy of @source; mostly useful for language bindings.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkIconSource
|
|
|
|
**/
|
|
|
|
GtkIconSource*
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
gtk_icon_source_copy (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
GtkIconSource *copy;
|
|
|
|
|
|
|
|
g_return_val_if_fail (source != NULL, NULL);
|
|
|
|
|
|
|
|
copy = g_new (GtkIconSource, 1);
|
|
|
|
|
|
|
|
*copy = *source;
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
switch (copy->type)
|
|
|
|
{
|
|
|
|
case GTK_ICON_SOURCE_EMPTY:
|
2005-11-04 15:43:40 +00:00
|
|
|
case GTK_ICON_SOURCE_STATIC_ICON_NAME:
|
2003-07-02 22:44:09 +00:00
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_ICON_NAME:
|
|
|
|
copy->source.icon_name = g_strdup (copy->source.icon_name);
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_FILENAME:
|
|
|
|
copy->source.filename = g_strdup (copy->source.filename);
|
2004-12-12 21:09:13 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
copy->cp_filename = g_strdup (copy->cp_filename);
|
|
|
|
#endif
|
2003-07-02 22:44:09 +00:00
|
|
|
if (copy->filename_pixbuf)
|
|
|
|
g_object_ref (copy->filename_pixbuf);
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_PIXBUF:
|
|
|
|
g_object_ref (copy->source.pixbuf);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_source_free:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Frees a dynamically-allocated icon source, along with its
|
|
|
|
* filename, size, and pixbuf fields if those are not %NULL.
|
|
|
|
**/
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
void
|
|
|
|
gtk_icon_source_free (GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
icon_source_clear (source);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
g_free (source);
|
|
|
|
}
|
|
|
|
|
2002-03-02 19:11:47 +00:00
|
|
|
GType
|
|
|
|
gtk_icon_source_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (our_type == 0)
|
2007-04-27 23:10:38 +00:00
|
|
|
our_type = g_boxed_type_register_static (I_("GtkIconSource"),
|
2002-03-02 19:11:47 +00:00
|
|
|
(GBoxedCopyFunc) gtk_icon_source_copy,
|
|
|
|
(GBoxedFreeFunc) gtk_icon_source_free);
|
|
|
|
|
|
|
|
return our_type;
|
|
|
|
}
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
static void
|
|
|
|
icon_source_clear (GtkIconSource *source)
|
|
|
|
{
|
|
|
|
switch (source->type)
|
|
|
|
{
|
|
|
|
case GTK_ICON_SOURCE_EMPTY:
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_ICON_NAME:
|
|
|
|
g_free (source->source.icon_name);
|
2005-11-04 15:43:40 +00:00
|
|
|
/* fall thru */
|
|
|
|
case GTK_ICON_SOURCE_STATIC_ICON_NAME:
|
2003-07-02 22:44:09 +00:00
|
|
|
source->source.icon_name = NULL;
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_FILENAME:
|
|
|
|
g_free (source->source.filename);
|
|
|
|
source->source.filename = NULL;
|
2004-12-12 21:09:13 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
g_free (source->cp_filename);
|
|
|
|
source->cp_filename = NULL;
|
|
|
|
#endif
|
2004-05-06 02:42:04 +00:00
|
|
|
if (source->filename_pixbuf)
|
|
|
|
g_object_unref (source->filename_pixbuf);
|
2003-07-02 22:44:09 +00:00
|
|
|
source->filename_pixbuf = NULL;
|
|
|
|
break;
|
|
|
|
case GTK_ICON_SOURCE_PIXBUF:
|
|
|
|
g_object_unref (source->source.pixbuf);
|
|
|
|
source->source.pixbuf = NULL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
|
|
|
|
|
|
|
source->type = GTK_ICON_SOURCE_EMPTY;
|
|
|
|
}
|
|
|
|
|
2001-03-19 22:40:35 +00:00
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_filename:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @filename: image file to use
|
|
|
|
*
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
* Sets the name of an image file to use as a base image when creating
|
|
|
|
* icon variants for #GtkIconSet. The filename must be absolute.
|
2001-03-19 22:40:35 +00:00
|
|
|
**/
|
|
|
|
void
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
gtk_icon_source_set_filename (GtkIconSource *source,
|
|
|
|
const gchar *filename)
|
2001-03-19 22:40:35 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
Allow %NULL for style to mean "revert to default style"
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 16:08:25 +00:00
|
|
|
g_return_if_fail (filename == NULL || g_path_is_absolute (filename));
|
2001-03-19 22:40:35 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (source->type == GTK_ICON_SOURCE_FILENAME &&
|
|
|
|
source->source.filename == filename)
|
2001-03-19 22:40:35 +00:00
|
|
|
return;
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
icon_source_clear (source);
|
|
|
|
|
|
|
|
if (filename != NULL)
|
|
|
|
{
|
|
|
|
source->type = GTK_ICON_SOURCE_FILENAME;
|
|
|
|
source->source.filename = g_strdup (filename);
|
2004-12-12 21:09:13 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
source->cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
|
|
|
|
#endif
|
2003-07-02 22:44:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_icon_name
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @icon_name: name of icon to use
|
|
|
|
*
|
|
|
|
* Sets the name of an icon to look up in the current icon theme
|
|
|
|
* to use as a base image when creating icon variants for #GtkIconSet.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_icon_name (GtkIconSource *source,
|
|
|
|
const gchar *icon_name)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
2001-03-19 22:40:35 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (source->type == GTK_ICON_SOURCE_ICON_NAME &&
|
|
|
|
source->source.icon_name == icon_name)
|
|
|
|
return;
|
|
|
|
|
|
|
|
icon_source_clear (source);
|
|
|
|
|
|
|
|
if (icon_name != NULL)
|
|
|
|
{
|
|
|
|
source->type = GTK_ICON_SOURCE_ICON_NAME;
|
|
|
|
source->source.icon_name = g_strdup (icon_name);
|
|
|
|
}
|
2001-03-19 22:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_pixbuf:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @pixbuf: pixbuf to use as a source
|
|
|
|
*
|
|
|
|
* Sets a pixbuf to use as a base image when creating icon variants
|
2003-07-02 22:44:09 +00:00
|
|
|
* for #GtkIconSet.
|
2001-03-19 22:40:35 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_pixbuf (GtkIconSource *source,
|
|
|
|
GdkPixbuf *pixbuf)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
2003-07-02 22:44:09 +00:00
|
|
|
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
|
|
|
|
|
|
|
|
if (source->type == GTK_ICON_SOURCE_PIXBUF &&
|
|
|
|
source->source.pixbuf == pixbuf)
|
|
|
|
return;
|
2001-03-19 22:40:35 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
icon_source_clear (source);
|
|
|
|
|
|
|
|
if (pixbuf != NULL)
|
|
|
|
{
|
|
|
|
source->type = GTK_ICON_SOURCE_PIXBUF;
|
|
|
|
source->source.pixbuf = g_object_ref (pixbuf);
|
|
|
|
}
|
2001-03-19 22:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_filename:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
Minor documentation fixes
2002-08-10 Soren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tree_widget.sgml,
docs/reference/gtk/tmpl/gtkdialog.sgml,
docs/reference/gtk/tmpl/gtkentry.sgml,
docs/reference/gtk/tmpl/gtkfilesel.sgml,
docs/reference/gtk/tmpl/gtkfontsel.sgml,
docs/reference/gtk/tmpl/gtkfontseldlg.sgml,
docs/reference/gtk/tmpl/gtktreemodel.sgml,
docs/reference/gtk/tmpl/gtkwidget.sgml, gdk/x11/gdkdisplay-x11.c,
gtk/gtkbbox.c, gtk/gtkbox.c, gtk/gtkbutton.c, gtk/gtkcellrenderer.c,
gtk/gtkcellrendererpixbuf.c, gtk/gtkcellrenderertext.c,
gtk/gtkcheckmenuitem.c, gtk/gtkcontainer.c, gtk/gtkcurve.c,
gtk/gtkdialog.h, gtk/gtkentry.c, gtk/gtkfilesel.c, gtk/gtkfontsel.c,
gtk/gtkframe.c, gtk/gtkhandlebox.c, gtk/gtkiconfactory.c,
gtk/gtkimage.c, gtk/gtkinvisible.c, gtk/gtkitemfactory.c,
gtk/gtklabel.c, gtk/gtklayout.c, gtk/gtkmenu.c, gtk/gtkprogress.c,
gtk/gtkprogressbar.c, gtk/gtkscrolledwindow.c, gtk/gtksizegroup.c,
gtk/gtktable.c, gtk/gtktextiter.c, gtk/gtktexttag.c,
gtk/gtktexttag.h, gtk/gtktextview.c, gtk/gtktogglebutton.c,
gtk/gtktoolbar.c, gtk/gtktreemodel.c, gtk/gtktreeselection.c,
gtk/gtktreestore.c, gtk/gtktreeview.c, gtk/gtktreeviewcolumn.c,
gtk/gtkviewport.c, gtk/gtkwidget.c, gtk/gtkwidget.h,
gtk/gtkwindow.c:
Minor documentation fixes
(#89254, patch from Brett Nash;
#85809, patch from daten@dnetc.org;
#76391, patch from Ross Burton;
#74559, Manuel Clos;
#73569, #72005, Alexey A. Malyshev;
#70061, patch from Dennis Bj"orklund;
#64566, #63388, #58328, #57499, #81007, #77349, Vitaly Tishkov;
#78932, Vitaly Tishkov, patch from Ross Burton;
#73306)
2002-08-10 09:55:41 +00:00
|
|
|
* Retrieves the source filename, or %NULL if none is set. The
|
2001-03-19 22:40:35 +00:00
|
|
|
* filename is not a copy, and should not be modified or expected to
|
|
|
|
* persist beyond the lifetime of the icon source.
|
|
|
|
*
|
Minor documentation fixes
2002-08-10 Soren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tree_widget.sgml,
docs/reference/gtk/tmpl/gtkdialog.sgml,
docs/reference/gtk/tmpl/gtkentry.sgml,
docs/reference/gtk/tmpl/gtkfilesel.sgml,
docs/reference/gtk/tmpl/gtkfontsel.sgml,
docs/reference/gtk/tmpl/gtkfontseldlg.sgml,
docs/reference/gtk/tmpl/gtktreemodel.sgml,
docs/reference/gtk/tmpl/gtkwidget.sgml, gdk/x11/gdkdisplay-x11.c,
gtk/gtkbbox.c, gtk/gtkbox.c, gtk/gtkbutton.c, gtk/gtkcellrenderer.c,
gtk/gtkcellrendererpixbuf.c, gtk/gtkcellrenderertext.c,
gtk/gtkcheckmenuitem.c, gtk/gtkcontainer.c, gtk/gtkcurve.c,
gtk/gtkdialog.h, gtk/gtkentry.c, gtk/gtkfilesel.c, gtk/gtkfontsel.c,
gtk/gtkframe.c, gtk/gtkhandlebox.c, gtk/gtkiconfactory.c,
gtk/gtkimage.c, gtk/gtkinvisible.c, gtk/gtkitemfactory.c,
gtk/gtklabel.c, gtk/gtklayout.c, gtk/gtkmenu.c, gtk/gtkprogress.c,
gtk/gtkprogressbar.c, gtk/gtkscrolledwindow.c, gtk/gtksizegroup.c,
gtk/gtktable.c, gtk/gtktextiter.c, gtk/gtktexttag.c,
gtk/gtktexttag.h, gtk/gtktextview.c, gtk/gtktogglebutton.c,
gtk/gtktoolbar.c, gtk/gtktreemodel.c, gtk/gtktreeselection.c,
gtk/gtktreestore.c, gtk/gtktreeview.c, gtk/gtktreeviewcolumn.c,
gtk/gtkviewport.c, gtk/gtkwidget.c, gtk/gtkwidget.h,
gtk/gtkwindow.c:
Minor documentation fixes
(#89254, patch from Brett Nash;
#85809, patch from daten@dnetc.org;
#76391, patch from Ross Burton;
#74559, Manuel Clos;
#73569, #72005, Alexey A. Malyshev;
#70061, patch from Dennis Bj"orklund;
#64566, #63388, #58328, #57499, #81007, #77349, Vitaly Tishkov;
#78932, Vitaly Tishkov, patch from Ross Burton;
#73306)
2002-08-10 09:55:41 +00:00
|
|
|
* Return value: image filename. This string must not be modified
|
|
|
|
* or freed.
|
2001-03-19 22:40:35 +00:00
|
|
|
**/
|
|
|
|
G_CONST_RETURN gchar*
|
|
|
|
gtk_icon_source_get_filename (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, NULL);
|
2003-07-02 22:44:09 +00:00
|
|
|
|
|
|
|
if (source->type == GTK_ICON_SOURCE_FILENAME)
|
|
|
|
return source->source.filename;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_icon_name:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Retrieves the source icon name, or %NULL if none is set. The
|
|
|
|
* icon_name is not a copy, and should not be modified or expected to
|
|
|
|
* persist beyond the lifetime of the icon source.
|
|
|
|
*
|
|
|
|
* Return value: icon name. This string must not be modified or freed.
|
|
|
|
**/
|
|
|
|
G_CONST_RETURN gchar*
|
|
|
|
gtk_icon_source_get_icon_name (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, NULL);
|
|
|
|
|
2005-11-04 15:43:40 +00:00
|
|
|
if (source->type == GTK_ICON_SOURCE_ICON_NAME ||
|
|
|
|
source->type == GTK_ICON_SOURCE_STATIC_ICON_NAME)
|
2003-07-02 22:44:09 +00:00
|
|
|
return source->source.icon_name;
|
|
|
|
else
|
|
|
|
return NULL;
|
2001-03-19 22:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_pixbuf:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Retrieves the source pixbuf, or %NULL if none is set.
|
2003-07-02 22:44:09 +00:00
|
|
|
* In addition, if a filename source is in use, this
|
|
|
|
* function in some cases will return the pixbuf from
|
|
|
|
* loaded from the filename. This is, for example, true
|
|
|
|
* for the GtkIconSource passed to the GtkStyle::render_icon()
|
|
|
|
* virtual function. The reference count on the pixbuf is
|
|
|
|
* not incremented.
|
2001-03-19 22:40:35 +00:00
|
|
|
*
|
|
|
|
* Return value: source pixbuf
|
|
|
|
**/
|
|
|
|
GdkPixbuf*
|
|
|
|
gtk_icon_source_get_pixbuf (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, NULL);
|
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
if (source->type == GTK_ICON_SOURCE_PIXBUF)
|
|
|
|
return source->source.pixbuf;
|
|
|
|
else if (source->type == GTK_ICON_SOURCE_FILENAME)
|
|
|
|
return source->filename_pixbuf;
|
|
|
|
else
|
|
|
|
return NULL;
|
2001-03-19 22:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_direction_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @setting: %TRUE to wildcard the text direction
|
|
|
|
*
|
|
|
|
* If the text direction is wildcarded, this source can be used
|
|
|
|
* as the base image for an icon in any #GtkTextDirection.
|
|
|
|
* If the text direction is not wildcarded, then the
|
|
|
|
* text direction the icon source applies to should be set
|
|
|
|
* with gtk_icon_source_set_direction(), and the icon source
|
|
|
|
* will only be used with that text direction.
|
|
|
|
*
|
|
|
|
* #GtkIconSet prefers non-wildcarded sources (exact matches) over
|
|
|
|
* wildcarded sources, and will use an exact match when possible.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_direction_wildcarded (GtkIconSource *source,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->any_direction = setting != FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_state_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @setting: %TRUE to wildcard the widget state
|
|
|
|
*
|
|
|
|
* If the widget state is wildcarded, this source can be used as the
|
|
|
|
* base image for an icon in any #GtkStateType. If the widget state
|
|
|
|
* is not wildcarded, then the state the source applies to should be
|
|
|
|
* set with gtk_icon_source_set_state() and the icon source will
|
|
|
|
* only be used with that specific state.
|
|
|
|
*
|
|
|
|
* #GtkIconSet prefers non-wildcarded sources (exact matches) over
|
|
|
|
* wildcarded sources, and will use an exact match when possible.
|
|
|
|
*
|
|
|
|
* #GtkIconSet will normally transform wildcarded source images to
|
|
|
|
* produce an appropriate icon for a given state, for example
|
|
|
|
* lightening an image on prelight, but will not modify source images
|
|
|
|
* that match exactly.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_state_wildcarded (GtkIconSource *source,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->any_state = setting != FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_size_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @setting: %TRUE to wildcard the widget state
|
|
|
|
*
|
|
|
|
* If the icon size is wildcarded, this source can be used as the base
|
|
|
|
* image for an icon of any size. If the size is not wildcarded, then
|
|
|
|
* the size the source applies to should be set with
|
|
|
|
* gtk_icon_source_set_size() and the icon source will only be used
|
|
|
|
* with that specific size.
|
|
|
|
*
|
|
|
|
* #GtkIconSet prefers non-wildcarded sources (exact matches) over
|
|
|
|
* wildcarded sources, and will use an exact match when possible.
|
|
|
|
*
|
|
|
|
* #GtkIconSet will normally scale wildcarded source images to produce
|
|
|
|
* an appropriate icon at a given size, but will not change the size
|
|
|
|
* of source images that match exactly.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_size_wildcarded (GtkIconSource *source,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->any_size = setting != FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_size_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Gets the value set by gtk_icon_source_set_size_wildcarded().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if this icon source is a base for any icon size variant
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_icon_source_get_size_wildcarded (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, TRUE);
|
|
|
|
|
|
|
|
return source->any_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_state_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Gets the value set by gtk_icon_source_set_state_wildcarded().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if this icon source is a base for any widget state variant
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_icon_source_get_state_wildcarded (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, TRUE);
|
|
|
|
|
|
|
|
return source->any_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_direction_wildcarded:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Gets the value set by gtk_icon_source_set_direction_wildcarded().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if this icon source is a base for any text direction variant
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, TRUE);
|
|
|
|
|
|
|
|
return source->any_direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_direction:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @direction: text direction this source applies to
|
|
|
|
*
|
|
|
|
* Sets the text direction this icon source is intended to be used
|
|
|
|
* with.
|
|
|
|
*
|
|
|
|
* Setting the text direction on an icon source makes no difference
|
|
|
|
* if the text direction is wildcarded. Therefore, you should usually
|
|
|
|
* call gtk_icon_source_set_direction_wildcarded() to un-wildcard it
|
|
|
|
* in addition to calling this function.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_direction (GtkIconSource *source,
|
|
|
|
GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->direction = direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_state:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @state: widget state this source applies to
|
|
|
|
*
|
|
|
|
* Sets the widget state this icon source is intended to be used
|
|
|
|
* with.
|
|
|
|
*
|
|
|
|
* Setting the widget state on an icon source makes no difference
|
|
|
|
* if the state is wildcarded. Therefore, you should usually
|
|
|
|
* call gtk_icon_source_set_state_wildcarded() to un-wildcard it
|
|
|
|
* in addition to calling this function.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_state (GtkIconSource *source,
|
|
|
|
GtkStateType state)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->state = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_set_size:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
* @size: icon size this source applies to
|
|
|
|
*
|
|
|
|
* Sets the icon size this icon source is intended to be used
|
|
|
|
* with.
|
|
|
|
*
|
|
|
|
* Setting the icon size on an icon source makes no difference
|
|
|
|
* if the size is wildcarded. Therefore, you should usually
|
|
|
|
* call gtk_icon_source_set_size_wildcarded() to un-wildcard it
|
|
|
|
* in addition to calling this function.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_size (GtkIconSource *source,
|
|
|
|
GtkIconSize size)
|
|
|
|
{
|
|
|
|
g_return_if_fail (source != NULL);
|
|
|
|
|
|
|
|
source->size = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_direction:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Obtains the text direction this icon source applies to. The return
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
* value is only useful/meaningful if the text direction is <emphasis>not</emphasis>
|
2001-03-19 22:40:35 +00:00
|
|
|
* wildcarded.
|
|
|
|
*
|
|
|
|
* Return value: text direction this source matches
|
|
|
|
**/
|
|
|
|
GtkTextDirection
|
|
|
|
gtk_icon_source_get_direction (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, 0);
|
|
|
|
|
|
|
|
return source->direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_state:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Obtains the widget state this icon source applies to. The return
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
* value is only useful/meaningful if the widget state is <emphasis>not</emphasis>
|
2001-03-19 22:40:35 +00:00
|
|
|
* wildcarded.
|
|
|
|
*
|
|
|
|
* Return value: widget state this source matches
|
|
|
|
**/
|
|
|
|
GtkStateType
|
|
|
|
gtk_icon_source_get_state (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, 0);
|
|
|
|
|
|
|
|
return source->state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_icon_source_get_size:
|
|
|
|
* @source: a #GtkIconSource
|
|
|
|
*
|
|
|
|
* Obtains the icon size this source applies to. The return value
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
* is only useful/meaningful if the icon size is <emphasis>not</emphasis> wildcarded.
|
2001-03-19 22:40:35 +00:00
|
|
|
*
|
|
|
|
* Return value: icon size this source matches.
|
|
|
|
**/
|
|
|
|
GtkIconSize
|
|
|
|
gtk_icon_source_get_size (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, 0);
|
|
|
|
|
|
|
|
return source->size;
|
|
|
|
}
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
#define NUM_CACHED_ICONS 8
|
|
|
|
|
|
|
|
typedef struct _CachedIcon CachedIcon;
|
|
|
|
|
|
|
|
struct _CachedIcon
|
|
|
|
{
|
|
|
|
/* These must all match to use the cached pixbuf.
|
|
|
|
* If any don't match, we must re-render the pixbuf.
|
|
|
|
*/
|
|
|
|
GtkStyle *style;
|
|
|
|
GtkTextDirection direction;
|
|
|
|
GtkStateType state;
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
ensure_cache_up_to_date (GtkIconSet *icon_set)
|
|
|
|
{
|
|
|
|
if (icon_set->cache_serial != cache_serial)
|
2003-07-02 22:44:09 +00:00
|
|
|
{
|
|
|
|
clear_cache (icon_set, TRUE);
|
|
|
|
icon_set->cache_serial = cache_serial;
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cached_icon_free (CachedIcon *icon)
|
|
|
|
{
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_unref (icon->pixbuf);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2003-09-03 20:05:04 +00:00
|
|
|
if (icon->style)
|
|
|
|
g_object_unref (icon->style);
|
|
|
|
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
g_free (icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbuf *
|
|
|
|
find_in_cache (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size)
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
|
|
|
GSList *tmp_list;
|
|
|
|
GSList *prev;
|
|
|
|
|
|
|
|
ensure_cache_up_to_date (icon_set);
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
tmp_list = icon_set->cache;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
CachedIcon *icon = tmp_list->data;
|
|
|
|
|
|
|
|
if (icon->style == style &&
|
|
|
|
icon->direction == direction &&
|
|
|
|
icon->state == state &&
|
2007-10-16 20:08:31 +00:00
|
|
|
(size == (GtkIconSize)-1 || icon->size == size))
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
{
|
|
|
|
if (prev)
|
|
|
|
{
|
|
|
|
/* Move this icon to the front of the list. */
|
|
|
|
prev->next = tmp_list->next;
|
|
|
|
tmp_list->next = icon_set->cache;
|
|
|
|
icon_set->cache = tmp_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
return icon->pixbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
prev = tmp_list;
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_to_cache (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkStateType state,
|
2001-03-12 18:46:53 +00:00
|
|
|
GtkIconSize size,
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GdkPixbuf *pixbuf)
|
|
|
|
{
|
|
|
|
CachedIcon *icon;
|
|
|
|
|
|
|
|
ensure_cache_up_to_date (icon_set);
|
2004-05-09 05:30:47 +00:00
|
|
|
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_ref (pixbuf);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
/* We have to ref the style, since if the style was finalized
|
|
|
|
* its address could be reused by another style, creating a
|
|
|
|
* really weird bug
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (style)
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_ref (style);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
icon = g_new (CachedIcon, 1);
|
|
|
|
icon_set->cache = g_slist_prepend (icon_set->cache, icon);
|
2004-05-09 05:30:47 +00:00
|
|
|
icon_set->cache_size++;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
icon->style = style;
|
|
|
|
icon->direction = direction;
|
|
|
|
icon->state = state;
|
2001-03-12 18:46:53 +00:00
|
|
|
icon->size = size;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
icon->pixbuf = pixbuf;
|
|
|
|
|
|
|
|
if (icon->style)
|
|
|
|
attach_to_style (icon_set, icon->style);
|
|
|
|
|
|
|
|
if (icon_set->cache_size >= NUM_CACHED_ICONS)
|
|
|
|
{
|
|
|
|
/* Remove oldest item in the cache */
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
|
|
|
tmp_list = icon_set->cache;
|
|
|
|
|
|
|
|
/* Find next-to-last link */
|
|
|
|
g_assert (NUM_CACHED_ICONS > 2);
|
|
|
|
while (tmp_list->next->next)
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
|
|
|
|
g_assert (tmp_list != NULL);
|
|
|
|
g_assert (tmp_list->next != NULL);
|
|
|
|
g_assert (tmp_list->next->next == NULL);
|
|
|
|
|
|
|
|
/* Free the last icon */
|
|
|
|
icon = tmp_list->next->data;
|
|
|
|
|
|
|
|
g_slist_free (tmp_list->next);
|
|
|
|
tmp_list->next = NULL;
|
|
|
|
|
|
|
|
cached_icon_free (icon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clear_cache (GtkIconSet *icon_set,
|
|
|
|
gboolean style_detach)
|
|
|
|
{
|
2004-06-26 05:08:36 +00:00
|
|
|
GSList *cache, *tmp_list;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
GtkStyle *last_style = NULL;
|
|
|
|
|
2004-06-26 05:08:36 +00:00
|
|
|
cache = icon_set->cache;
|
|
|
|
icon_set->cache = NULL;
|
|
|
|
icon_set->cache_size = 0;
|
|
|
|
tmp_list = cache;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
CachedIcon *icon = tmp_list->data;
|
|
|
|
|
|
|
|
if (style_detach)
|
|
|
|
{
|
|
|
|
/* simple optimization for the case where the cache
|
|
|
|
* contains contiguous icons from the same style.
|
|
|
|
* it's safe to call detach_from_style more than
|
|
|
|
* once on the same style though.
|
|
|
|
*/
|
|
|
|
if (last_style != icon->style)
|
|
|
|
{
|
|
|
|
detach_from_style (icon_set, icon->style);
|
|
|
|
last_style = icon->style;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cached_icon_free (icon);
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
2004-06-26 05:08:36 +00:00
|
|
|
g_slist_free (cache);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GSList*
|
|
|
|
copy_cache (GtkIconSet *icon_set,
|
|
|
|
GtkIconSet *copy_recipient)
|
|
|
|
{
|
|
|
|
GSList *tmp_list;
|
|
|
|
GSList *copy = NULL;
|
|
|
|
|
|
|
|
ensure_cache_up_to_date (icon_set);
|
|
|
|
|
|
|
|
tmp_list = icon_set->cache;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
CachedIcon *icon = tmp_list->data;
|
|
|
|
CachedIcon *icon_copy = g_new (CachedIcon, 1);
|
|
|
|
|
|
|
|
*icon_copy = *icon;
|
|
|
|
|
|
|
|
if (icon_copy->style)
|
2004-03-04 20:50:46 +00:00
|
|
|
{
|
|
|
|
attach_to_style (copy_recipient, icon_copy->style);
|
|
|
|
g_object_ref (icon_copy->style);
|
|
|
|
}
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2002-10-10 22:00:09 +00:00
|
|
|
g_object_ref (icon_copy->pixbuf);
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
2001-03-12 18:46:53 +00:00
|
|
|
icon_copy->size = icon->size;
|
Move more text widget headers into the private header list
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/Makefile.am (gtk_private_h_sources): Move more text widget
headers into the private header list
* Makefile.am (pkgconfig_DATA): install pkg-config files
* configure.in: add pkg-config files
* gdk-2.0.pc.in, gdk-pixbuf.pc.in, gtk+-2.0.pc.in: pkg-config files
* gtk/gtkwindow.c (gtk_window_read_rcfiles): Invalidate
outstanding icon caches on theme change.
* gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: New icon system. Three
important types:
(GtkIconSource): Specification for creating a pixbuf
appropriate for a direction/state/size triplet from
a source pixbuf or filename
(GtkIconSet): List of GtkIconSource objects that are used to
create the "same" icon (e.g. an OK button icon), and cache for
rendered icons
(GtkIconFactory): Hash from stock ID to GtkIconSet; used to look
up the icon set for a given stock ID. GTK maintains a stack of
GtkIconFactory to search, and applications or libraries can add
additional icon factories on top of the stack
* gtk/gtkrc.h, gtk/gtkrc.c: When loading an RcStyle, parse
the set of GtkIconSource specified for a given stock ID into
a GtkIconSet, and put the GtkIconSet into a GtkIconFactory for the
RcStyle, under the specified stock ID.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Add a virtual function
render_icon used to derive a GdkPixbuf from a GtkIconSource.
This allows people to theme how prelight, insensitive, etc. are
done.
(gtk_style_lookup_icon_set): Look up a stock ID in the list of
icon factories for a style, and return the resulting
icon set if any.
(gtk_style_render_icon): Render an icon using the render_icon
method in the GtkStyleClass.
* gtk/gtkwidget.h, gtk/gtkwidget.c (gtk_widget_render_icon):
Use the style for a given widget to look up a stock ID, get the
icon set, and render an icon using the render_icon method
of the style
* gtk/gtkstock.h, gtk/gtkstock.c: Header with the GtkStockItem type
(contains information about a stock item), the built-in stock item
IDs, and functions to add/lookup stock items.
* gtk/stock-icons/*: Stock icons that come with GTK
* gtk/gtkbutton.h, gtk/gtkbutton.c (gtk_button_new_stock): Returns
a button based on a GtkStockItem
(gtk_button_new_accel): Takes a uline string and accel group, and
installs the accelerator.
* gtk/gtkimage.h, gtk/gtkimage.c: Make this into a generic
image-display widget.
2000-09-26 20:22:17 +00:00
|
|
|
|
|
|
|
copy = g_slist_prepend (copy, icon_copy);
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_slist_reverse (copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
attach_to_style (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style)
|
|
|
|
{
|
|
|
|
GHashTable *table;
|
|
|
|
|
|
|
|
table = g_object_get_qdata (G_OBJECT (style),
|
|
|
|
g_quark_try_string ("gtk-style-icon-sets"));
|
|
|
|
|
|
|
|
if (table == NULL)
|
|
|
|
{
|
|
|
|
table = g_hash_table_new (NULL, NULL);
|
|
|
|
g_object_set_qdata_full (G_OBJECT (style),
|
|
|
|
g_quark_from_static_string ("gtk-style-icon-sets"),
|
|
|
|
table,
|
|
|
|
style_dnotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_insert (table, icon_set, icon_set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
detach_from_style (GtkIconSet *icon_set,
|
|
|
|
GtkStyle *style)
|
|
|
|
{
|
|
|
|
GHashTable *table;
|
|
|
|
|
|
|
|
table = g_object_get_qdata (G_OBJECT (style),
|
|
|
|
g_quark_try_string ("gtk-style-icon-sets"));
|
|
|
|
|
|
|
|
if (table != NULL)
|
|
|
|
g_hash_table_remove (table, icon_set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
iconsets_foreach (gpointer key,
|
|
|
|
gpointer value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkIconSet *icon_set = key;
|
|
|
|
|
|
|
|
/* We only need to remove cache entries for the given style;
|
|
|
|
* but that complicates things because in destroy notify
|
|
|
|
* we don't know which style got destroyed, and 95% of the
|
|
|
|
* time all cache entries will have the same style,
|
|
|
|
* so this is faster anyway.
|
|
|
|
*/
|
|
|
|
|
|
|
|
clear_cache (icon_set, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
style_dnotify (gpointer data)
|
|
|
|
{
|
|
|
|
GHashTable *table = data;
|
|
|
|
|
|
|
|
g_hash_table_foreach (table, iconsets_foreach, NULL);
|
|
|
|
|
|
|
|
g_hash_table_destroy (table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This allows the icon set to detect that its cache is out of date. */
|
|
|
|
void
|
|
|
|
_gtk_icon_set_invalidate_caches (void)
|
|
|
|
{
|
|
|
|
++cache_serial;
|
|
|
|
}
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* _gtk_icon_factory_list_ids:
|
|
|
|
*
|
|
|
|
* Gets all known IDs stored in an existing icon factory.
|
|
|
|
* The strings in the returned list aren't copied.
|
|
|
|
* The list itself should be freed.
|
|
|
|
*
|
|
|
|
* Return value: List of ids in icon factories
|
|
|
|
**/
|
2007-04-11 17:48:20 +00:00
|
|
|
GList*
|
2001-05-25 20:41:46 +00:00
|
|
|
_gtk_icon_factory_list_ids (void)
|
|
|
|
{
|
|
|
|
GSList *tmp_list;
|
2007-04-11 17:48:20 +00:00
|
|
|
GList *ids;
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
ids = NULL;
|
2001-05-25 22:08:53 +00:00
|
|
|
|
2005-01-03 14:44:33 +00:00
|
|
|
_gtk_icon_factory_ensure_default_icons ();
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
tmp_list = all_icon_factories;
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
2007-04-11 17:48:20 +00:00
|
|
|
GList *these_ids;
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
GtkIconFactory *factory = GTK_ICON_FACTORY (tmp_list->data);
|
|
|
|
|
|
|
|
these_ids = g_hash_table_get_keys (factory->icons);
|
|
|
|
|
2007-04-11 17:48:20 +00:00
|
|
|
ids = g_list_concat (ids, these_ids);
|
2001-05-25 20:41:46 +00:00
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ids;
|
|
|
|
}
|
2004-12-12 21:09:13 +00:00
|
|
|
|
2008-03-07 00:08:16 +00:00
|
|
|
typedef struct {
|
|
|
|
GSList *sources;
|
|
|
|
gboolean in_source;
|
|
|
|
|
|
|
|
} IconFactoryParserData;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
gchar *stock_id;
|
|
|
|
gchar *filename;
|
|
|
|
gchar *icon_name;
|
|
|
|
GtkTextDirection direction;
|
|
|
|
GtkIconSize size;
|
|
|
|
GtkStateType state;
|
|
|
|
} IconSourceParserData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_source_start_element (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
const gchar **names,
|
|
|
|
const gchar **values,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gchar *stock_id = NULL;
|
|
|
|
gchar *filename = NULL;
|
|
|
|
gchar *icon_name = NULL;
|
2008-03-07 20:03:35 +00:00
|
|
|
gint size = -1;
|
|
|
|
gint direction = -1;
|
|
|
|
gint state = -1;
|
2008-03-07 00:08:16 +00:00
|
|
|
IconFactoryParserData *parser_data;
|
|
|
|
IconSourceParserData *source_data;
|
2008-03-07 20:03:35 +00:00
|
|
|
gchar *error_msg;
|
|
|
|
GQuark error_domain;
|
|
|
|
|
2008-03-07 00:08:16 +00:00
|
|
|
parser_data = (IconFactoryParserData*)user_data;
|
|
|
|
|
|
|
|
if (!parser_data->in_source)
|
|
|
|
{
|
|
|
|
if (strcmp (element_name, "sources") != 0)
|
|
|
|
{
|
2008-03-07 20:03:35 +00:00
|
|
|
error_msg = g_strdup_printf ("Unexpected element %s, expected <sources>", element_name);
|
|
|
|
error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
|
|
|
|
goto error;
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
parser_data->in_source = TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (strcmp (element_name, "source") != 0)
|
|
|
|
{
|
2008-03-07 20:03:35 +00:00
|
|
|
error_msg = g_strdup_printf ("Unexpected element %s, expected <source>", element_name);
|
|
|
|
error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
|
|
|
|
goto error;
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; names[i]; i++)
|
|
|
|
{
|
|
|
|
if (strcmp (names[i], "stock-id") == 0)
|
|
|
|
stock_id = g_strdup (values[i]);
|
|
|
|
else if (strcmp (names[i], "filename") == 0)
|
|
|
|
filename = g_strdup (values[i]);
|
|
|
|
else if (strcmp (names[i], "icon-name") == 0)
|
|
|
|
icon_name = g_strdup (values[i]);
|
|
|
|
else if (strcmp (names[i], "size") == 0)
|
|
|
|
{
|
2008-03-07 20:03:35 +00:00
|
|
|
if (!_gtk_builder_enum_from_string (GTK_TYPE_ICON_SIZE,
|
|
|
|
values[i],
|
|
|
|
&size,
|
|
|
|
error))
|
2008-03-07 00:08:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (strcmp (names[i], "direction") == 0)
|
|
|
|
{
|
2008-03-07 20:03:35 +00:00
|
|
|
if (!_gtk_builder_enum_from_string (GTK_TYPE_TEXT_DIRECTION,
|
|
|
|
values[i],
|
|
|
|
&direction,
|
|
|
|
error))
|
2008-03-07 00:08:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (strcmp (names[i], "state") == 0)
|
|
|
|
{
|
2008-03-07 20:03:35 +00:00
|
|
|
if (!_gtk_builder_enum_from_string (GTK_TYPE_STATE_TYPE,
|
|
|
|
values[i],
|
|
|
|
&state,
|
|
|
|
error))
|
2008-03-07 00:08:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-03-07 20:03:35 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
error_msg = g_strdup_printf ("'%s' is not a valid attribute of <%s>",
|
|
|
|
names[i], "source");
|
|
|
|
error_domain = GTK_BUILDER_ERROR_INVALID_ATTRIBUTE;
|
|
|
|
goto error;
|
|
|
|
}
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
|
2008-05-24 23:19:01 +00:00
|
|
|
if (!stock_id)
|
2008-03-07 00:08:16 +00:00
|
|
|
{
|
2008-05-24 23:19:01 +00:00
|
|
|
error_msg = g_strdup_printf ("<source> requires a stock_id");
|
2008-03-07 20:03:35 +00:00
|
|
|
error_domain = GTK_BUILDER_ERROR_MISSING_ATTRIBUTE;
|
|
|
|
goto error;
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
source_data = g_slice_new (IconSourceParserData);
|
|
|
|
source_data->stock_id = stock_id;
|
|
|
|
source_data->filename = filename;
|
|
|
|
source_data->icon_name = icon_name;
|
|
|
|
source_data->size = size;
|
|
|
|
source_data->direction = direction;
|
|
|
|
source_data->state = state;
|
|
|
|
|
|
|
|
parser_data->sources = g_slist_prepend (parser_data->sources, source_data);
|
2008-03-07 20:03:35 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
|
|
|
gint line_number, char_number;
|
|
|
|
|
|
|
|
g_markup_parse_context_get_position (context,
|
|
|
|
&line_number,
|
|
|
|
&char_number);
|
|
|
|
|
|
|
|
tmp = g_strdup_printf ("%s:%d:%d %s", "input",
|
|
|
|
line_number, char_number, error_msg);
|
|
|
|
#if 0
|
2008-06-19 12:47:48 +00:00
|
|
|
g_set_error_literal (error,
|
2008-03-07 20:03:35 +00:00
|
|
|
GTK_BUILDER_ERROR,
|
|
|
|
error_domain,
|
|
|
|
tmp);
|
|
|
|
#else
|
|
|
|
g_warning (tmp);
|
|
|
|
#endif
|
|
|
|
g_free (tmp);
|
|
|
|
g_free (stock_id);
|
|
|
|
g_free (filename);
|
|
|
|
g_free (icon_name);
|
|
|
|
return;
|
|
|
|
}
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const GMarkupParser icon_source_parser =
|
|
|
|
{
|
|
|
|
icon_source_start_element,
|
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_icon_factory_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
GMarkupParser *parser,
|
|
|
|
gpointer *data)
|
|
|
|
{
|
|
|
|
g_assert (buildable);
|
|
|
|
|
|
|
|
if (strcmp (tagname, "sources") == 0)
|
|
|
|
{
|
|
|
|
IconFactoryParserData *parser_data;
|
|
|
|
|
|
|
|
parser_data = g_slice_new0 (IconFactoryParserData);
|
|
|
|
*parser = icon_source_parser;
|
|
|
|
*data = parser_data;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
gpointer *user_data)
|
|
|
|
{
|
|
|
|
GtkIconFactory *icon_factory;
|
|
|
|
|
|
|
|
icon_factory = GTK_ICON_FACTORY (buildable);
|
|
|
|
|
|
|
|
if (strcmp (tagname, "sources") == 0)
|
|
|
|
{
|
|
|
|
IconFactoryParserData *parser_data;
|
|
|
|
GtkIconSource *icon_source;
|
|
|
|
GtkIconSet *icon_set;
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
parser_data = (IconFactoryParserData*)user_data;
|
|
|
|
|
|
|
|
for (l = parser_data->sources; l; l = l->next)
|
|
|
|
{
|
|
|
|
IconSourceParserData *source_data = l->data;
|
|
|
|
|
|
|
|
icon_set = gtk_icon_factory_lookup (icon_factory, source_data->stock_id);
|
|
|
|
if (!icon_set)
|
|
|
|
{
|
|
|
|
icon_set = gtk_icon_set_new ();
|
|
|
|
gtk_icon_factory_add (icon_factory, source_data->stock_id, icon_set);
|
2008-03-07 20:03:35 +00:00
|
|
|
gtk_icon_set_unref (icon_set);
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
icon_source = gtk_icon_source_new ();
|
|
|
|
|
|
|
|
if (source_data->filename)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
|
|
|
filename = _gtk_builder_get_absolute_filename (builder, source_data->filename);
|
|
|
|
gtk_icon_source_set_filename (icon_source, filename);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
|
|
|
if (source_data->icon_name)
|
|
|
|
gtk_icon_source_set_icon_name (icon_source, source_data->icon_name);
|
|
|
|
if (source_data->size != -1)
|
2008-03-07 20:03:35 +00:00
|
|
|
{
|
|
|
|
gtk_icon_source_set_size (icon_source, source_data->size);
|
|
|
|
gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
|
|
|
|
}
|
2008-03-07 00:08:16 +00:00
|
|
|
if (source_data->direction != -1)
|
2008-03-07 20:03:35 +00:00
|
|
|
{
|
|
|
|
gtk_icon_source_set_direction (icon_source, source_data->direction);
|
|
|
|
gtk_icon_source_set_direction_wildcarded (icon_source, FALSE);
|
|
|
|
}
|
2008-03-07 00:08:16 +00:00
|
|
|
if (source_data->state != -1)
|
2008-03-07 20:03:35 +00:00
|
|
|
{
|
|
|
|
gtk_icon_source_set_state (icon_source, source_data->state);
|
|
|
|
gtk_icon_source_set_state_wildcarded (icon_source, FALSE);
|
|
|
|
}
|
2008-03-07 00:08:16 +00:00
|
|
|
|
|
|
|
/* Inline source_add() to avoid creating a copy */
|
2008-03-07 11:13:47 +00:00
|
|
|
g_assert (icon_source->type != GTK_ICON_SOURCE_EMPTY);
|
2008-03-07 00:08:16 +00:00
|
|
|
icon_set->sources = g_slist_insert_sorted (icon_set->sources,
|
|
|
|
icon_source,
|
|
|
|
icon_source_compare);
|
|
|
|
|
|
|
|
g_free (source_data->stock_id);
|
|
|
|
g_free (source_data->filename);
|
|
|
|
g_free (source_data->icon_name);
|
|
|
|
g_slice_free (IconSourceParserData, source_data);
|
|
|
|
}
|
|
|
|
g_slist_free (parser_data->sources);
|
|
|
|
g_slice_free (IconFactoryParserData, parser_data);
|
2008-03-07 20:03:35 +00:00
|
|
|
|
|
|
|
/* TODO: Add an attribute/tag to prevent this.
|
|
|
|
* Usually it's the right thing to do though.
|
|
|
|
*/
|
|
|
|
gtk_icon_factory_add_default (icon_factory);
|
2008-03-07 00:08:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
|
|
|
/* DLL ABI stability backward compatibility versions */
|
|
|
|
|
|
|
|
#undef gtk_icon_source_set_filename
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_icon_source_set_filename (GtkIconSource *source,
|
|
|
|
const gchar *filename)
|
|
|
|
{
|
|
|
|
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
gtk_icon_source_set_filename_utf8 (source, utf8_filename);
|
|
|
|
|
|
|
|
g_free (utf8_filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef gtk_icon_source_get_filename
|
|
|
|
|
|
|
|
G_CONST_RETURN gchar*
|
|
|
|
gtk_icon_source_get_filename (const GtkIconSource *source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (source != NULL, NULL);
|
|
|
|
|
|
|
|
if (source->type == GTK_ICON_SOURCE_FILENAME)
|
|
|
|
return source->cp_filename;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2005-03-20 07:01:23 +00:00
|
|
|
|
|
|
|
#define __GTK_ICON_FACTORY_C__
|
|
|
|
#include "gtkaliasdef.c"
|