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 * Author: Dodji Seketeli
21 * See COPYRIGHTS file for copyrights information.
22 */
24 #ifndef __CR_SEL_ENG_H__
25 #define __CR_SEL_ENG_H__
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 #include "cr-node-iface.h"
36 /**
37 *@file:
38 *The declaration of the #CRSelEng class.
39 *The #CRSelEng is actually the "Selection Engine"
40 *class.
41 */
43 G_BEGIN_DECLS
45 typedef struct _CRSelEng CRSelEng ;
46 typedef struct _CRSelEngPriv CRSelEngPriv ;
48 /**
49 *The Selection engine class.
50 *The main service provided by this class, is
51 *the ability to interpret a libcroco implementation
52 *of css2 selectors, and given an xml node, say if
53 *the selector matches the node or not.
54 */
55 struct _CRSelEng
56 {
57 CRSelEngPriv *priv ;
58 } ;
60 void cr_sel_eng_set_node_iface(CRSelEng *a_this, CRNodeIface const *);
62 typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this,
63 CRAdditionalSel *a_add_sel,
64 CRXMLNodePtr a_node) ;
65 CRSelEng * cr_sel_eng_new (void) ;
67 enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this,
68 char *a_pseudo_class_sel_name,
69 enum CRPseudoType a_pseudo_class_type,
70 CRPseudoClassSelectorHandler a_handler) ;
72 enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this,
73 char *a_pseudo_class_sel_name,
74 enum CRPseudoType a_pseudo_class_type) ;
76 enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ;
78 enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this,
79 char *a_pseudo_class_sel_name,
80 enum CRPseudoType a_pseudo_class_type,
81 CRPseudoClassSelectorHandler *a_handler) ;
83 enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this,
84 CRSimpleSel *a_sel,
85 CRXMLNodePtr a_node,
86 gboolean *a_result) ;
88 enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this,
89 CRStyleSheet *a_sheet,
90 CRXMLNodePtr a_node,
91 CRStatement ***a_rulesets,
92 gulong *a_len) ;
94 enum CRStatus
95 cr_sel_eng_get_matched_properties_from_cascade (CRSelEng *a_this,
96 CRCascade *a_cascade,
97 CRXMLNodePtr a_node,
98 CRPropList **a_props) ;
100 enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this,
101 CRCascade *a_cascade,
102 CRXMLNodePtr a_node,
103 CRStyle *a_parent_style,
104 CRStyle **a_style,
105 gboolean a_set_props_to_initial_values) ;
107 void cr_sel_eng_destroy (CRSelEng *a_this) ;
109 G_END_DECLS
112 #endif/*__CR_SEL_ENG_H__*/