1 /* Fo 2 * fo-property.h: FoProperty superclass of all property classes 3 * 4 * Copyright (C) 2001 Sun Microsystems 5 * Copyright (C) 2007-2009 Menteith Consulting Ltd 6 * 7 * See COPYING for the status of this software. 8 */ 9 10 #ifndef __FO_PROPERTY_H__ 11 #define __FO_PROPERTY_H__ 12 13 #include <libfo/fo-utils.h> 14 #include <libfo/fo-object.h> 15 16 typedef struct _FoProperty FoProperty; 17 typedef struct _FoPropertyClass FoPropertyClass; 18 19 #include <libfo/datatype/fo-datatype.h> 20 #include <libfo/fo-context.h> 21 22 G_BEGIN_DECLS 23 24 #define FO_PROPERTY_ERROR fo_property_error_quark () 25 GQuark fo_property_error_quark (void); 26 27 typedef enum 28 { 29 FO_PROPERTY_ERROR_FAILED, 30 FO_PROPERTY_ERROR_EXPRESSION, 31 FO_PROPERTY_ERROR_NO_ENUMERATION, 32 FO_PROPERTY_ERROR_ILLEGAL_NEGATIVE, 33 FO_PROPERTY_ERROR_ZERO_LENGTH, 34 FO_PROPERTY_ERROR_LAST 35 } FoPropertyError; 36 37 #define FO_TYPE_PROPERTY (fo_property_get_type ()) 38 #define FO_PROPERTY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FO_TYPE_PROPERTY, FoProperty)) 39 #define FO_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FO_TYPE_PROPERTY, FoPropertyClass)) 40 #define FO_IS_PROPERTY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FO_TYPE_PROPERTY)) 41 #define FO_IS_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FO_TYPE_PROPERTY)) 42 #define FO_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FO_TYPE_PROPERTY, FoPropertyClass)) 43 44 GType fo_property_get_type (void) G_GNUC_CONST; 45 46 FoDatatype * fo_property_get_value (FoProperty *property); 47 void fo_property_set_value (FoProperty *property, 48 FoDatatype *new_value); 49 50 gboolean fo_property_class_is_inherited (FoPropertyClass *property_class); 51 gboolean fo_property_is_inherited (FoProperty *property); 52 53 gboolean fo_property_class_is_shorthand (FoPropertyClass *property_class); 54 gboolean fo_property_is_shorthand (FoProperty *property); 55 56 typedef FoDatatype* (*FoResolveEnumFunc) (const gchar *token, 57 FoContext *context, 58 GError **err); 59 typedef FoDatatype* (*FoResolvePercentFunc) (gdouble percentage, 60 const FoDatatype *font_size, 61 const FoFo *fo_node, 62 const FoContext *context, 63 GError **err); 64 FoProperty * fo_property_new_from_expr (FoPropertyClass *property_class, 65 const gchar *expr, 66 FoContext *context, 67 FoProperty *current_font_size, 68 FoFo *fo_node, 69 GError **error); 70 71 G_END_DECLS 72 73 #endif /* !__FO_PROPERTY_H__ */ 74