Libcroco
cr-sel-eng.h
Go to the documentation of this file.
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  * Author: Dodji Seketeli
00021  * See COPYRIGHTS file for copyrights information.
00022  */
00023 
00024 #ifndef __CR_SEL_ENG_H__
00025 #define __CR_SEL_ENG_H__
00026 
00027 #include "cr-utils.h"
00028 #include "cr-stylesheet.h"
00029 #include "cr-cascade.h"
00030 #include "cr-style.h"
00031 #include "cr-prop-list.h"
00032 
00033 #include <libxml/tree.h>
00034 
00035 /**
00036  *@file:
00037  *The declaration of the  #CRSelEng class.
00038  *The #CRSelEng is actually the "Selection Engine"
00039  *class.
00040  */
00041 
00042 G_BEGIN_DECLS
00043 
00044 typedef struct _CRSelEng CRSelEng ;
00045 typedef struct _CRSelEngPriv CRSelEngPriv ;
00046 
00047 /**
00048  *The Selection engine class.
00049  *The main service provided by this class, is
00050  *the ability to interpret a libcroco implementation
00051  *of css2 selectors, and given an xml node, say if
00052  *the selector matches the node or not.
00053  */
00054 struct _CRSelEng
00055 {
00056         CRSelEngPriv *priv ;
00057 } ;
00058 
00059 
00060 typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this,
00061                                                   CRAdditionalSel *a_add_sel,
00062                                                   xmlNode *a_node) ;
00063 CRSelEng * cr_sel_eng_new (void) ;
00064 
00065 enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this,
00066                                                             guchar *a_pseudo_class_sel_name,
00067                                                             enum CRPseudoType a_pseudo_class_type,
00068                                                             CRPseudoClassSelectorHandler a_handler) ;
00069 
00070 enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this,
00071                                                               guchar *a_pseudo_class_sel_name,
00072                                                               enum CRPseudoType a_pseudo_class_type) ;
00073 
00074 enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ;
00075 
00076 enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this,
00077                                                             guchar *a_pseudo_class_sel_name,
00078                                                             enum CRPseudoType a_pseudo_class_type,
00079                                                             CRPseudoClassSelectorHandler *a_handler) ;
00080 
00081 enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this, 
00082                                        CRSimpleSel *a_sel,
00083                                        xmlNode *a_node, 
00084                                        gboolean *a_result) ;
00085 
00086 enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this,
00087                                                CRStyleSheet *a_sheet,
00088                                                xmlNode *a_node,
00089                                                CRStatement ***a_rulesets,
00090                                                gulong *a_len) ;
00091 
00092 enum CRStatus
00093 cr_sel_eng_get_matched_properties_from_cascade  (CRSelEng *a_this,
00094                                                  CRCascade *a_cascade,
00095                                                  xmlNode *a_node,
00096                                                  CRPropList **a_props) ;
00097 
00098 enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this,
00099                                             CRCascade *a_cascade,
00100                                             xmlNode *a_node,
00101                                             CRStyle *a_parent_style,
00102                                             CRStyle **a_style,
00103                                             gboolean a_set_props_to_initial_values) ;
00104 
00105 void cr_sel_eng_destroy (CRSelEng *a_this) ;
00106 
00107 G_END_DECLS
00108 
00109 
00110 #endif/*__CR_SEL_ENG_H__*/