cr-sel-eng.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
  2. /*
  3. * This file is part of The Croco Library
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2.1 of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. *
  19. * Author: Dodji Seketeli
  20. * See COPYRIGHTS file for copyrights information.
  21. */
  22. #ifndef __CR_SEL_ENG_H__
  23. #define __CR_SEL_ENG_H__
  24. #include "cr-utils.h"
  25. #include "cr-stylesheet.h"
  26. #include "cr-cascade.h"
  27. #include "cr-style.h"
  28. #include "cr-prop-list.h"
  29. #include <libxml/tree.h>
  30. /**
  31. *@file:
  32. *The declaration of the #CRSelEng class.
  33. *The #CRSelEng is actually the "Selection Engine"
  34. *class.
  35. */
  36. G_BEGIN_DECLS
  37. typedef struct _CRSelEng CRSelEng ;
  38. typedef struct _CRSelEngPriv CRSelEngPriv ;
  39. /**
  40. *The Selection engine class.
  41. *The main service provided by this class, is
  42. *the ability to interpret a libcroco implementation
  43. *of css2 selectors, and given an xml node, say if
  44. *the selector matches the node or not.
  45. */
  46. struct _CRSelEng
  47. {
  48. CRSelEngPriv *priv ;
  49. } ;
  50. typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this,
  51. CRAdditionalSel *a_add_sel,
  52. xmlNode *a_node) ;
  53. CRSelEng * cr_sel_eng_new (void) ;
  54. enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this,
  55. guchar *a_pseudo_class_sel_name,
  56. enum CRPseudoType a_pseudo_class_type,
  57. CRPseudoClassSelectorHandler a_handler) ;
  58. enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this,
  59. guchar *a_pseudo_class_sel_name,
  60. enum CRPseudoType a_pseudo_class_type) ;
  61. enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ;
  62. enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this,
  63. guchar *a_pseudo_class_sel_name,
  64. enum CRPseudoType a_pseudo_class_type,
  65. CRPseudoClassSelectorHandler *a_handler) ;
  66. enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this,
  67. CRSimpleSel *a_sel,
  68. xmlNode *a_node,
  69. gboolean *a_result) ;
  70. enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this,
  71. CRStyleSheet *a_sheet,
  72. xmlNode *a_node,
  73. CRStatement ***a_rulesets,
  74. gulong *a_len) ;
  75. enum CRStatus
  76. cr_sel_eng_get_matched_properties_from_cascade (CRSelEng *a_this,
  77. CRCascade *a_cascade,
  78. xmlNode *a_node,
  79. CRPropList **a_props) ;
  80. enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this,
  81. CRCascade *a_cascade,
  82. xmlNode *a_node,
  83. CRStyle *a_parent_style,
  84. CRStyle **a_style,
  85. gboolean a_set_props_to_initial_values) ;
  86. void cr_sel_eng_destroy (CRSelEng *a_this) ;
  87. G_END_DECLS
  88. #endif/*__CR_SEL_ENG_H__*/