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