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, write to the |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. |
18 | */ |
19 | |
20 | #ifndef __GTK_ICON_THEME_H__ |
21 | #define __GTK_ICON_THEME_H__ |
22 | |
23 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
24 | #error "Only <gtk/gtk.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <gdk-pixbuf/gdk-pixbuf.h> |
28 | #include <gdk/gdk.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | #define GTK_TYPE_ICON_INFO (gtk_icon_info_get_type ()) |
33 | |
34 | #define GTK_TYPE_ICON_THEME (gtk_icon_theme_get_type ()) |
35 | #define GTK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme)) |
36 | #define GTK_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_THEME, GtkIconThemeClass)) |
37 | #define GTK_IS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME)) |
38 | #define GTK_IS_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_THEME)) |
39 | #define GTK_ICON_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_THEME, GtkIconThemeClass)) |
40 | |
41 | typedef struct _GtkIconInfo GtkIconInfo; |
42 | typedef struct _GtkIconTheme GtkIconTheme; |
43 | typedef struct _GtkIconThemeClass GtkIconThemeClass; |
44 | typedef struct _GtkIconThemePrivate GtkIconThemePrivate; |
45 | |
46 | struct _GtkIconTheme |
47 | { |
48 | /*< private >*/ |
49 | GObject parent_instance; |
50 | |
51 | GtkIconThemePrivate *GSEAL (priv); |
52 | }; |
53 | |
54 | struct _GtkIconThemeClass |
55 | { |
56 | GObjectClass parent_class; |
57 | |
58 | void (* changed) (GtkIconTheme *icon_theme); |
59 | }; |
60 | |
61 | /** |
62 | * GtkIconLookupFlags: |
63 | * @GTK_ICON_LOOKUP_NO_SVG: Never return SVG icons, even if gdk-pixbuf |
64 | * supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG. |
65 | * @GTK_ICON_LOOKUP_FORCE_SVG: Return SVG icons, even if gdk-pixbuf |
66 | * doesn't support them. |
67 | * Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG. |
68 | * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to |
69 | * gtk_icon_theme_lookup_icon() includes builtin icons |
70 | * as well as files. For a builtin icon, gtk_icon_info_get_filename() |
71 | * returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf(). |
72 | * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-' |
73 | * characters before looking at inherited themes. For more general |
74 | * fallback, see gtk_icon_theme_choose_icon(). Since 2.12. |
75 | * @GTK_ICON_LOOKUP_FORCE_SIZE: Always return the icon scaled to the |
76 | * requested size. Since 2.14. |
77 | * |
78 | * Used to specify options for gtk_icon_theme_lookup_icon() |
79 | **/ |
80 | typedef enum |
81 | { |
82 | GTK_ICON_LOOKUP_NO_SVG = 1 << 0, |
83 | GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1, |
84 | GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2, |
85 | GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3, |
86 | GTK_ICON_LOOKUP_FORCE_SIZE = 1 << 4 |
87 | } GtkIconLookupFlags; |
88 | |
89 | #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark () |
90 | |
91 | /** |
92 | * GtkIconThemeError: |
93 | * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme |
94 | * @GTK_ICON_THEME_FAILED: An unspecified error occurred. |
95 | * |
96 | * Error codes for GtkIconTheme operations. |
97 | **/ |
98 | typedef enum { |
99 | GTK_ICON_THEME_NOT_FOUND, |
100 | GTK_ICON_THEME_FAILED |
101 | } GtkIconThemeError; |
102 | |
103 | GQuark gtk_icon_theme_error_quark (void); |
104 | |
105 | #ifdef G_OS_WIN32 |
106 | /* Reserve old name for DLL ABI backward compatibility */ |
107 | #define gtk_icon_theme_set_search_path gtk_icon_theme_set_search_path_utf8 |
108 | #define gtk_icon_theme_get_search_path gtk_icon_theme_get_search_path_utf8 |
109 | #define gtk_icon_theme_append_search_path gtk_icon_theme_append_search_path_utf8 |
110 | #define gtk_icon_theme_prepend_search_path gtk_icon_theme_prepend_search_path_utf8 |
111 | #define gtk_icon_info_get_filename gtk_icon_info_get_filename_utf8 |
112 | #endif |
113 | |
114 | GType gtk_icon_theme_get_type (void) G_GNUC_CONST; |
115 | |
116 | GtkIconTheme *gtk_icon_theme_new (void); |
117 | GtkIconTheme *gtk_icon_theme_get_default (void); |
118 | GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen); |
119 | void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme, |
120 | GdkScreen *screen); |
121 | |
122 | void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme, |
123 | const gchar *path[], |
124 | gint n_elements); |
125 | void gtk_icon_theme_get_search_path (GtkIconTheme *icon_theme, |
126 | gchar **path[], |
127 | gint *n_elements); |
128 | void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme, |
129 | const gchar *path); |
130 | void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme, |
131 | const gchar *path); |
132 | |
133 | void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme, |
134 | const gchar *theme_name); |
135 | |
136 | gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme, |
137 | const gchar *icon_name); |
138 | gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme, |
139 | const gchar *icon_name); |
140 | GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme, |
141 | const gchar *icon_name, |
142 | gint size, |
143 | GtkIconLookupFlags flags); |
144 | GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme, |
145 | const gchar *icon_names[], |
146 | gint size, |
147 | GtkIconLookupFlags flags); |
148 | GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme, |
149 | const gchar *icon_name, |
150 | gint size, |
151 | GtkIconLookupFlags flags, |
152 | GError **error); |
153 | |
154 | GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme, |
155 | GIcon *icon, |
156 | gint size, |
157 | GtkIconLookupFlags flags); |
158 | |
159 | GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme, |
160 | const gchar *context); |
161 | GList * gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme); |
162 | char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme); |
163 | |
164 | gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme); |
165 | |
166 | void gtk_icon_theme_add_builtin_icon (const gchar *icon_name, |
167 | gint size, |
168 | GdkPixbuf *pixbuf); |
169 | |
170 | GType gtk_icon_info_get_type (void) G_GNUC_CONST; |
171 | GtkIconInfo * gtk_icon_info_copy (GtkIconInfo *icon_info); |
172 | void gtk_icon_info_free (GtkIconInfo *icon_info); |
173 | |
174 | GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme, |
175 | GdkPixbuf *pixbuf); |
176 | |
177 | gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info); |
178 | const gchar * gtk_icon_info_get_filename (GtkIconInfo *icon_info); |
179 | GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info); |
180 | GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info, |
181 | GError **error); |
182 | void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info, |
183 | gboolean raw_coordinates); |
184 | |
185 | gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info, |
186 | GdkRectangle *rectangle); |
187 | gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info, |
188 | GdkPoint **points, |
189 | gint *n_points); |
190 | const gchar * gtk_icon_info_get_display_name (GtkIconInfo *icon_info); |
191 | |
192 | /* Non-public methods */ |
193 | void _gtk_icon_theme_check_reload (GdkDisplay *display); |
194 | void _gtk_icon_theme_ensure_builtin_cache (void); |
195 | |
196 | G_END_DECLS |
197 | |
198 | #endif /* __GTK_ICON_THEME_H__ */ |
199 | |