1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
3 /*
4 * This file is part of The Croco Library
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2.1 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 *
20 * see COPYRIGHTS file for copyright information.
21 */
24 #ifndef __CR_STYLESHEET_H__
25 #define __CR_STYLESHEET_H__
27 #include "cr-utils.h"
28 #include "cr-statement.h"
30 G_BEGIN_DECLS
32 /**
33 *@file
34 *The declaration of the #CRStyleSheet class.
35 */
38 enum CRStyleOrigin
39 {
40 /*Please don't change the order of
41 *the values enumerated here ...
42 *New values should be added at the end,
43 *just before ORIGIN_END.
44 */
45 ORIGIN_UA = 0,
46 ORIGIN_USER,
47 ORIGIN_AUTHOR,
49 /*must always be the last one*/
50 NB_ORIGINS
51 } ;
53 /**
54 *An abstraction of a css stylesheet as defined
55 *by the css2 spec in chapter 4.
56 */
57 struct _CRStyleSheet
58 {
59 /**The css statements list*/
60 CRStatement *statements ;
62 enum CRStyleOrigin origin ;
64 /*the parent import rule, if any.*/
65 CRStatement *parent_import_rule ;
67 /**custom data used by libcroco*/
68 gpointer croco_data ;
70 /**
71 *custom application data pointer
72 *Can be used by applications.
73 */
74 gpointer app_data ;
76 /**
77 *the reference count of this insance
78 *Please, don't never ever modify it
79 *directly. Use cr_stylesheet_ref()
80 *and cr_stylesheet_unref() instead.
81 */
82 gulong ref_count ;
83 } ;
85 CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
87 gchar * cr_stylesheet_to_string (CRStyleSheet *a_this) ;
88 void cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) ;
90 gint cr_stylesheet_nr_rules (CRStyleSheet *a_this) ;
92 CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
94 void cr_stylesheet_ref (CRStyleSheet *a_this) ;
96 gboolean cr_stylesheet_unref (CRStyleSheet *a_this) ;
98 void cr_stylesheet_destroy (CRStyleSheet *a_this) ;
100 G_END_DECLS
102 #endif /*__CR_STYLESHEET_H__*/