]> Pileus Git - ~andy/gtk/blob - gtk/gtkcssparserprivate.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkcssparserprivate.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2011 Benjamin Otte <otte@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_PARSER_PRIVATE_H__
19 #define __GTK_CSS_PARSER_PRIVATE_H__
20
21 #include "gtk/gtkcsstypesprivate.h"
22 #include <gtk/gtkcssprovider.h>
23
24 G_BEGIN_DECLS
25
26 typedef struct _GtkCssParser GtkCssParser;
27
28 typedef void (* GtkCssParserErrorFunc) (GtkCssParser *parser,
29                                         const GError *error,
30                                         gpointer      user_data);
31
32 GtkCssParser *  _gtk_css_parser_new               (const char            *data,
33                                                    GFile                 *file,
34                                                    GtkCssParserErrorFunc  error_func,
35                                                    gpointer               user_data);
36 void            _gtk_css_parser_free              (GtkCssParser          *parser);
37
38 void            _gtk_css_parser_take_error        (GtkCssParser          *parser,
39                                                    GError                *error);
40 void            _gtk_css_parser_error             (GtkCssParser          *parser,
41                                                    const char            *format,
42                                                     ...) G_GNUC_PRINTF (2, 3);
43 void            _gtk_css_parser_error_full        (GtkCssParser          *parser,
44                                                    GtkCssProviderError    code,
45                                                    const char            *format,
46                                                     ...) G_GNUC_PRINTF (3, 4);
47
48 guint           _gtk_css_parser_get_line          (GtkCssParser          *parser);
49 guint           _gtk_css_parser_get_position      (GtkCssParser          *parser);
50 GFile *         _gtk_css_parser_get_file          (GtkCssParser          *parser);
51 GFile *         _gtk_css_parser_get_file_for_path (GtkCssParser          *parser,
52                                                    const char            *path);
53
54 gboolean        _gtk_css_parser_is_eof            (GtkCssParser          *parser);
55 gboolean        _gtk_css_parser_begins_with       (GtkCssParser          *parser,
56                                                    char                   c);
57 gboolean        _gtk_css_parser_has_prefix        (GtkCssParser          *parser,
58                                                    const char            *prefix);
59 gboolean        _gtk_css_parser_is_string         (GtkCssParser          *parser);
60
61 /* IMPORTANT:
62  * _try_foo() functions do not modify the data pointer if they fail, nor do they
63  * signal an error. _read_foo() will modify the data pointer and position it at
64  * the first token that is broken and emit an error about the failure.
65  * So only call _read_foo() when you know that you are reading a foo. _try_foo()
66  * however is fine to call if you don't know yet if the token is a foo or a bar,
67  * you can _try_bar() if try_foo() failed.
68  */
69 gboolean        _gtk_css_parser_try               (GtkCssParser          *parser,
70                                                    const char            *string,
71                                                    gboolean               skip_whitespace);
72 char *          _gtk_css_parser_try_ident         (GtkCssParser          *parser,
73                                                    gboolean               skip_whitespace);
74 char *          _gtk_css_parser_try_name          (GtkCssParser          *parser,
75                                                    gboolean               skip_whitespace);
76 gboolean        _gtk_css_parser_try_int           (GtkCssParser          *parser,
77                                                    int                   *value);
78 gboolean        _gtk_css_parser_try_uint          (GtkCssParser          *parser,
79                                                    guint                 *value);
80 gboolean        _gtk_css_parser_try_double        (GtkCssParser          *parser,
81                                                    gdouble               *value);
82 gboolean        _gtk_css_parser_try_length        (GtkCssParser          *parser,
83                                                    int                   *value);
84 gboolean        _gtk_css_parser_try_enum          (GtkCssParser          *parser,
85                                                    GType                  enum_type,
86                                                    int                   *value);
87 gboolean        _gtk_css_parser_try_hash_color    (GtkCssParser          *parser,
88                                                    GdkRGBA               *rgba);
89
90 gboolean        _gtk_css_parser_has_number        (GtkCssParser          *parser);
91 char *          _gtk_css_parser_read_string       (GtkCssParser          *parser);
92 char *          _gtk_css_parser_read_value        (GtkCssParser          *parser);
93 GFile *         _gtk_css_parser_read_url          (GtkCssParser          *parser);
94
95 void            _gtk_css_parser_skip_whitespace   (GtkCssParser          *parser);
96 void            _gtk_css_parser_resync            (GtkCssParser          *parser,
97                                                    gboolean               sync_at_semicolon,
98                                                    char                   terminator);
99
100 G_END_DECLS
101
102 #endif /* __GTK_CSS_PARSER_PRIVATE_H__ */