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 #ifndef __GTK_ICON_THEME_H__
19 #define __GTK_ICON_THEME_H__
20 
21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
23 #endif
24 
25 #include <gdk/gdk.h>
26 #include <gtk/gtkenums.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GTK_TYPE_ICON_PAINTABLE    (gtk_icon_paintable_get_type ())
31 #define GTK_ICON_PAINTABLE(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_PAINTABLE, GtkIconPaintable))
32 #define GTK_IS_ICON_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_PAINTABLE))
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_IS_ICON_THEME(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
37 
38 typedef struct _GtkIconPaintable  GtkIconPaintable;
39 typedef struct _GtkIconTheme      GtkIconTheme;
40 
41 /**
42  * GtkIconLookupFlags:
43  * @GTK_ICON_LOOKUP_FORCE_REGULAR: Try to always load regular icons, even
44  *   when symbolic icon names are given
45  * @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Try to always load symbolic icons, even
46  *   when regular icon names are given
47  * @GTK_ICON_LOOKUP_PRELOAD: Starts loading the texture in the background
48  *   so it is ready when later needed.
49  *
50  * Used to specify options for gtk_icon_theme_lookup_icon().
51  */
52 typedef enum
53 {
54   GTK_ICON_LOOKUP_FORCE_REGULAR  = 1 << 0,
55   GTK_ICON_LOOKUP_FORCE_SYMBOLIC = 1 << 1,
56   GTK_ICON_LOOKUP_PRELOAD        = 1 << 2,
57 } GtkIconLookupFlags;
58 
59 /**
60  * GTK_ICON_THEME_ERROR:
61  *
62  * The `GQuark` used for `GtkIconThemeError` errors.
63  */
64 #define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
65 
66 /**
67  * GtkIconThemeError:
68  * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
69  * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
70  *
71  * Error codes for `GtkIconTheme` operations.
72  **/
73 typedef enum {
74   GTK_ICON_THEME_NOT_FOUND,
75   GTK_ICON_THEME_FAILED
76 } GtkIconThemeError;
77 
78 GDK_AVAILABLE_IN_ALL
79 GQuark gtk_icon_theme_error_quark (void);
80 
81 GDK_AVAILABLE_IN_ALL
82 GType            gtk_icon_theme_get_type             (void) G_GNUC_CONST;
83 
84 GDK_AVAILABLE_IN_ALL
85 GtkIconTheme    *gtk_icon_theme_new                  (void);
86 GDK_AVAILABLE_IN_ALL
87 GtkIconTheme    *gtk_icon_theme_get_for_display      (GdkDisplay                  *display);
88 
89 GDK_AVAILABLE_IN_ALL
90 GdkDisplay *     gtk_icon_theme_get_display          (GtkIconTheme                *self);
91 
92 GDK_AVAILABLE_IN_ALL
93 void             gtk_icon_theme_set_search_path      (GtkIconTheme                *self,
94                                                       const char * const          *path);
95 GDK_AVAILABLE_IN_ALL
96 char **          gtk_icon_theme_get_search_path      (GtkIconTheme                *self);
97 GDK_AVAILABLE_IN_ALL
98 void             gtk_icon_theme_add_search_path      (GtkIconTheme                *self,
99                                                       const char                  *path);
100 
101 GDK_AVAILABLE_IN_ALL
102 void             gtk_icon_theme_set_resource_path    (GtkIconTheme                *self,
103                                                       const char * const          *path);
104 GDK_AVAILABLE_IN_ALL
105 char **          gtk_icon_theme_get_resource_path    (GtkIconTheme                *self);
106 GDK_AVAILABLE_IN_ALL
107 void             gtk_icon_theme_add_resource_path    (GtkIconTheme                *self,
108                                                       const char                  *path);
109 
110 GDK_AVAILABLE_IN_ALL
111 void             gtk_icon_theme_set_theme_name       (GtkIconTheme                *self,
112                                                       const char                  *theme_name);
113 GDK_AVAILABLE_IN_ALL
114 char *           gtk_icon_theme_get_theme_name       (GtkIconTheme                *self);
115 
116 GDK_AVAILABLE_IN_ALL
117 gboolean         gtk_icon_theme_has_icon             (GtkIconTheme                *self,
118                                                       const char                  *icon_name);
119 GDK_AVAILABLE_IN_4_2
120 gboolean         gtk_icon_theme_has_gicon            (GtkIconTheme                *self,
121                                                       GIcon                       *gicon);
122 GDK_AVAILABLE_IN_ALL
123 int              *gtk_icon_theme_get_icon_sizes      (GtkIconTheme                *self,
124                                                       const char                  *icon_name);
125 GDK_AVAILABLE_IN_ALL
126 GtkIconPaintable *gtk_icon_theme_lookup_icon         (GtkIconTheme                *self,
127                                                       const char                  *icon_name,
128                                                       const char                  *fallbacks[],
129                                                       int                          size,
130                                                       int                          scale,
131                                                       GtkTextDirection             direction,
132                                                       GtkIconLookupFlags           flags);
133 GDK_AVAILABLE_IN_ALL
134 GtkIconPaintable *gtk_icon_theme_lookup_by_gicon     (GtkIconTheme                *self,
135                                                       GIcon                       *icon,
136                                                       int                          size,
137                                                       int                          scale,
138                                                       GtkTextDirection             direction,
139                                                       GtkIconLookupFlags           flags);
140 GDK_AVAILABLE_IN_ALL
141 GtkIconPaintable *gtk_icon_paintable_new_for_file    (GFile                       *file,
142                                                       int                          size,
143                                                       int                          scale);
144 GDK_AVAILABLE_IN_ALL
145 char **               gtk_icon_theme_get_icon_names  (GtkIconTheme                *self);
146 
147 GDK_AVAILABLE_IN_ALL
148 GType                 gtk_icon_paintable_get_type         (void) G_GNUC_CONST;
149 
150 GDK_AVAILABLE_IN_ALL
151 GFile *               gtk_icon_paintable_get_file          (GtkIconPaintable  *self);
152 GDK_AVAILABLE_IN_ALL
153 const char *         gtk_icon_paintable_get_icon_name     (GtkIconPaintable  *self);
154 GDK_AVAILABLE_IN_ALL
155 gboolean              gtk_icon_paintable_is_symbolic       (GtkIconPaintable  *self);
156 
157 G_END_DECLS
158 
159 #endif /* __GTK_ICON_THEME_H__ */
160