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, see <http://www.gnu.org/licenses/>.
18 #ifndef __GTK_ICON_THEME_H__
19 #define __GTK_ICON_THEME_H__
21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #include <gdk-pixbuf/gdk-pixbuf.h>
27 #include <gtk/gtkstylecontext.h>
31 #define GTK_TYPE_ICON_INFO (gtk_icon_info_get_type ())
32 #define GTK_ICON_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_INFO, GtkIconInfo))
33 #define GTK_ICON_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_INFO, GtkIconInfoClass))
34 #define GTK_IS_ICON_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_INFO))
35 #define GTK_IS_ICON_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_INFO))
36 #define GTK_ICON_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_INFO, GtkIconInfoClass))
38 #define GTK_TYPE_ICON_THEME (gtk_icon_theme_get_type ())
39 #define GTK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
40 #define GTK_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
41 #define GTK_IS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
42 #define GTK_IS_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_THEME))
43 #define GTK_ICON_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
48 * Contains information found when looking up an icon in
51 typedef struct _GtkIconInfo GtkIconInfo;
52 typedef struct _GtkIconInfoClass GtkIconInfoClass;
53 typedef struct _GtkIconTheme GtkIconTheme;
54 typedef struct _GtkIconThemeClass GtkIconThemeClass;
55 typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
60 * Acts as a database of information about an icon theme.
61 * Normally, you retrieve the icon theme for a particular
62 * screen using gtk_icon_theme_get_for_screen() and it
63 * will contain information about current icon theme for
64 * that screen, but you can also create a new #GtkIconTheme
65 * object and set the icon theme name explicitely using
66 * gtk_icon_theme_set_custom_theme().
71 GObject parent_instance;
73 GtkIconThemePrivate *priv;
76 struct _GtkIconThemeClass
78 GObjectClass parent_class;
80 void (* changed) (GtkIconTheme *icon_theme);
82 /* Padding for future expansion */
83 void (*_gtk_reserved1) (void);
84 void (*_gtk_reserved2) (void);
85 void (*_gtk_reserved3) (void);
86 void (*_gtk_reserved4) (void);
91 * @GTK_ICON_LOOKUP_NO_SVG: Never return SVG icons, even if gdk-pixbuf
92 * supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
93 * @GTK_ICON_LOOKUP_FORCE_SVG: Return SVG icons, even if gdk-pixbuf
94 * doesn't support them.
95 * Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
96 * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to
97 * gtk_icon_theme_lookup_icon() includes builtin icons
98 * as well as files. For a builtin icon, gtk_icon_info_get_filename()
99 * returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
100 * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
101 * characters before looking at inherited themes. For more general
102 * fallback, see gtk_icon_theme_choose_icon(). Since 2.12.
103 * @GTK_ICON_LOOKUP_FORCE_SIZE: Always return the icon scaled to the
104 * requested size. Since 2.14.
106 * Used to specify options for gtk_icon_theme_lookup_icon()
110 GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
111 GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
112 GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2,
113 GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
114 GTK_ICON_LOOKUP_FORCE_SIZE = 1 << 4
115 } GtkIconLookupFlags;
118 * GTK_ICON_THEME_ERROR:
120 * The #GQuark used for #GtkIconThemeError errors.
122 #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
126 * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
127 * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
129 * Error codes for GtkIconTheme operations.
132 GTK_ICON_THEME_NOT_FOUND,
133 GTK_ICON_THEME_FAILED
136 GQuark gtk_icon_theme_error_quark (void);
138 GType gtk_icon_theme_get_type (void) G_GNUC_CONST;
140 GtkIconTheme *gtk_icon_theme_new (void);
141 GtkIconTheme *gtk_icon_theme_get_default (void);
142 GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen);
143 void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
146 void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
149 void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme,
152 void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
154 void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
157 void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
158 const gchar *theme_name);
160 gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
161 const gchar *icon_name);
162 gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
163 const gchar *icon_name);
164 GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
165 const gchar *icon_name,
167 GtkIconLookupFlags flags);
168 GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme,
169 const gchar *icon_names[],
171 GtkIconLookupFlags flags);
172 GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
173 const gchar *icon_name,
175 GtkIconLookupFlags flags,
178 GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme,
181 GtkIconLookupFlags flags);
183 GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme,
184 const gchar *context);
185 GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme);
186 char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
188 gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme);
190 void gtk_icon_theme_add_builtin_icon (const gchar *icon_name,
194 GType gtk_icon_info_get_type (void) G_GNUC_CONST;
195 GDK_DEPRECATED_IN_3_8_FOR(g_object_ref)
196 GtkIconInfo * gtk_icon_info_copy (GtkIconInfo *icon_info);
197 GDK_DEPRECATED_IN_3_8_FOR(g_object_unref)
198 void gtk_icon_info_free (GtkIconInfo *icon_info);
200 GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme,
203 gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
204 const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
205 GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
206 GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
209 void gtk_icon_info_load_icon_async (GtkIconInfo *icon_info,
210 GCancellable *cancellable,
211 GAsyncReadyCallback callback,
214 GdkPixbuf * gtk_icon_info_load_icon_finish (GtkIconInfo *icon_info,
217 GdkPixbuf * gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
219 const GdkRGBA *success_color,
220 const GdkRGBA *warning_color,
221 const GdkRGBA *error_color,
222 gboolean *was_symbolic,
225 void gtk_icon_info_load_symbolic_async (GtkIconInfo *icon_info,
227 const GdkRGBA *success_color,
228 const GdkRGBA *warning_color,
229 const GdkRGBA *error_color,
230 GCancellable *cancellable,
231 GAsyncReadyCallback callback,
234 GdkPixbuf * gtk_icon_info_load_symbolic_finish (GtkIconInfo *icon_info,
236 gboolean *was_symbolic,
238 GdkPixbuf * gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
239 GtkStyleContext *context,
240 gboolean *was_symbolic,
243 void gtk_icon_info_load_symbolic_for_context_async (GtkIconInfo *icon_info,
244 GtkStyleContext *context,
245 GCancellable *cancellable,
246 GAsyncReadyCallback callback,
249 GdkPixbuf * gtk_icon_info_load_symbolic_for_context_finish (GtkIconInfo *icon_info,
251 gboolean *was_symbolic,
253 GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_info_load_symbol_for_context)
254 GdkPixbuf * gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
257 gboolean *was_symbolic,
259 void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info,
260 gboolean raw_coordinates);
262 gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info,
263 GdkRectangle *rectangle);
264 gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info,
267 const gchar * gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
269 /* Non-public methods */
270 void _gtk_icon_theme_check_reload (GdkDisplay *display);
271 void _gtk_icon_theme_ensure_builtin_cache (void);
275 #endif /* __GTK_ICON_THEME_H__ */