00001 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 00002 00003 /* 00004 * This file is part of The Croco Library 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of version 2.1 of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00018 * USA 00019 * 00020 * see COPYRIGHTS file for copyright information. 00021 */ 00022 00023 00024 #ifndef __CR_STYLESHEET_H__ 00025 #define __CR_STYLESHEET_H__ 00026 00027 #include "cr-utils.h" 00028 #include "cr-statement.h" 00029 00030 G_BEGIN_DECLS 00031 00032 /** 00033 *@file 00034 *The declaration of the #CRStyleSheet class. 00035 */ 00036 00037 00038 enum CRStyleOrigin 00039 { 00040 /*Please don't change the order of 00041 *the values enumerated here ... 00042 *New values should be added at the end, 00043 *just before ORIGIN_END. 00044 */ 00045 ORIGIN_UA = 0, 00046 ORIGIN_USER, 00047 ORIGIN_AUTHOR, 00048 00049 /*must always be the last one*/ 00050 NB_ORIGINS 00051 } ; 00052 00053 /** 00054 *An abstraction of a css stylesheet as defined 00055 *by the css2 spec in chapter 4. 00056 */ 00057 struct _CRStyleSheet 00058 { 00059 /**The css statements list*/ 00060 CRStatement *statements ; 00061 00062 enum CRStyleOrigin origin ; 00063 00064 /*the parent import rule, if any.*/ 00065 CRStatement *parent_import_rule ; 00066 00067 /**custom data used by libcroco*/ 00068 gpointer croco_data ; 00069 00070 /** 00071 *custom application data pointer 00072 *Can be used by applications. 00073 */ 00074 gpointer app_data ; 00075 00076 /** 00077 *the reference count of this insance 00078 *Please, don't never ever modify it 00079 *directly. Use cr_stylesheet_ref() 00080 *and cr_stylesheet_unref() instead. 00081 */ 00082 gulong ref_count ; 00083 } ; 00084 00085 CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ; 00086 00087 gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ; 00088 void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ; 00089 00090 gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ; 00091 00092 CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ; 00093 00094 void cr_stylesheet_ref (CRStyleSheet *a_this) ; 00095 00096 gboolean cr_stylesheet_unref (CRStyleSheet *a_this) ; 00097 00098 void cr_stylesheet_destroy (CRStyleSheet *a_this) ; 00099 00100 G_END_DECLS 00101 00102 #endif /*__CR_STYLESHEET_H__*/