1 /* GtkIconTheme - a loader for icon themes
2 * gtk-icon-loader.h Copyright (C) 2002, 2003 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GTK_ICON_THEME_H__
21 #define __GTK_ICON_THEME_H__
23 #include <glib-object.h>
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25 #include <gdk/gdkscreen.h>
29 #define GTK_TYPE_ICON_INFO (gtk_icon_info_get_type ())
31 #define GTK_TYPE_ICON_THEME (gtk_icon_theme_get_type ())
32 #define GTK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
33 #define GTK_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
34 #define GTK_IS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
35 #define GTK_IS_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_THEME))
36 #define GTK_ICON_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
38 typedef struct _GtkIconInfo GtkIconInfo;
39 typedef struct _GtkIconTheme GtkIconTheme;
40 typedef struct _GtkIconThemeClass GtkIconThemeClass;
41 typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
46 GObject parent_instance;
48 GtkIconThemePrivate *priv;
51 struct _GtkIconThemeClass
53 GObjectClass parent_class;
55 void (* changed) (GtkIconTheme *icon_theme);
60 * @GTK_ICON_LOOKUP_NO_SVG: Never return SVG icons, even if gdk-pixbuf
61 * supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
62 * @GTK_ICON_LOOKUP_FORCE_SVG: Return SVG icons, even if gdk-pixbuf
63 * doesn't support them.
64 * Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
65 * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to
66 * gtk_icon_theme_lookup_icon() includes builtin icons
67 * as well as files. For a builtin icon, gtk_icon_info_get_filename()
68 * returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
69 * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
70 * characters before looking at inherited themes.
72 * Used to specify options for gtk_icon_theme_lookup_icon()
76 GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
77 GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
78 GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2,
79 GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3
82 #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
86 * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
87 * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
89 * Error codes for GtkIconTheme operations.
92 GTK_ICON_THEME_NOT_FOUND,
96 GQuark gtk_icon_theme_error_quark (void);
99 /* Reserve old name for DLL ABI backward compatibility */
100 #define gtk_icon_theme_set_search_path gtk_icon_theme_set_search_path_utf8
101 #define gtk_icon_theme_get_search_path gtk_icon_theme_get_search_path_utf8
102 #define gtk_icon_theme_append_search_path gtk_icon_theme_append_search_path_utf8
103 #define gtk_icon_theme_prepend_search_path gtk_icon_theme_prepend_search_path_utf8
104 #define gtk_icon_info_get_filename gtk_icon_info_get_filename_utf8
107 GType gtk_icon_theme_get_type (void) G_GNUC_CONST;
109 GtkIconTheme *gtk_icon_theme_new (void);
110 GtkIconTheme *gtk_icon_theme_get_default (void);
111 GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen);
112 void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
115 void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
118 void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme,
121 void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
123 void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
126 void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
127 const gchar *theme_name);
129 gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
130 const gchar *icon_name);
131 gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
132 const gchar *icon_name);
133 GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
134 const gchar *icon_name,
136 GtkIconLookupFlags flags);
137 GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
138 const gchar *icon_name,
140 GtkIconLookupFlags flags,
143 GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme,
144 const gchar *context);
145 GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme);
146 char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
148 gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme);
150 void gtk_icon_theme_add_builtin_icon (const gchar *icon_name,
154 GType gtk_icon_info_get_type (void) G_GNUC_CONST;
155 GtkIconInfo *gtk_icon_info_copy (GtkIconInfo *icon_info);
156 void gtk_icon_info_free (GtkIconInfo *icon_info);
158 gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
159 G_CONST_RETURN gchar *gtk_icon_info_get_filename (GtkIconInfo *icon_info);
160 GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
161 GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
164 void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info,
165 gboolean raw_coordinates);
167 gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info,
168 GdkRectangle *rectangle);
169 gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info,
172 G_CONST_RETURN gchar *gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
174 /* Non-public methods */
175 void _gtk_icon_theme_check_reload (GdkDisplay *display);
176 void _gtk_icon_theme_ensure_builtin_cache (void);
180 #endif /* __GTK_ICON_THEME_H__ */