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 | |
29 | G_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 | */ |
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; |
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 | */ |
68 | struct _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 | */ |
83 | struct _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 | */ |
128 | typedef 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 | **/ |
155 | typedef enum { |
156 | GTK_ICON_THEME_NOT_FOUND, |
157 | GTK_ICON_THEME_FAILED |
158 | } GtkIconThemeError; |
159 | |
160 | GDK_AVAILABLE_IN_ALL |
161 | GQuark gtk_icon_theme_error_quark (void); |
162 | |
163 | GDK_AVAILABLE_IN_ALL |
164 | GType gtk_icon_theme_get_type (void) G_GNUC_CONST; |
165 | |
166 | GDK_AVAILABLE_IN_ALL |
167 | GtkIconTheme *gtk_icon_theme_new (void); |
168 | GDK_AVAILABLE_IN_ALL |
169 | GtkIconTheme *gtk_icon_theme_get_default (void); |
170 | GDK_AVAILABLE_IN_ALL |
171 | GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen); |
172 | GDK_AVAILABLE_IN_ALL |
173 | void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme, |
174 | GdkScreen *screen); |
175 | |
176 | GDK_AVAILABLE_IN_ALL |
177 | void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme, |
178 | const gchar *path[], |
179 | gint n_elements); |
180 | GDK_AVAILABLE_IN_ALL |
181 | void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme, |
182 | gchar **path[], |
183 | gint *n_elements); |
184 | GDK_AVAILABLE_IN_ALL |
185 | void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme, |
186 | const gchar *path); |
187 | GDK_AVAILABLE_IN_ALL |
188 | void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme, |
189 | const gchar *path); |
190 | |
191 | GDK_AVAILABLE_IN_3_14 |
192 | void gtk_icon_theme_add_resource_path (GtkIconTheme *icon_theme, |
193 | const gchar *path); |
194 | |
195 | GDK_AVAILABLE_IN_ALL |
196 | void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme, |
197 | const gchar *theme_name); |
198 | |
199 | GDK_AVAILABLE_IN_ALL |
200 | gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme, |
201 | const gchar *icon_name); |
202 | GDK_AVAILABLE_IN_ALL |
203 | gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme, |
204 | const gchar *icon_name); |
205 | GDK_AVAILABLE_IN_ALL |
206 | GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme, |
207 | const gchar *icon_name, |
208 | gint size, |
209 | GtkIconLookupFlags flags); |
210 | GDK_AVAILABLE_IN_3_10 |
211 | GtkIconInfo * 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 | |
217 | GDK_AVAILABLE_IN_ALL |
218 | GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme, |
219 | const gchar *icon_names[], |
220 | gint size, |
221 | GtkIconLookupFlags flags); |
222 | GDK_AVAILABLE_IN_3_10 |
223 | GtkIconInfo * gtk_icon_theme_choose_icon_for_scale (GtkIconTheme *icon_theme, |
224 | const gchar *icon_names[], |
225 | gint size, |
226 | gint scale, |
227 | GtkIconLookupFlags flags); |
228 | GDK_AVAILABLE_IN_ALL |
229 | GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme, |
230 | const gchar *icon_name, |
231 | gint size, |
232 | GtkIconLookupFlags flags, |
233 | GError **error); |
234 | GDK_AVAILABLE_IN_3_10 |
235 | GdkPixbuf * 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); |
241 | GDK_AVAILABLE_IN_3_10 |
242 | cairo_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 | |
250 | GDK_AVAILABLE_IN_ALL |
251 | GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme, |
252 | GIcon *icon, |
253 | gint size, |
254 | GtkIconLookupFlags flags); |
255 | GDK_AVAILABLE_IN_3_10 |
256 | GtkIconInfo * 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 | |
263 | GDK_AVAILABLE_IN_ALL |
264 | GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme, |
265 | const gchar *context); |
266 | GDK_AVAILABLE_IN_ALL |
267 | GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme); |
268 | GDK_AVAILABLE_IN_ALL |
269 | char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme); |
270 | |
271 | GDK_AVAILABLE_IN_ALL |
272 | gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme); |
273 | |
274 | GDK_DEPRECATED_IN_3_14_FOR(gtk_icon_theme_add_resource_path) |
275 | void gtk_icon_theme_add_builtin_icon (const gchar *icon_name, |
276 | gint size, |
277 | GdkPixbuf *pixbuf); |
278 | |
279 | GDK_AVAILABLE_IN_ALL |
280 | GType gtk_icon_info_get_type (void) G_GNUC_CONST; |
281 | GDK_DEPRECATED_IN_3_8_FOR(g_object_ref) |
282 | GtkIconInfo * gtk_icon_info_copy (GtkIconInfo *icon_info); |
283 | GDK_DEPRECATED_IN_3_8_FOR(g_object_unref) |
284 | void gtk_icon_info_free (GtkIconInfo *icon_info); |
285 | |
286 | GDK_AVAILABLE_IN_ALL |
287 | GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme, |
288 | GdkPixbuf *pixbuf); |
289 | |
290 | GDK_AVAILABLE_IN_ALL |
291 | gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info); |
292 | GDK_AVAILABLE_IN_3_10 |
293 | gint gtk_icon_info_get_base_scale (GtkIconInfo *icon_info); |
294 | GDK_AVAILABLE_IN_ALL |
295 | const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info); |
296 | GDK_DEPRECATED_IN_3_14 |
297 | GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info); |
298 | GDK_AVAILABLE_IN_3_12 |
299 | gboolean gtk_icon_info_is_symbolic (GtkIconInfo *icon_info); |
300 | GDK_AVAILABLE_IN_ALL |
301 | GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info, |
302 | GError **error); |
303 | GDK_AVAILABLE_IN_3_10 |
304 | cairo_surface_t * gtk_icon_info_load_surface (GtkIconInfo *icon_info, |
305 | GdkWindow *for_window, |
306 | GError **error); |
307 | GDK_AVAILABLE_IN_3_8 |
308 | void gtk_icon_info_load_icon_async (GtkIconInfo *icon_info, |
309 | GCancellable *cancellable, |
310 | GAsyncReadyCallback callback, |
311 | gpointer user_data); |
312 | GDK_AVAILABLE_IN_3_8 |
313 | GdkPixbuf * gtk_icon_info_load_icon_finish (GtkIconInfo *icon_info, |
314 | GAsyncResult *res, |
315 | GError **error); |
316 | GDK_AVAILABLE_IN_ALL |
317 | GdkPixbuf * 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); |
324 | GDK_AVAILABLE_IN_3_8 |
325 | void 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); |
333 | GDK_AVAILABLE_IN_3_8 |
334 | GdkPixbuf * gtk_icon_info_load_symbolic_finish (GtkIconInfo *icon_info, |
335 | GAsyncResult *res, |
336 | gboolean *was_symbolic, |
337 | GError **error); |
338 | GDK_AVAILABLE_IN_ALL |
339 | GdkPixbuf * gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info, |
340 | GtkStyleContext *context, |
341 | gboolean *was_symbolic, |
342 | GError **error); |
343 | GDK_AVAILABLE_IN_3_8 |
344 | void gtk_icon_info_load_symbolic_for_context_async (GtkIconInfo *icon_info, |
345 | GtkStyleContext *context, |
346 | GCancellable *cancellable, |
347 | GAsyncReadyCallback callback, |
348 | gpointer user_data); |
349 | GDK_AVAILABLE_IN_3_8 |
350 | GdkPixbuf * gtk_icon_info_load_symbolic_for_context_finish (GtkIconInfo *icon_info, |
351 | GAsyncResult *res, |
352 | gboolean *was_symbolic, |
353 | GError **error); |
354 | GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_info_load_symbol_for_context) |
355 | GdkPixbuf * gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info, |
356 | GtkStyle *style, |
357 | GtkStateType state, |
358 | gboolean *was_symbolic, |
359 | GError **error); |
360 | GDK_DEPRECATED_IN_3_14 |
361 | void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info, |
362 | gboolean raw_coordinates); |
363 | |
364 | GDK_DEPRECATED_IN_3_14 |
365 | gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info, |
366 | GdkRectangle *rectangle); |
367 | GDK_DEPRECATED_IN_3_14 |
368 | gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info, |
369 | GdkPoint **points, |
370 | gint *n_points); |
371 | GDK_DEPRECATED_IN_3_14 |
372 | const gchar * gtk_icon_info_get_display_name (GtkIconInfo *icon_info); |
373 | |
374 | G_END_DECLS |
375 | |
376 | #endif /* __GTK_ICON_THEME_H__ */ |
377 | |