]> Pileus Git - ~andy/gtk/blob - gtk/gtkicontheme.h
Change FSF Address
[~andy/gtk] / gtk / gtkicontheme.h
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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
19 #error "Only <gtk/gtk.h> can be included directly."
20 #endif
21
22 #ifndef __GTK_ICON_THEME_H__
23 #define __GTK_ICON_THEME_H__
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
33 #define GTK_TYPE_ICON_THEME             (gtk_icon_theme_get_type ())
34 #define GTK_ICON_THEME(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
35 #define GTK_ICON_THEME_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
36 #define GTK_IS_ICON_THEME(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
37 #define GTK_IS_ICON_THEME_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_THEME))
38 #define GTK_ICON_THEME_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
39
40 /**
41  * GtkIconInfo:
42  *
43  * Contains information found when looking up an icon in
44  * an icon theme.
45  */
46 typedef struct _GtkIconInfo         GtkIconInfo;
47 typedef struct _GtkIconTheme        GtkIconTheme;
48 typedef struct _GtkIconThemeClass   GtkIconThemeClass;
49 typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
50
51 /**
52  * GtkIconTheme:
53  *
54  * Acts as a database of information about an icon theme.
55  * Normally, you retrieve the icon theme for a particular
56  * screen using gtk_icon_theme_get_for_screen() and it
57  * will contain information about current icon theme for
58  * that screen, but you can also create a new #GtkIconTheme
59  * object and set the icon theme name explicitely using
60  * gtk_icon_theme_set_custom_theme().
61  */
62 struct _GtkIconTheme
63 {
64   /*< private >*/
65   GObject parent_instance;
66
67   GtkIconThemePrivate *priv;
68 };
69
70 struct _GtkIconThemeClass
71 {
72   GObjectClass parent_class;
73
74   void (* changed)  (GtkIconTheme *icon_theme);
75
76   /* Padding for future expansion */
77   void (*_gtk_reserved1) (void);
78   void (*_gtk_reserved2) (void);
79   void (*_gtk_reserved3) (void);
80   void (*_gtk_reserved4) (void);
81 };
82
83 /**
84  * GtkIconLookupFlags:
85  * @GTK_ICON_LOOKUP_NO_SVG: Never return SVG icons, even if gdk-pixbuf
86  *   supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
87  * @GTK_ICON_LOOKUP_FORCE_SVG: Return SVG icons, even if gdk-pixbuf
88  *   doesn't support them.
89  *   Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
90  * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to
91  *   gtk_icon_theme_lookup_icon() includes builtin icons
92  *   as well as files. For a builtin icon, gtk_icon_info_get_filename()
93  *   returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
94  * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
95  *   characters before looking at inherited themes. For more general
96  *   fallback, see gtk_icon_theme_choose_icon(). Since 2.12.
97  * @GTK_ICON_LOOKUP_FORCE_SIZE: Always return the icon scaled to the
98  *   requested size. Since 2.14.
99  * 
100  * Used to specify options for gtk_icon_theme_lookup_icon()
101  **/
102 typedef enum
103 {
104   GTK_ICON_LOOKUP_NO_SVG           = 1 << 0,
105   GTK_ICON_LOOKUP_FORCE_SVG        = 1 << 1,
106   GTK_ICON_LOOKUP_USE_BUILTIN      = 1 << 2,
107   GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
108   GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 4
109 } GtkIconLookupFlags;
110
111 /**
112  * GTK_ICON_THEME_ERROR:
113  *
114  * The #GQuark used for #GtkIconThemeError errors.
115  */
116 #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
117
118 /**
119  * GtkIconThemeError:
120  * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
121  * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
122  * 
123  * Error codes for GtkIconTheme operations.
124  **/
125 typedef enum {
126   GTK_ICON_THEME_NOT_FOUND,
127   GTK_ICON_THEME_FAILED
128 } GtkIconThemeError;
129
130 GQuark gtk_icon_theme_error_quark (void);
131
132 GType         gtk_icon_theme_get_type              (void) G_GNUC_CONST;
133
134 GtkIconTheme *gtk_icon_theme_new                   (void);
135 GtkIconTheme *gtk_icon_theme_get_default           (void);
136 GtkIconTheme *gtk_icon_theme_get_for_screen        (GdkScreen                   *screen);
137 void          gtk_icon_theme_set_screen            (GtkIconTheme                *icon_theme,
138                                                     GdkScreen                   *screen);
139
140 void          gtk_icon_theme_set_search_path       (GtkIconTheme                *icon_theme,
141                                                     const gchar                 *path[],
142                                                     gint                         n_elements);
143 void          gtk_icon_theme_get_search_path       (GtkIconTheme                *icon_theme,
144                                                     gchar                      **path[],
145                                                     gint                        *n_elements);
146 void          gtk_icon_theme_append_search_path    (GtkIconTheme                *icon_theme,
147                                                     const gchar                 *path);
148 void          gtk_icon_theme_prepend_search_path   (GtkIconTheme                *icon_theme,
149                                                     const gchar                 *path);
150
151 void          gtk_icon_theme_set_custom_theme      (GtkIconTheme                *icon_theme,
152                                                     const gchar                 *theme_name);
153
154 gboolean      gtk_icon_theme_has_icon              (GtkIconTheme                *icon_theme,
155                                                     const gchar                 *icon_name);
156 gint         *gtk_icon_theme_get_icon_sizes        (GtkIconTheme                *icon_theme,
157                                                     const gchar                 *icon_name);
158 GtkIconInfo * gtk_icon_theme_lookup_icon           (GtkIconTheme                *icon_theme,
159                                                     const gchar                 *icon_name,
160                                                     gint                         size,
161                                                     GtkIconLookupFlags           flags);
162 GtkIconInfo * gtk_icon_theme_choose_icon           (GtkIconTheme                *icon_theme,
163                                                     const gchar                 *icon_names[],
164                                                     gint                         size,
165                                                     GtkIconLookupFlags           flags);
166 GdkPixbuf *   gtk_icon_theme_load_icon             (GtkIconTheme                *icon_theme,
167                                                     const gchar                 *icon_name,
168                                                     gint                         size,
169                                                     GtkIconLookupFlags           flags,
170                                                     GError                     **error);
171
172 GtkIconInfo * gtk_icon_theme_lookup_by_gicon       (GtkIconTheme                *icon_theme,
173                                                     GIcon                       *icon,
174                                                     gint                         size,
175                                                     GtkIconLookupFlags           flags);
176
177 GList *       gtk_icon_theme_list_icons            (GtkIconTheme                *icon_theme,
178                                                     const gchar                 *context);
179 GList *       gtk_icon_theme_list_contexts         (GtkIconTheme                *icon_theme);
180 char *        gtk_icon_theme_get_example_icon_name (GtkIconTheme                *icon_theme);
181
182 gboolean      gtk_icon_theme_rescan_if_needed      (GtkIconTheme                *icon_theme);
183
184 void          gtk_icon_theme_add_builtin_icon      (const gchar *icon_name,
185                                                     gint         size,
186                                                     GdkPixbuf   *pixbuf);
187
188 GType                 gtk_icon_info_get_type           (void) G_GNUC_CONST;
189 GtkIconInfo *         gtk_icon_info_copy               (GtkIconInfo  *icon_info);
190 void                  gtk_icon_info_free               (GtkIconInfo  *icon_info);
191
192 GtkIconInfo *         gtk_icon_info_new_for_pixbuf     (GtkIconTheme  *icon_theme,
193                                                         GdkPixbuf     *pixbuf);
194
195 gint                  gtk_icon_info_get_base_size      (GtkIconInfo   *icon_info);
196 const gchar *         gtk_icon_info_get_filename       (GtkIconInfo   *icon_info);
197 GdkPixbuf *           gtk_icon_info_get_builtin_pixbuf (GtkIconInfo   *icon_info);
198 GdkPixbuf *           gtk_icon_info_load_icon          (GtkIconInfo   *icon_info,
199                                                         GError       **error);
200 GdkPixbuf *           gtk_icon_info_load_symbolic      (GtkIconInfo   *icon_info,
201                                                         const GdkRGBA *fg,
202                                                         const GdkRGBA *success_color,
203                                                         const GdkRGBA *warning_color,
204                                                         const GdkRGBA *error_color,
205                                                         gboolean      *was_symbolic,
206                                                         GError       **error);
207 GdkPixbuf *           gtk_icon_info_load_symbolic_for_context (GtkIconInfo      *icon_info,
208                                                                GtkStyleContext  *context,
209                                                                gboolean         *was_symbolic,
210                                                                GError          **error);
211 GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_info_load_symbol_for_context)
212 GdkPixbuf *           gtk_icon_info_load_symbolic_for_style  (GtkIconInfo   *icon_info,
213                                                               GtkStyle      *style,
214                                                               GtkStateType   state,
215                                                               gboolean      *was_symbolic,
216                                                               GError       **error);
217 void                  gtk_icon_info_set_raw_coordinates (GtkIconInfo  *icon_info,
218                                                          gboolean      raw_coordinates);
219
220 gboolean              gtk_icon_info_get_embedded_rect (GtkIconInfo    *icon_info,
221                                                        GdkRectangle   *rectangle);
222 gboolean              gtk_icon_info_get_attach_points (GtkIconInfo    *icon_info,
223                                                        GdkPoint      **points,
224                                                        gint           *n_points);
225 const gchar *         gtk_icon_info_get_display_name  (GtkIconInfo    *icon_info);
226
227 /* Non-public methods */
228 void _gtk_icon_theme_check_reload                     (GdkDisplay *display);
229 void _gtk_icon_theme_ensure_builtin_cache             (void);
230
231 G_END_DECLS
232
233 #endif /* __GTK_ICON_THEME_H__ */