1/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ 2 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 * Author: Dodji Seketeli 21 * See COPYRIGHTS file for copyrights information. 22 */ 23 24#ifndef __CR_SEL_ENG_H__ 25#define __CR_SEL_ENG_H__ 26 27#include "cr-utils.h" 28#include "cr-stylesheet.h" 29#include "cr-cascade.h" 30#include "cr-style.h" 31#include "cr-prop-list.h" 32 33#ifdef CROCO_HAVE_LIBXML2 34 #include <libxml/tree.h> 35#endif 36 37 38 39/** 40 *@file: 41 *The declaration of the #CRSelEng class. 42 *The #CRSelEng is actually the "Selection Engine" 43 *class. 44 */ 45 46G_BEGIN_DECLS 47 48typedef struct _CRSelEng CRSelEng ; 49typedef struct _CRSelEngPriv CRSelEngPriv ; 50 51/** 52 *The Selection engine class. 53 *The main service provided by this class, is 54 *the ability to interpret a libcroco implementation 55 *of css2 selectors, and given an xml node, say if 56 *the selector matches the node or not. 57 */ 58struct _CRSelEng 59{ 60 CRSelEngPriv *priv ; 61} ; 62 63 64typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this, 65 CRAdditionalSel *a_add_sel, 66 xmlNode *a_node) ; 67CRSelEng * cr_sel_eng_new (void) ; 68 69enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this, 70 guchar *a_pseudo_class_sel_name, 71 enum CRPseudoType a_pseudo_class_type, 72 CRPseudoClassSelectorHandler a_handler) ; 73 74enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this, 75 guchar *a_pseudo_class_sel_name, 76 enum CRPseudoType a_pseudo_class_type) ; 77 78enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ; 79 80enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this, 81 guchar *a_pseudo_class_sel_name, 82 enum CRPseudoType a_pseudo_class_type, 83 CRPseudoClassSelectorHandler *a_handler) ; 84 85enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this, 86 CRSimpleSel *a_sel, 87 xmlNode *a_node, 88 gboolean *a_result) ; 89 90enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this, 91 CRStyleSheet *a_sheet, 92 xmlNode *a_node, 93 CRStatement ***a_rulesets, 94 gulong *a_len) ; 95 96enum CRStatus 97cr_sel_eng_get_matched_properties_from_cascade (CRSelEng *a_this, 98 CRCascade *a_cascade, 99 xmlNode *a_node, 100 CRPropList **a_props) ; 101 102enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this, 103 CRCascade *a_cascade, 104 xmlNode *a_node, 105 CRStyle *a_parent_style, 106 CRStyle **a_style, 107 gboolean a_set_props_to_initial_values) ; 108 109void cr_sel_eng_destroy (CRSelEng *a_this) ; 110 111G_END_DECLS 112 113 114#endif/*__CR_SEL_ENG_H__*/ 115