1/* GTK - The GIMP Toolkit
2 * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
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_CSS_PROVIDER_H__
19#define __GTK_CSS_PROVIDER_H__
20
21#include <gio/gio.h>
22#include <gtk/gtkcsssection.h>
23
24G_BEGIN_DECLS
25
26#define GTK_TYPE_CSS_PROVIDER (gtk_css_provider_get_type ())
27#define GTK_CSS_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_CSS_PROVIDER, GtkCssProvider))
28#define GTK_CSS_PROVIDER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_CSS_PROVIDER, GtkCssProviderClass))
29#define GTK_IS_CSS_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_CSS_PROVIDER))
30#define GTK_IS_CSS_PROVIDER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_CSS_PROVIDER))
31#define GTK_CSS_PROVIDER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_CSS_PROVIDER, GtkCssProviderClass))
32
33/**
34 * GTK_CSS_PROVIDER_ERROR:
35 *
36 * Domain for #GtkCssProvider errors.
37 */
38#define GTK_CSS_PROVIDER_ERROR (gtk_css_provider_error_quark ())
39
40/**
41 * GtkCssProviderError:
42 * @GTK_CSS_PROVIDER_ERROR_FAILED: Failed.
43 * @GTK_CSS_PROVIDER_ERROR_SYNTAX: Syntax error.
44 * @GTK_CSS_PROVIDER_ERROR_IMPORT: Import error.
45 * @GTK_CSS_PROVIDER_ERROR_NAME: Name error.
46 * @GTK_CSS_PROVIDER_ERROR_DEPRECATED: Deprecation error.
47 * @GTK_CSS_PROVIDER_ERROR_UNKNOWN_VALUE: Unknown value.
48 *
49 * Error codes for %GTK_CSS_PROVIDER_ERROR.
50 */
51typedef enum
52{
53 GTK_CSS_PROVIDER_ERROR_FAILED,
54 GTK_CSS_PROVIDER_ERROR_SYNTAX,
55 GTK_CSS_PROVIDER_ERROR_IMPORT,
56 GTK_CSS_PROVIDER_ERROR_NAME,
57 GTK_CSS_PROVIDER_ERROR_DEPRECATED,
58 GTK_CSS_PROVIDER_ERROR_UNKNOWN_VALUE
59} GtkCssProviderError;
60
61GDK_AVAILABLE_IN_ALL
62GQuark gtk_css_provider_error_quark (void);
63
64typedef struct _GtkCssProvider GtkCssProvider;
65typedef struct _GtkCssProviderClass GtkCssProviderClass;
66typedef struct _GtkCssProviderPrivate GtkCssProviderPrivate;
67
68struct _GtkCssProvider
69{
70 GObject parent_instance;
71 GtkCssProviderPrivate *priv;
72};
73
74struct _GtkCssProviderClass
75{
76 GObjectClass parent_class;
77
78 void (* parsing_error) (GtkCssProvider *provider,
79 GtkCssSection *section,
80 const GError * error);
81
82 /* Padding for future expansion */
83 void (*_gtk_reserved2) (void);
84 void (*_gtk_reserved3) (void);
85 void (*_gtk_reserved4) (void);
86};
87
88GDK_AVAILABLE_IN_ALL
89GType gtk_css_provider_get_type (void) G_GNUC_CONST;
90
91GDK_AVAILABLE_IN_ALL
92GtkCssProvider * gtk_css_provider_new (void);
93
94GDK_AVAILABLE_IN_3_2
95char * gtk_css_provider_to_string (GtkCssProvider *provider);
96
97GDK_AVAILABLE_IN_ALL
98gboolean gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
99 const gchar *data,
100 gssize length,
101 GError **error);
102GDK_AVAILABLE_IN_ALL
103gboolean gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
104 GFile *file,
105 GError **error);
106GDK_AVAILABLE_IN_ALL
107gboolean gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
108 const gchar *path,
109 GError **error);
110
111GDK_AVAILABLE_IN_3_16
112void gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
113 const gchar *resource_path);
114
115GDK_DEPRECATED_FOR(gtk_css_provider_new)
116GtkCssProvider * gtk_css_provider_get_default (void);
117
118GDK_AVAILABLE_IN_ALL
119GtkCssProvider * gtk_css_provider_get_named (const gchar *name,
120 const gchar *variant);
121
122G_END_DECLS
123
124#endif /* __GTK_CSS_PROVIDER_H__ */
125