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