From 9156953cc95cd4d814ea0ad0e9407efc9a6a0a7d Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 27 Oct 2010 15:52:36 +0200 Subject: Add more properties to LdSymbol. Also move the actual storage of symbol properties to implementations of the abstract LdSymbol class. All the properties are read only. --- src/ld-symbol.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/ld-symbol.h') diff --git a/src/ld-symbol.h b/src/ld-symbol.h index 4010107..92d7d82 100644 --- a/src/ld-symbol.h +++ b/src/ld-symbol.h @@ -30,6 +30,8 @@ typedef struct _LdSymbol LdSymbol; typedef struct _LdSymbolPrivate LdSymbolPrivate; typedef struct _LdSymbolClass LdSymbolClass; +typedef struct _LdSymbolArea LdSymbolArea; + /** * LdSymbol: @@ -42,27 +44,51 @@ struct _LdSymbol LdSymbolPrivate *priv; }; +/** + * LdSymbolArea: + * @x1: Left-top X coordinate. + * @y1: Left-top Y coordinate. + * @x2: Right-bottom X coordinate. + * @y2: Right-bottom Y coordinate. + * + * Defines the area of the symbol relative to the center of the symbol, + * which is at the (0, 0) coordinates. + */ +struct _LdSymbolArea +{ + gdouble x1, y1; + gdouble x2, y2; +}; + /** * LdSymbolClass: * @parent_class: The parent class. + * @get_name: Get the name of the symbol. + * @get_human_name: Get the localized human name of the symbol. + * @get_area: Get the area of the symbol. * @draw: Draw the symbol on a Cairo surface. */ struct _LdSymbolClass { GObjectClass parent_class; + const gchar *(*get_name) (LdSymbol *self); + const gchar *(*get_human_name) (LdSymbol *self); + void (*get_area) (LdSymbol *self, LdSymbolArea *area); void (*draw) (LdSymbol *self, cairo_t *cr); }; GType ld_symbol_get_type (void) G_GNUC_CONST; -void ld_symbol_set_name (LdSymbol *self, const gchar *name); const gchar *ld_symbol_get_name (LdSymbol *self); - +const gchar *ld_symbol_get_human_name (LdSymbol *self); +void ld_symbol_get_area (LdSymbol *self, LdSymbolArea *area); void ld_symbol_draw (LdSymbol *self, cairo_t *cr); -/* TODO: Interface for symbol terminals. */ +/* TODO: Interface for terminals. + * Something like a list of gdouble pairs (-> a new structure). + */ G_END_DECLS -- cgit v1.2.3-54-g00ecf