1/* GtkIconTheme - a loader for icon themes
2 * gtk-icon-loader.h Copyright (C) 2002, 2003 Red Hat, Inc.
3 *
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.
8 *
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.
13 *
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/>.
16 */
17
18#ifndef __GTK_ICON_THEME_H__
19#define __GTK_ICON_THEME_H__
20
21#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gtk/gtk.h> can be included directly."
23#endif
24
25#include <gdk-pixbuf/gdk-pixbuf.h>
26#include <gdk/gdk.h>
27#include <gtk/gtkstylecontext.h>
28
29G_BEGIN_DECLS
30
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))
37
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))
44
45/**
46 * GtkIconInfo:
47 *
48 * Contains information found when looking up an icon in
49 * an icon theme.
50 */
51typedef struct _GtkIconInfo GtkIconInfo;
52typedef struct _GtkIconInfoClass GtkIconInfoClass;
53typedef struct _GtkIconTheme GtkIconTheme;
54typedef struct _GtkIconThemeClass GtkIconThemeClass;
55typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
56
57/**
58 * GtkIconTheme:
59 *
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 explicitly using
66 * gtk_icon_theme_set_custom_theme().
67 */
68struct _GtkIconTheme
69{
70 /*< private >*/
71 GObject parent_instance;
72
73 GtkIconThemePrivate *priv;
74};
75
76/**
77 * GtkIconThemeClass:
78 * @parent_class: The parent class.
79 * @changed: Signal emitted when the current icon theme is switched or
80 * GTK+ detects that a change has occurred in the contents of the
81 * current icon theme.
82 */
83struct _GtkIconThemeClass
84{
85 GObjectClass parent_class;
86
87 /*< public >*/
88
89 void (* changed) (GtkIconTheme *icon_theme);
90
91 /*< private >*/
92
93 /* Padding for future expansion */
94 void (*_gtk_reserved1) (void);
95 void (*_gtk_reserved2) (void);
96 void (*_gtk_reserved3) (void);
97 void (*_gtk_reserved4) (void);
98};
99
100/**
101 * GtkIconLookupFlags:
102 * @GTK_ICON_LOOKUP_NO_SVG: Never get SVG icons, even if gdk-pixbuf
103 * supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
104 * @GTK_ICON_LOOKUP_FORCE_SVG: Get SVG icons, even if gdk-pixbuf
105 * doesn’t support them.
106 * Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
107 * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to
108 * gtk_icon_theme_lookup_icon() includes builtin icons
109 * as well as files. For a builtin icon, gtk_icon_info_get_filename()
110 * is %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
111 * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
112 * characters before looking at inherited themes. This flag is only
113 * supported in functions that take a single icon name. For more general
114 * fallback, see gtk_icon_theme_choose_icon(). Since 2.12.
115 * @GTK_ICON_LOOKUP_FORCE_SIZE: Always get the icon scaled to the
116 * requested size. Since 2.14.
117 * @GTK_ICON_LOOKUP_FORCE_REGULAR: Try to always load regular icons, even
118 * when symbolic icon names are given. Since 3.14.
119 * @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Try to always load symbolic icons, even
120 * when regular icon names are given. Since 3.14.
121 * @GTK_ICON_LOOKUP_DIR_LTR: Try to load a variant of the icon for left-to-right
122 * text direction. Since 3.14.
123 * @GTK_ICON_LOOKUP_DIR_RTL: Try to load a variant of the icon for right-to-left
124 * text direction. Since 3.14.
125 *
126 * Used to specify options for gtk_icon_theme_lookup_icon()
127 */
128typedef enum
129{
130 GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
131 GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
132 GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2,
133 GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
134 GTK_ICON_LOOKUP_FORCE_SIZE = 1 << 4,
135 GTK_ICON_LOOKUP_FORCE_REGULAR = 1 << 5,
136 GTK_ICON_LOOKUP_FORCE_SYMBOLIC = 1 << 6,
137 GTK_ICON_LOOKUP_DIR_LTR = 1 << 7,
138 GTK_ICON_LOOKUP_DIR_RTL = 1 << 8
139} GtkIconLookupFlags;
140
141/**
142 * GTK_ICON_THEME_ERROR:
143 *
144 * The #GQuark used for #GtkIconThemeError errors.
145 */
146#define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
147
148/**
149 * GtkIconThemeError:
150 * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
151 * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
152 *
153 * Error codes for GtkIconTheme operations.
154 **/
155typedef enum {
156 GTK_ICON_THEME_NOT_FOUND,
157 GTK_ICON_THEME_FAILED
158} GtkIconThemeError;
159
160GDK_AVAILABLE_IN_ALL
161GQuark gtk_icon_theme_error_quark (void);
162
163GDK_AVAILABLE_IN_ALL
164GType gtk_icon_theme_get_type (void) G_GNUC_CONST;
165
166GDK_AVAILABLE_IN_ALL
167GtkIconTheme *gtk_icon_theme_new (void);
168GDK_AVAILABLE_IN_ALL
169GtkIconTheme *gtk_icon_theme_get_default (void);
170GDK_AVAILABLE_IN_ALL
171GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen);
172GDK_AVAILABLE_IN_ALL
173void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
174 GdkScreen *screen);
175
176GDK_AVAILABLE_IN_ALL
177void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
178 const gchar *path[],
179 gint n_elements);
180GDK_AVAILABLE_IN_ALL
181void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme,
182 gchar **path[],
183 gint *n_elements);
184GDK_AVAILABLE_IN_ALL
185void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
186 const gchar *path);
187GDK_AVAILABLE_IN_ALL
188void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
189 const gchar *path);
190
191GDK_AVAILABLE_IN_3_14
192void gtk_icon_theme_add_resource_path (GtkIconTheme *icon_theme,
193 const gchar *path);
194
195GDK_AVAILABLE_IN_ALL
196void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
197 const gchar *theme_name);
198
199GDK_AVAILABLE_IN_ALL
200gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
201 const gchar *icon_name);
202GDK_AVAILABLE_IN_ALL
203gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
204 const gchar *icon_name);
205GDK_AVAILABLE_IN_ALL
206GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
207 const gchar *icon_name,
208 gint size,
209 GtkIconLookupFlags flags);
210GDK_AVAILABLE_IN_3_10
211GtkIconInfo * gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme,
212 const gchar *icon_name,
213 gint size,
214 gint scale,
215 GtkIconLookupFlags flags);
216
217GDK_AVAILABLE_IN_ALL
218GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme,
219 const gchar *icon_names[],
220 gint size,
221 GtkIconLookupFlags flags);
222GDK_AVAILABLE_IN_3_10
223GtkIconInfo * gtk_icon_theme_choose_icon_for_scale (GtkIconTheme *icon_theme,
224 const gchar *icon_names[],
225 gint size,
226 gint scale,
227 GtkIconLookupFlags flags);
228GDK_AVAILABLE_IN_ALL
229GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme,
230 const gchar *icon_name,
231 gint size,
232 GtkIconLookupFlags flags,
233 GError **error);
234GDK_AVAILABLE_IN_3_10
235GdkPixbuf * gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
236 const gchar *icon_name,
237 gint size,
238 gint scale,
239 GtkIconLookupFlags flags,
240 GError **error);
241GDK_AVAILABLE_IN_3_10
242cairo_surface_t * gtk_icon_theme_load_surface (GtkIconTheme *icon_theme,
243 const gchar *icon_name,
244 gint size,
245 gint scale,
246 GdkWindow *for_window,
247 GtkIconLookupFlags flags,
248 GError **error);
249
250GDK_AVAILABLE_IN_ALL
251GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme,
252 GIcon *icon,
253 gint size,
254 GtkIconLookupFlags flags);
255GDK_AVAILABLE_IN_3_10
256GtkIconInfo * gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
257 GIcon *icon,
258 gint size,
259 gint scale,
260 GtkIconLookupFlags flags);
261
262
263GDK_AVAILABLE_IN_ALL
264GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme,
265 const gchar *context);
266GDK_AVAILABLE_IN_ALL
267GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme);
268GDK_AVAILABLE_IN_ALL
269char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
270
271GDK_AVAILABLE_IN_ALL
272gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme);
273
274GDK_DEPRECATED_IN_3_14_FOR(gtk_icon_theme_add_resource_path)
275void gtk_icon_theme_add_builtin_icon (const gchar *icon_name,
276 gint size,
277 GdkPixbuf *pixbuf);
278
279GDK_AVAILABLE_IN_ALL
280GType gtk_icon_info_get_type (void) G_GNUC_CONST;
281GDK_DEPRECATED_IN_3_8_FOR(g_object_ref)
282GtkIconInfo * gtk_icon_info_copy (GtkIconInfo *icon_info);
283GDK_DEPRECATED_IN_3_8_FOR(g_object_unref)
284void gtk_icon_info_free (GtkIconInfo *icon_info);
285
286GDK_AVAILABLE_IN_ALL
287GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme,
288 GdkPixbuf *pixbuf);
289
290GDK_AVAILABLE_IN_ALL
291gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
292GDK_AVAILABLE_IN_3_10
293gint gtk_icon_info_get_base_scale (GtkIconInfo *icon_info);
294GDK_AVAILABLE_IN_ALL
295const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info);
296GDK_DEPRECATED_IN_3_14
297GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
298GDK_AVAILABLE_IN_3_12
299gboolean gtk_icon_info_is_symbolic (GtkIconInfo *icon_info);
300GDK_AVAILABLE_IN_ALL
301GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
302 GError **error);
303GDK_AVAILABLE_IN_3_10
304cairo_surface_t * gtk_icon_info_load_surface (GtkIconInfo *icon_info,
305 GdkWindow *for_window,
306 GError **error);
307GDK_AVAILABLE_IN_3_8
308void gtk_icon_info_load_icon_async (GtkIconInfo *icon_info,
309 GCancellable *cancellable,
310 GAsyncReadyCallback callback,
311 gpointer user_data);
312GDK_AVAILABLE_IN_3_8
313GdkPixbuf * gtk_icon_info_load_icon_finish (GtkIconInfo *icon_info,
314 GAsyncResult *res,
315 GError **error);
316GDK_AVAILABLE_IN_ALL
317GdkPixbuf * gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
318 const GdkRGBA *fg,
319 const GdkRGBA *success_color,
320 const GdkRGBA *warning_color,
321 const GdkRGBA *error_color,
322 gboolean *was_symbolic,
323 GError **error);
324GDK_AVAILABLE_IN_3_8
325void gtk_icon_info_load_symbolic_async (GtkIconInfo *icon_info,
326 const GdkRGBA *fg,
327 const GdkRGBA *success_color,
328 const GdkRGBA *warning_color,
329 const GdkRGBA *error_color,
330 GCancellable *cancellable,
331 GAsyncReadyCallback callback,
332 gpointer user_data);
333GDK_AVAILABLE_IN_3_8
334GdkPixbuf * gtk_icon_info_load_symbolic_finish (GtkIconInfo *icon_info,
335 GAsyncResult *res,
336 gboolean *was_symbolic,
337 GError **error);
338GDK_AVAILABLE_IN_ALL
339GdkPixbuf * gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
340 GtkStyleContext *context,
341 gboolean *was_symbolic,
342 GError **error);
343GDK_AVAILABLE_IN_3_8
344void gtk_icon_info_load_symbolic_for_context_async (GtkIconInfo *icon_info,
345 GtkStyleContext *context,
346 GCancellable *cancellable,
347 GAsyncReadyCallback callback,
348 gpointer user_data);
349GDK_AVAILABLE_IN_3_8
350GdkPixbuf * gtk_icon_info_load_symbolic_for_context_finish (GtkIconInfo *icon_info,
351 GAsyncResult *res,
352 gboolean *was_symbolic,
353 GError **error);
354GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_info_load_symbol_for_context)
355GdkPixbuf * gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
356 GtkStyle *style,
357 GtkStateType state,
358 gboolean *was_symbolic,
359 GError **error);
360GDK_DEPRECATED_IN_3_14
361void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info,
362 gboolean raw_coordinates);
363
364GDK_DEPRECATED_IN_3_14
365gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info,
366 GdkRectangle *rectangle);
367GDK_DEPRECATED_IN_3_14
368gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info,
369 GdkPoint **points,
370 gint *n_points);
371GDK_DEPRECATED_IN_3_14
372const gchar * gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
373
374G_END_DECLS
375
376#endif /* __GTK_ICON_THEME_H__ */
377

source code of include/gtk-3.0/gtk/gtkicontheme.h