]> Pileus Git - ~andy/gtk/blob - gtk/gtkicontheme.h
8190806d254eac5b8e635534eb312218ebb7db1d
[~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, 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 #include <glib-object.h>
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25 #include <gdk/gdkscreen.h>
26
27 G_BEGIN_DECLS
28
29 #define GTK_TYPE_ICON_INFO              (gtk_icon_info_get_type ())
30
31 #define GTK_TYPE_ICON_THEME             (gtk_icon_theme_get_type ())
32 #define GTK_ICON_THEME(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
33 #define GTK_ICON_THEME_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
34 #define GTK_IS_ICON_THEME(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
35 #define GTK_IS_ICON_THEME_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_THEME))
36 #define GTK_ICON_THEME_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_THEME, GtkIconThemeClass))
37
38 typedef struct _GtkIconInfo         GtkIconInfo;
39 typedef struct _GtkIconTheme        GtkIconTheme;
40 typedef struct _GtkIconThemeClass   GtkIconThemeClass;
41 typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
42
43 struct _GtkIconTheme
44 {
45   /*< private >*/
46   GObject parent_instance;
47
48   GtkIconThemePrivate *priv;
49 };
50
51 struct _GtkIconThemeClass
52 {
53   GObjectClass parent_class;
54
55   void (* changed)  (GtkIconTheme *icon_theme);
56 };
57
58 /**
59  * GtkIconLookupFlags:
60  * @GTK_ICON_LOOKUP_NO_SVG: Never return SVG icons, even if gdk-pixbuf
61  *   supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
62  * @GTK_ICON_LOOKUP_FORCE_SVG: Return SVG icons, even if gdk-pixbuf
63  *   doesn't support them.
64  *   Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
65  * @GTK_ICON_LOOKUP_USE_BUILTIN: When passed to
66  *   gtk_icon_theme_lookup_icon() includes builtin icons
67  *   as well as files. For a builtin icon, gtk_icon_info_get_filename()
68  *   returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
69  * 
70  * Used to specify options for gtk_icon_theme_lookup_icon()
71  **/
72 typedef enum
73 {
74   GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
75   GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
76   GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2
77 } GtkIconLookupFlags;
78
79 #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
80
81 /**
82  * GtkIconThemeError:
83  * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
84  * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
85  * 
86  * Error codes for GtkIconTheme operations.
87  **/
88 typedef enum {
89   GTK_ICON_THEME_NOT_FOUND,
90   GTK_ICON_THEME_FAILED
91 } GtkIconThemeError;
92
93 GQuark gtk_icon_theme_error_quark (void);
94
95 #ifdef G_OS_WIN32
96 /* Reserve old name for DLL ABI backward compatibility */
97 #define gtk_icon_theme_set_search_path gtk_icon_theme_set_search_path_utf8
98 #define gtk_icon_theme_get_search_path gtk_icon_theme_get_search_path_utf8
99 #define gtk_icon_theme_append_search_path gtk_icon_theme_append_search_path_utf8
100 #define gtk_icon_theme_prepend_search_path gtk_icon_theme_prepend_search_path_utf8
101 #define gtk_icon_info_get_filename gtk_icon_info_get_filename_utf8
102 #endif
103
104 GType         gtk_icon_theme_get_type              (void) G_GNUC_CONST;
105
106 GtkIconTheme *gtk_icon_theme_new                   (void);
107 GtkIconTheme *gtk_icon_theme_get_default           (void);
108 GtkIconTheme *gtk_icon_theme_get_for_screen        (GdkScreen                   *screen);
109 void          gtk_icon_theme_set_screen            (GtkIconTheme                *icon_theme,
110                                                     GdkScreen                   *screen);
111
112 void          gtk_icon_theme_set_search_path       (GtkIconTheme                *icon_theme,
113                                                     const gchar                 *path[],
114                                                     gint                         n_elements);
115 void          gtk_icon_theme_get_search_path       (GtkIconTheme                *icon_theme,
116                                                     gchar                      **path[],
117                                                     gint                        *n_elements);
118 void          gtk_icon_theme_append_search_path    (GtkIconTheme                *icon_theme,
119                                                     const gchar                 *path);
120 void          gtk_icon_theme_prepend_search_path   (GtkIconTheme                *icon_theme,
121                                                     const gchar                 *path);
122
123 void          gtk_icon_theme_set_custom_theme      (GtkIconTheme                *icon_theme,
124                                                     const gchar                 *theme_name);
125
126 gboolean      gtk_icon_theme_has_icon              (GtkIconTheme                *icon_theme,
127                                                     const gchar                 *icon_name);
128 gint         *gtk_icon_theme_get_icon_sizes        (GtkIconTheme                *icon_theme,
129                                                     const gchar                 *icon_name);
130 GtkIconInfo * gtk_icon_theme_lookup_icon           (GtkIconTheme                *icon_theme,
131                                                     const gchar                 *icon_name,
132                                                     gint                         size,
133                                                     GtkIconLookupFlags           flags);
134 GdkPixbuf *   gtk_icon_theme_load_icon             (GtkIconTheme                *icon_theme,
135                                                     const gchar                 *icon_name,
136                                                     gint                         size,
137                                                     GtkIconLookupFlags           flags,
138                                                     GError                     **error);
139
140 GList *       gtk_icon_theme_list_icons            (GtkIconTheme                *icon_theme,
141                                                     const gchar                 *context);
142 char *        gtk_icon_theme_get_example_icon_name (GtkIconTheme                *icon_theme);
143
144 gboolean      gtk_icon_theme_rescan_if_needed      (GtkIconTheme                *icon_theme);
145
146 void       gtk_icon_theme_add_builtin_icon  (const gchar *icon_name,
147                                              gint         size,
148                                              GdkPixbuf   *pixbuf);
149
150 GType         gtk_icon_info_get_type (void) G_GNUC_CONST;
151 GtkIconInfo  *gtk_icon_info_copy     (GtkIconInfo *icon_info);
152 void          gtk_icon_info_free     (GtkIconInfo *icon_info);
153
154 gint                  gtk_icon_info_get_base_size      (GtkIconInfo *icon_info);
155 G_CONST_RETURN gchar *gtk_icon_info_get_filename       (GtkIconInfo *icon_info);
156 GdkPixbuf    *        gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
157 GdkPixbuf    *        gtk_icon_info_load_icon          (GtkIconInfo *icon_info,
158                                                         GError     **error);
159
160 void                  gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info,
161                                                          gboolean     raw_coordinates);
162
163 gboolean              gtk_icon_info_get_embedded_rect (GtkIconInfo   *icon_info,
164                                                        GdkRectangle  *rectangle);
165 gboolean              gtk_icon_info_get_attach_points (GtkIconInfo   *icon_info,
166                                                        GdkPoint     **points,
167                                                        gint          *n_points);
168 G_CONST_RETURN gchar *gtk_icon_info_get_display_name  (GtkIconInfo   *icon_info);
169
170 /* Non-public methods */
171 void _gtk_icon_theme_check_reload                     (GdkDisplay *display);
172
173 G_END_DECLS
174
175 #endif /* __GTK_ICON_THEME_H__ */