summaryrefslogtreecommitdiff
path: root/gtk/gtkicontheme.h
blob: 183c7249aa8f1ac69c2418c04842cf83aea80c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* GtkIconTheme - a loader for icon themes
 * gtk-icon-loader.h Copyright (C) 2002, 2003 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GTK_ICON_THEME_H__
#define __GTK_ICON_THEME_H__

#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

#include <gdk/gdk.h>
#include <gtk/gtkenums.h>

G_BEGIN_DECLS

#define GTK_TYPE_ICON_PAINTABLE    (gtk_icon_paintable_get_type ())
#define GTK_ICON_PAINTABLE(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_PAINTABLE, GtkIconPaintable))
#define GTK_IS_ICON_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_PAINTABLE))

#define GTK_TYPE_ICON_THEME        (gtk_icon_theme_get_type ())
#define GTK_ICON_THEME(obj)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
#define GTK_IS_ICON_THEME(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))

typedef struct _GtkIconPaintable  GtkIconPaintable;
typedef struct _GtkIconTheme      GtkIconTheme;

/**
 * GtkIconLookupFlags:
 * @GTK_ICON_LOOKUP_FORCE_REGULAR: Try to always load regular icons, even
 *   when symbolic icon names are given
 * @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Try to always load symbolic icons, even
 *   when regular icon names are given
 * @GTK_ICON_LOOKUP_PRELOAD: Starts loading the texture in the background
 *   so it is ready when later needed.
 *
 * Used to specify options for gtk_icon_theme_lookup_icon().
 */
typedef enum
{
  GTK_ICON_LOOKUP_FORCE_REGULAR  = 1 << 0,
  GTK_ICON_LOOKUP_FORCE_SYMBOLIC = 1 << 1,
  GTK_ICON_LOOKUP_PRELOAD        = 1 << 2,
} GtkIconLookupFlags;

/**
 * GTK_ICON_THEME_ERROR:
 *
 * The #GQuark used for #GtkIconThemeError errors.
 */
#define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()

/**
 * GtkIconThemeError:
 * @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
 * @GTK_ICON_THEME_FAILED: An unspecified error occurred.
 *
 * Error codes for `GtkIconTheme` operations.
 **/
typedef enum {
  GTK_ICON_THEME_NOT_FOUND,
  GTK_ICON_THEME_FAILED
} GtkIconThemeError;

GDK_AVAILABLE_IN_ALL
GQuark gtk_icon_theme_error_quark (void);

GDK_AVAILABLE_IN_ALL
GType            gtk_icon_theme_get_type             (void) G_GNUC_CONST;

GDK_AVAILABLE_IN_ALL
GtkIconTheme    *gtk_icon_theme_new                  (void);
GDK_AVAILABLE_IN_ALL
GtkIconTheme    *gtk_icon_theme_get_for_display      (GdkDisplay                  *display);

GDK_AVAILABLE_IN_ALL
GdkDisplay *     gtk_icon_theme_get_display          (GtkIconTheme                *self);

GDK_AVAILABLE_IN_ALL
void             gtk_icon_theme_set_search_path      (GtkIconTheme                *self,
                                                      const char * const          *path);
GDK_AVAILABLE_IN_ALL
char **          gtk_icon_theme_get_search_path      (GtkIconTheme                *self);
GDK_AVAILABLE_IN_ALL
void             gtk_icon_theme_add_search_path      (GtkIconTheme                *self,
                                                      const char                  *path);

GDK_AVAILABLE_IN_ALL
void             gtk_icon_theme_set_resource_path    (GtkIconTheme                *self,
                                                      const char * const          *path);
GDK_AVAILABLE_IN_ALL
char **          gtk_icon_theme_get_resource_path    (GtkIconTheme                *self);
GDK_AVAILABLE_IN_ALL
void             gtk_icon_theme_add_resource_path    (GtkIconTheme                *self,
                                                      const char                  *path);

GDK_AVAILABLE_IN_ALL
void             gtk_icon_theme_set_theme_name       (GtkIconTheme                *self,
                                                      const char                  *theme_name);
GDK_AVAILABLE_IN_ALL
char *           gtk_icon_theme_get_theme_name       (GtkIconTheme                *self);

GDK_AVAILABLE_IN_ALL
gboolean         gtk_icon_theme_has_icon             (GtkIconTheme                *self,
                                                      const char                  *icon_name);
GDK_AVAILABLE_IN_4_2
gboolean         gtk_icon_theme_has_gicon            (GtkIconTheme                *self,
                                                      GIcon                       *gicon);
GDK_AVAILABLE_IN_ALL
int              *gtk_icon_theme_get_icon_sizes      (GtkIconTheme                *self,
                                                      const char                  *icon_name);
GDK_AVAILABLE_IN_ALL
GtkIconPaintable *gtk_icon_theme_lookup_icon         (GtkIconTheme                *self,
                                                      const char                  *icon_name,
                                                      const char                  *fallbacks[],
                                                      int                          size,
                                                      int                          scale,
                                                      GtkTextDirection             direction,
                                                      GtkIconLookupFlags           flags);
GDK_AVAILABLE_IN_ALL
GtkIconPaintable *gtk_icon_theme_lookup_by_gicon     (GtkIconTheme                *self,
                                                      GIcon                       *icon,
                                                      int                          size,
                                                      int                          scale,
                                                      GtkTextDirection             direction,
                                                      GtkIconLookupFlags           flags);
GDK_AVAILABLE_IN_ALL
GtkIconPaintable *gtk_icon_paintable_new_for_file    (GFile                       *file,
                                                      int                          size,
                                                      int                          scale);
GDK_AVAILABLE_IN_ALL
char **               gtk_icon_theme_get_icon_names  (GtkIconTheme                *self);

GDK_AVAILABLE_IN_ALL
GType                 gtk_icon_paintable_get_type         (void) G_GNUC_CONST;

GDK_AVAILABLE_IN_ALL
GFile *               gtk_icon_paintable_get_file          (GtkIconPaintable  *self);
GDK_AVAILABLE_IN_ALL
const char *         gtk_icon_paintable_get_icon_name     (GtkIconPaintable  *self);
GDK_AVAILABLE_IN_ALL
gboolean              gtk_icon_paintable_is_symbolic       (GtkIconPaintable  *self);

G_END_DECLS

#endif /* __GTK_ICON_THEME_H__ */